Update CI references to 0.0.122
[ldk-java] / src / main / jni / bindings.c
1 #define LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ LDKCVec_TransactionOutputsZ
2 #define CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free CVec_TransactionOutputsZ_free
3 #define LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ LDKCVec_TransactionOutputsZ
4 #define CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free CVec_TransactionOutputsZ_free
5 #include <jni.h>
6 // On OSX jlong (ie long long) is not equivalent to int64_t, so we override here
7 #define int64_t jlong
8 #include "org_ldk_impl_bindings.h"
9 #include <lightning.h>
10 #include <string.h>
11 #include <stdatomic.h>
12 #include <stdlib.h>
13
14 #define LIKELY(v) __builtin_expect(!!(v), 1)
15 #define UNLIKELY(v) __builtin_expect(!!(v), 0)
16
17 #define DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__)
18 #define MALLOC(a, _) malloc(a)
19 #define FREE(p) if ((uint64_t)(p) > 4096) { free(p); }
20 #define CHECK_ACCESS(p)
21 #define CHECK_INNER_FIELD_ACCESS_OR_NULL(v)
22 #define DO_ASSERT(a) (void)(a)
23 #define CHECK(a)
24
25 static jmethodID ordinal_meth = NULL;
26 JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class) {
27         ordinal_meth = (*env)->GetMethodID(env, enum_class, "ordinal", "()I");
28         CHECK(ordinal_meth != NULL);
29 }
30
31 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
32 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
33 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
34 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
35
36 _Static_assert(sizeof(jlong) == sizeof(int64_t), "We assume that j-types are the same as C types");
37 _Static_assert(sizeof(jbyte) == sizeof(char), "We assume that j-types are the same as C types");
38 _Static_assert(sizeof(void*) <= 8, "Pointers must fit into 64 bits");
39
40 typedef jlongArray int64_tArray;
41 typedef jbyteArray int8_tArray;
42 typedef jshortArray int16_tArray;
43
44 static inline jstring str_ref_to_java(JNIEnv *env, const unsigned char* chars, size_t len) {
45         // Java uses "Modified UTF-8" rather than UTF-8. This requires special
46         // handling for codepoints above 0xFFFF, which get converted from four
47         // bytes to six. We don't know upfront how many codepoints in the string
48         // are above 0xFFFF, so we just allocate an extra 33% up front and waste a
49         // bit of space.
50         unsigned char* java_chars = MALLOC(len * 3 / 2 + 1, "str conv buf");
51         unsigned char* next_java_char = java_chars;
52         const unsigned char* next_in_char = chars;
53         const unsigned char* end = chars + len;
54         #define COPY_CHAR_TO_JAVA do { *next_java_char = *next_in_char; next_java_char++; next_in_char++; } while (0)
55
56         while (next_in_char < end) {
57                 if (!*next_in_char) break;
58                 if (!(*next_in_char & 0b10000000)) {
59                         COPY_CHAR_TO_JAVA;
60                 } else if ((*next_in_char & 0b11100000) == 0b11000000) {
61                         if (next_in_char + 2 > end) { CHECK(false); break; } // bad string
62                         COPY_CHAR_TO_JAVA;
63                         COPY_CHAR_TO_JAVA;
64                 } else if ((*next_in_char & 0b11110000) == 0b11100000) {
65                         if (next_in_char + 3 > end) { CHECK(false); break; } // bad string
66                         COPY_CHAR_TO_JAVA;
67                         COPY_CHAR_TO_JAVA;
68                         COPY_CHAR_TO_JAVA;
69                 } else if ((*next_in_char & 0b11111000) == 0b11110000) {
70                         if (next_in_char + 4 > end) { CHECK(false); break; } // bad string
71                         uint32_t codepoint = 0;
72                         codepoint |= (((uint32_t)*(next_in_char    )) & 0b00000111) << 18;
73                         codepoint |= (((uint32_t)*(next_in_char + 1)) & 0b00111111) << 12;
74                         codepoint |= (((uint32_t)*(next_in_char + 2)) & 0b00111111) << 6;
75                         codepoint |= (((uint32_t)*(next_in_char + 3)) & 0b00111111) << 0;
76                         codepoint -= 0x10000;
77                         *next_java_char = 0b11101101;
78                         next_java_char++;
79                         *next_java_char = 0b10100000 | ((codepoint >> 16) & 0b00001111);
80                         next_java_char++;
81                         *next_java_char = 0b10000000 | ((codepoint >> 10) & 0b00111111);
82                         next_java_char++;
83                         *next_java_char = 0b11101101;
84                         next_java_char++;
85                         *next_java_char = 0b10110000 | ((codepoint >>  6) & 0b00001111);
86                         next_java_char++;
87                         *next_java_char = 0b10000000 | ((codepoint >>  0) & 0b00111111);
88                         next_java_char++;
89                         next_in_char += 4;
90                 } else {
91                         // Bad string
92                         CHECK(false);
93                         break;
94                 }
95         }
96         *next_java_char = 0;
97         jstring ret = (*env)->NewStringUTF(env, java_chars);
98         FREE(java_chars);
99         return ret;
100 }
101 static inline LDKStr java_to_owned_str(JNIEnv *env, jstring str) {
102         uint64_t str_len = (*env)->GetStringUTFLength(env, str);
103         // Java uses "Modified UTF-8" rather than UTF-8. This requires special
104         // handling for codepoints above 0xFFFF, which we implement below.
105         unsigned char* newchars = MALLOC(str_len, "String chars");
106         unsigned char* next_newchar = newchars;
107         uint64_t utf8_len = 0;
108
109         const unsigned char* jchars = (*env)->GetStringUTFChars(env, str, NULL);
110         const unsigned char* next_char = jchars;
111         const unsigned char* end = jchars + str_len;
112
113         #define COPY_CHAR_FROM_JAVA do { *next_newchar = *next_char; next_newchar++; next_char++; utf8_len++; } while (0)
114
115         while (next_char < end) {
116                 if (!(*next_char & 0b10000000)) {
117                         CHECK(*next_char != 0); // Bad Modified UTF-8 string, but we'll just cut here
118                         COPY_CHAR_FROM_JAVA;
119                 } else if ((*next_char & 0b11100000) == 0b11000000) {
120                         if (next_char + 2 > end) { CHECK(false); break; } // bad string
121                         uint16_t codepoint = 0;
122                         codepoint |= (((uint16_t)(*next_char & 0x1f)) << 6);
123                         codepoint |= *(next_char + 1) & 0x3f;
124                         if (codepoint == 0) {
125                                 // We should really never get null codepoints, but java allows them.
126                                 // Just skip it.
127                                 next_char += 2;
128                         } else {
129                                 COPY_CHAR_FROM_JAVA;
130                                 COPY_CHAR_FROM_JAVA;
131                         }
132                 } else if ((*next_char & 0b11110000) == 0b11100000) {
133                         if (next_char + 3 > end) { CHECK(false); break; } // bad string
134                         if (*next_char == 0b11101101 && (*(next_char + 1) & 0b11110000) == 0b10100000) {
135                                 // Surrogate code unit shoul indicate we have a codepoint above
136                                 // 0xFFFF, which is where Modified UTF-8 and UTF-8 diverge.
137                                 if (next_char + 6 > end) { CHECK(false); break; } // bad string
138                                 CHECK(*(next_char + 3) == 0b11101101);
139                                 CHECK((*(next_char + 4) & 0b11110000) == 0b10110000);
140                                 // Calculate the codepoint per https://docs.oracle.com/javase/1.5.0/docs/guide/jni/spec/types.html#wp16542
141                                 uint32_t codepoint = 0x10000;
142                                 codepoint += ((((uint32_t)*(next_char + 1)) & 0x0f) << 16);
143                                 codepoint += ((((uint32_t)*(next_char + 2)) & 0x3f) << 10);
144                                 codepoint += ((((uint32_t)*(next_char + 4)) & 0x0f) <<  6);
145                                 codepoint +=  (((uint32_t)*(next_char + 5)) & 0x3f);
146                                 *next_newchar = 0b11110000 | ((codepoint >> 18) &    0b111);
147                                 next_newchar++;
148                                 *next_newchar = 0b10000000 | ((codepoint >> 12) & 0b111111);
149                                 next_newchar++;
150                                 *next_newchar = 0b10000000 | ((codepoint >>  6) & 0b111111);
151                                 next_newchar++;
152                                 *next_newchar = 0b10000000 | ( codepoint        & 0b111111);
153                                 next_newchar++;
154                                 next_char += 6;
155                                 utf8_len += 4;
156                         } else {
157                                 COPY_CHAR_FROM_JAVA;
158                                 COPY_CHAR_FROM_JAVA;
159                                 COPY_CHAR_FROM_JAVA;
160                         }
161                 } else {
162                         // Bad string
163                         CHECK(false);
164                         break;
165                 }
166         }
167         (*env)->ReleaseStringUTFChars(env, str, jchars);
168         LDKStr res = {
169                 .chars = newchars,
170                 .len = utf8_len,
171                 .chars_is_owned = true
172         };
173         return res;
174 }
175
176 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1c_1bindings_1version(JNIEnv *env, jclass _c) {
177         return str_ref_to_java(env, check_get_ldk_bindings_version(), strlen(check_get_ldk_bindings_version()));
178 }
179 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1version(JNIEnv *env, jclass _c) {
180         return str_ref_to_java(env, check_get_ldk_version(), strlen(check_get_ldk_version()));
181 }
182 #include "version.c"
183 static jclass arr_of_B_clz = NULL;
184 static jclass String_clz = NULL;
185 JNIEXPORT void Java_org_ldk_impl_bindings_init_1class_1cache(JNIEnv * env, jclass clz) {
186         arr_of_B_clz = (*env)->FindClass(env, "[B");
187         CHECK(arr_of_B_clz != NULL);
188         arr_of_B_clz = (*env)->NewGlobalRef(env, arr_of_B_clz);
189         String_clz = (*env)->FindClass(env, "java/lang/String");
190         CHECK(String_clz != NULL);
191         String_clz = (*env)->NewGlobalRef(env, String_clz);
192 }
193 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
194
195 static inline void* untag_ptr(uint64_t ptr) {
196         if (ptr < 4096) return (void*)ptr;
197         if (sizeof(void*) == 4) {
198                 // For 32-bit systems, store pointers as 64-bit ints and use the 31st bit
199                 return (void*)(uintptr_t)ptr;
200         } else {
201                 // For 64-bit systems, assume the top byte is used for tagging, then
202                 // use bit 9 ^ bit 10.
203                 uint64_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
204                 uintptr_t p = (ptr & ~(1ULL << 55)) | (tenth_bit << 55);
205 #ifdef LDK_DEBUG_BUILD
206                 // On debug builds we also use the 11th bit as a debug flag
207                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
208                 CHECK(tenth_bit != eleventh_bit);
209                 p ^= 1ULL << 53;
210 #endif
211                 return (void*)p;
212         }
213 }
214 static inline bool ptr_is_owned(uint64_t ptr) {
215         if(ptr < 4096) return true;
216         if (sizeof(void*) == 4) {
217                 return ptr & (1ULL << 32);
218         } else {
219                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
220                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
221 #ifdef LDK_DEBUG_BUILD
222                 // On debug builds we also use the 11th bit as a debug flag
223                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
224                 CHECK(tenth_bit != eleventh_bit);
225 #endif
226                 return (ninth_bit ^ tenth_bit) ? true : false;
227         }
228 }
229 static inline uint64_t tag_ptr(const void* ptr, bool is_owned) {
230         if ((uintptr_t)ptr < 4096) return (uint64_t)ptr;
231         if (sizeof(void*) == 4) {
232                 return (((uint64_t)ptr) | ((is_owned ? 1ULL : 0) << 32));
233         } else {
234                 CHECK(sizeof(uintptr_t) == 8);
235                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
236                 uintptr_t t = (((uintptr_t)ptr) | (((is_owned ? 1ULL : 0ULL) ^ tenth_bit) << 55));
237 #ifdef LDK_DEBUG_BUILD
238                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
239                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
240                 CHECK(ninth_bit == tenth_bit);
241                 CHECK(ninth_bit == eleventh_bit);
242                 t ^= 1ULL << 53;
243 #endif
244                 CHECK(ptr_is_owned(t) == is_owned);
245                 CHECK(untag_ptr(t) == ptr);
246                 return t;
247         }
248 }
249
250 static inline LDKBlindedFailure LDKBlindedFailure_from_java(JNIEnv *env, jclass clz) {
251         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
252         if (UNLIKELY((*env)->ExceptionCheck(env))) {
253                 (*env)->ExceptionDescribe(env);
254                 (*env)->FatalError(env, "A call to BlindedFailure.ordinal() from rust threw an exception.");
255         }
256         switch (ord) {
257                 case 0: return LDKBlindedFailure_FromIntroductionNode;
258                 case 1: return LDKBlindedFailure_FromBlindedNode;
259         }
260         (*env)->FatalError(env, "A call to BlindedFailure.ordinal() from rust returned an invalid value.");
261         abort(); // Unreachable, but will let the compiler know we don't return here
262 }
263 static jclass BlindedFailure_class = NULL;
264 static jfieldID BlindedFailure_LDKBlindedFailure_FromIntroductionNode = NULL;
265 static jfieldID BlindedFailure_LDKBlindedFailure_FromBlindedNode = NULL;
266 JNIEXPORT void JNICALL Java_org_ldk_enums_BlindedFailure_init (JNIEnv *env, jclass clz) {
267         BlindedFailure_class = (*env)->NewGlobalRef(env, clz);
268         CHECK(BlindedFailure_class != NULL);
269         BlindedFailure_LDKBlindedFailure_FromIntroductionNode = (*env)->GetStaticFieldID(env, BlindedFailure_class, "LDKBlindedFailure_FromIntroductionNode", "Lorg/ldk/enums/BlindedFailure;");
270         CHECK(BlindedFailure_LDKBlindedFailure_FromIntroductionNode != NULL);
271         BlindedFailure_LDKBlindedFailure_FromBlindedNode = (*env)->GetStaticFieldID(env, BlindedFailure_class, "LDKBlindedFailure_FromBlindedNode", "Lorg/ldk/enums/BlindedFailure;");
272         CHECK(BlindedFailure_LDKBlindedFailure_FromBlindedNode != NULL);
273 }
274 static inline jclass LDKBlindedFailure_to_java(JNIEnv *env, LDKBlindedFailure val) {
275         switch (val) {
276                 case LDKBlindedFailure_FromIntroductionNode:
277                         return (*env)->GetStaticObjectField(env, BlindedFailure_class, BlindedFailure_LDKBlindedFailure_FromIntroductionNode);
278                 case LDKBlindedFailure_FromBlindedNode:
279                         return (*env)->GetStaticObjectField(env, BlindedFailure_class, BlindedFailure_LDKBlindedFailure_FromBlindedNode);
280                 default: abort();
281         }
282 }
283
284 static inline LDKBolt11SemanticError LDKBolt11SemanticError_from_java(JNIEnv *env, jclass clz) {
285         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
286         if (UNLIKELY((*env)->ExceptionCheck(env))) {
287                 (*env)->ExceptionDescribe(env);
288                 (*env)->FatalError(env, "A call to Bolt11SemanticError.ordinal() from rust threw an exception.");
289         }
290         switch (ord) {
291                 case 0: return LDKBolt11SemanticError_NoPaymentHash;
292                 case 1: return LDKBolt11SemanticError_MultiplePaymentHashes;
293                 case 2: return LDKBolt11SemanticError_NoDescription;
294                 case 3: return LDKBolt11SemanticError_MultipleDescriptions;
295                 case 4: return LDKBolt11SemanticError_NoPaymentSecret;
296                 case 5: return LDKBolt11SemanticError_MultiplePaymentSecrets;
297                 case 6: return LDKBolt11SemanticError_InvalidFeatures;
298                 case 7: return LDKBolt11SemanticError_InvalidRecoveryId;
299                 case 8: return LDKBolt11SemanticError_InvalidSignature;
300                 case 9: return LDKBolt11SemanticError_ImpreciseAmount;
301         }
302         (*env)->FatalError(env, "A call to Bolt11SemanticError.ordinal() from rust returned an invalid value.");
303         abort(); // Unreachable, but will let the compiler know we don't return here
304 }
305 static jclass Bolt11SemanticError_class = NULL;
306 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentHash = NULL;
307 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentHashes = NULL;
308 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_NoDescription = NULL;
309 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_MultipleDescriptions = NULL;
310 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentSecret = NULL;
311 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentSecrets = NULL;
312 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_InvalidFeatures = NULL;
313 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_InvalidRecoveryId = NULL;
314 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_InvalidSignature = NULL;
315 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_ImpreciseAmount = NULL;
316 JNIEXPORT void JNICALL Java_org_ldk_enums_Bolt11SemanticError_init (JNIEnv *env, jclass clz) {
317         Bolt11SemanticError_class = (*env)->NewGlobalRef(env, clz);
318         CHECK(Bolt11SemanticError_class != NULL);
319         Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentHash = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_NoPaymentHash", "Lorg/ldk/enums/Bolt11SemanticError;");
320         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentHash != NULL);
321         Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentHashes = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_MultiplePaymentHashes", "Lorg/ldk/enums/Bolt11SemanticError;");
322         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentHashes != NULL);
323         Bolt11SemanticError_LDKBolt11SemanticError_NoDescription = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_NoDescription", "Lorg/ldk/enums/Bolt11SemanticError;");
324         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_NoDescription != NULL);
325         Bolt11SemanticError_LDKBolt11SemanticError_MultipleDescriptions = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_MultipleDescriptions", "Lorg/ldk/enums/Bolt11SemanticError;");
326         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_MultipleDescriptions != NULL);
327         Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentSecret = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_NoPaymentSecret", "Lorg/ldk/enums/Bolt11SemanticError;");
328         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentSecret != NULL);
329         Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentSecrets = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_MultiplePaymentSecrets", "Lorg/ldk/enums/Bolt11SemanticError;");
330         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentSecrets != NULL);
331         Bolt11SemanticError_LDKBolt11SemanticError_InvalidFeatures = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_InvalidFeatures", "Lorg/ldk/enums/Bolt11SemanticError;");
332         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_InvalidFeatures != NULL);
333         Bolt11SemanticError_LDKBolt11SemanticError_InvalidRecoveryId = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_InvalidRecoveryId", "Lorg/ldk/enums/Bolt11SemanticError;");
334         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_InvalidRecoveryId != NULL);
335         Bolt11SemanticError_LDKBolt11SemanticError_InvalidSignature = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_InvalidSignature", "Lorg/ldk/enums/Bolt11SemanticError;");
336         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_InvalidSignature != NULL);
337         Bolt11SemanticError_LDKBolt11SemanticError_ImpreciseAmount = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_ImpreciseAmount", "Lorg/ldk/enums/Bolt11SemanticError;");
338         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_ImpreciseAmount != NULL);
339 }
340 static inline jclass LDKBolt11SemanticError_to_java(JNIEnv *env, LDKBolt11SemanticError val) {
341         switch (val) {
342                 case LDKBolt11SemanticError_NoPaymentHash:
343                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentHash);
344                 case LDKBolt11SemanticError_MultiplePaymentHashes:
345                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentHashes);
346                 case LDKBolt11SemanticError_NoDescription:
347                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_NoDescription);
348                 case LDKBolt11SemanticError_MultipleDescriptions:
349                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_MultipleDescriptions);
350                 case LDKBolt11SemanticError_NoPaymentSecret:
351                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentSecret);
352                 case LDKBolt11SemanticError_MultiplePaymentSecrets:
353                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentSecrets);
354                 case LDKBolt11SemanticError_InvalidFeatures:
355                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_InvalidFeatures);
356                 case LDKBolt11SemanticError_InvalidRecoveryId:
357                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_InvalidRecoveryId);
358                 case LDKBolt11SemanticError_InvalidSignature:
359                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_InvalidSignature);
360                 case LDKBolt11SemanticError_ImpreciseAmount:
361                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_ImpreciseAmount);
362                 default: abort();
363         }
364 }
365
366 static inline LDKBolt12SemanticError LDKBolt12SemanticError_from_java(JNIEnv *env, jclass clz) {
367         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
368         if (UNLIKELY((*env)->ExceptionCheck(env))) {
369                 (*env)->ExceptionDescribe(env);
370                 (*env)->FatalError(env, "A call to Bolt12SemanticError.ordinal() from rust threw an exception.");
371         }
372         switch (ord) {
373                 case 0: return LDKBolt12SemanticError_AlreadyExpired;
374                 case 1: return LDKBolt12SemanticError_UnsupportedChain;
375                 case 2: return LDKBolt12SemanticError_UnexpectedChain;
376                 case 3: return LDKBolt12SemanticError_MissingAmount;
377                 case 4: return LDKBolt12SemanticError_InvalidAmount;
378                 case 5: return LDKBolt12SemanticError_InsufficientAmount;
379                 case 6: return LDKBolt12SemanticError_UnexpectedAmount;
380                 case 7: return LDKBolt12SemanticError_UnsupportedCurrency;
381                 case 8: return LDKBolt12SemanticError_UnknownRequiredFeatures;
382                 case 9: return LDKBolt12SemanticError_UnexpectedFeatures;
383                 case 10: return LDKBolt12SemanticError_MissingDescription;
384                 case 11: return LDKBolt12SemanticError_MissingSigningPubkey;
385                 case 12: return LDKBolt12SemanticError_InvalidSigningPubkey;
386                 case 13: return LDKBolt12SemanticError_UnexpectedSigningPubkey;
387                 case 14: return LDKBolt12SemanticError_MissingQuantity;
388                 case 15: return LDKBolt12SemanticError_InvalidQuantity;
389                 case 16: return LDKBolt12SemanticError_UnexpectedQuantity;
390                 case 17: return LDKBolt12SemanticError_InvalidMetadata;
391                 case 18: return LDKBolt12SemanticError_UnexpectedMetadata;
392                 case 19: return LDKBolt12SemanticError_MissingPayerMetadata;
393                 case 20: return LDKBolt12SemanticError_MissingPayerId;
394                 case 21: return LDKBolt12SemanticError_DuplicatePaymentId;
395                 case 22: return LDKBolt12SemanticError_MissingPaths;
396                 case 23: return LDKBolt12SemanticError_InvalidPayInfo;
397                 case 24: return LDKBolt12SemanticError_MissingCreationTime;
398                 case 25: return LDKBolt12SemanticError_MissingPaymentHash;
399                 case 26: return LDKBolt12SemanticError_MissingSignature;
400         }
401         (*env)->FatalError(env, "A call to Bolt12SemanticError.ordinal() from rust returned an invalid value.");
402         abort(); // Unreachable, but will let the compiler know we don't return here
403 }
404 static jclass Bolt12SemanticError_class = NULL;
405 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_AlreadyExpired = NULL;
406 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedChain = NULL;
407 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedChain = NULL;
408 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingAmount = NULL;
409 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidAmount = NULL;
410 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InsufficientAmount = NULL;
411 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedAmount = NULL;
412 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedCurrency = NULL;
413 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnknownRequiredFeatures = NULL;
414 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedFeatures = NULL;
415 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingDescription = NULL;
416 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingSigningPubkey = NULL;
417 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidSigningPubkey = NULL;
418 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedSigningPubkey = NULL;
419 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingQuantity = NULL;
420 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidQuantity = NULL;
421 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedQuantity = NULL;
422 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidMetadata = NULL;
423 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedMetadata = NULL;
424 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerMetadata = NULL;
425 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId = NULL;
426 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_DuplicatePaymentId = NULL;
427 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths = NULL;
428 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidPayInfo = NULL;
429 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingCreationTime = NULL;
430 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPaymentHash = NULL;
431 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingSignature = NULL;
432 JNIEXPORT void JNICALL Java_org_ldk_enums_Bolt12SemanticError_init (JNIEnv *env, jclass clz) {
433         Bolt12SemanticError_class = (*env)->NewGlobalRef(env, clz);
434         CHECK(Bolt12SemanticError_class != NULL);
435         Bolt12SemanticError_LDKBolt12SemanticError_AlreadyExpired = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_AlreadyExpired", "Lorg/ldk/enums/Bolt12SemanticError;");
436         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_AlreadyExpired != NULL);
437         Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedChain = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnsupportedChain", "Lorg/ldk/enums/Bolt12SemanticError;");
438         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedChain != NULL);
439         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedChain = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedChain", "Lorg/ldk/enums/Bolt12SemanticError;");
440         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedChain != NULL);
441         Bolt12SemanticError_LDKBolt12SemanticError_MissingAmount = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingAmount", "Lorg/ldk/enums/Bolt12SemanticError;");
442         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingAmount != NULL);
443         Bolt12SemanticError_LDKBolt12SemanticError_InvalidAmount = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidAmount", "Lorg/ldk/enums/Bolt12SemanticError;");
444         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidAmount != NULL);
445         Bolt12SemanticError_LDKBolt12SemanticError_InsufficientAmount = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InsufficientAmount", "Lorg/ldk/enums/Bolt12SemanticError;");
446         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InsufficientAmount != NULL);
447         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedAmount = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedAmount", "Lorg/ldk/enums/Bolt12SemanticError;");
448         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedAmount != NULL);
449         Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedCurrency = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnsupportedCurrency", "Lorg/ldk/enums/Bolt12SemanticError;");
450         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedCurrency != NULL);
451         Bolt12SemanticError_LDKBolt12SemanticError_UnknownRequiredFeatures = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnknownRequiredFeatures", "Lorg/ldk/enums/Bolt12SemanticError;");
452         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnknownRequiredFeatures != NULL);
453         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedFeatures = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedFeatures", "Lorg/ldk/enums/Bolt12SemanticError;");
454         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedFeatures != NULL);
455         Bolt12SemanticError_LDKBolt12SemanticError_MissingDescription = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingDescription", "Lorg/ldk/enums/Bolt12SemanticError;");
456         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingDescription != NULL);
457         Bolt12SemanticError_LDKBolt12SemanticError_MissingSigningPubkey = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingSigningPubkey", "Lorg/ldk/enums/Bolt12SemanticError;");
458         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingSigningPubkey != NULL);
459         Bolt12SemanticError_LDKBolt12SemanticError_InvalidSigningPubkey = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidSigningPubkey", "Lorg/ldk/enums/Bolt12SemanticError;");
460         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidSigningPubkey != NULL);
461         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedSigningPubkey = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedSigningPubkey", "Lorg/ldk/enums/Bolt12SemanticError;");
462         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedSigningPubkey != NULL);
463         Bolt12SemanticError_LDKBolt12SemanticError_MissingQuantity = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingQuantity", "Lorg/ldk/enums/Bolt12SemanticError;");
464         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingQuantity != NULL);
465         Bolt12SemanticError_LDKBolt12SemanticError_InvalidQuantity = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidQuantity", "Lorg/ldk/enums/Bolt12SemanticError;");
466         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidQuantity != NULL);
467         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedQuantity = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedQuantity", "Lorg/ldk/enums/Bolt12SemanticError;");
468         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedQuantity != NULL);
469         Bolt12SemanticError_LDKBolt12SemanticError_InvalidMetadata = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidMetadata", "Lorg/ldk/enums/Bolt12SemanticError;");
470         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidMetadata != NULL);
471         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedMetadata = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedMetadata", "Lorg/ldk/enums/Bolt12SemanticError;");
472         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedMetadata != NULL);
473         Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerMetadata = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingPayerMetadata", "Lorg/ldk/enums/Bolt12SemanticError;");
474         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerMetadata != NULL);
475         Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingPayerId", "Lorg/ldk/enums/Bolt12SemanticError;");
476         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId != NULL);
477         Bolt12SemanticError_LDKBolt12SemanticError_DuplicatePaymentId = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_DuplicatePaymentId", "Lorg/ldk/enums/Bolt12SemanticError;");
478         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_DuplicatePaymentId != NULL);
479         Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingPaths", "Lorg/ldk/enums/Bolt12SemanticError;");
480         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths != 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_InvalidPayInfo:
539                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidPayInfo);
540                 case LDKBolt12SemanticError_MissingCreationTime:
541                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingCreationTime);
542                 case LDKBolt12SemanticError_MissingPaymentHash:
543                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingPaymentHash);
544                 case LDKBolt12SemanticError_MissingSignature:
545                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingSignature);
546                 default: abort();
547         }
548 }
549
550 static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_java(JNIEnv *env, jclass clz) {
551         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
552         if (UNLIKELY((*env)->ExceptionCheck(env))) {
553                 (*env)->ExceptionDescribe(env);
554                 (*env)->FatalError(env, "A call to COption_NoneZ.ordinal() from rust threw an exception.");
555         }
556         switch (ord) {
557                 case 0: return LDKCOption_NoneZ_Some;
558                 case 1: return LDKCOption_NoneZ_None;
559         }
560         (*env)->FatalError(env, "A call to COption_NoneZ.ordinal() from rust returned an invalid value.");
561         abort(); // Unreachable, but will let the compiler know we don't return here
562 }
563 static jclass COption_NoneZ_class = NULL;
564 static jfieldID COption_NoneZ_LDKCOption_NoneZ_Some = NULL;
565 static jfieldID COption_NoneZ_LDKCOption_NoneZ_None = NULL;
566 JNIEXPORT void JNICALL Java_org_ldk_enums_COption_1NoneZ_init (JNIEnv *env, jclass clz) {
567         COption_NoneZ_class = (*env)->NewGlobalRef(env, clz);
568         CHECK(COption_NoneZ_class != NULL);
569         COption_NoneZ_LDKCOption_NoneZ_Some = (*env)->GetStaticFieldID(env, COption_NoneZ_class, "LDKCOption_NoneZ_Some", "Lorg/ldk/enums/COption_NoneZ;");
570         CHECK(COption_NoneZ_LDKCOption_NoneZ_Some != NULL);
571         COption_NoneZ_LDKCOption_NoneZ_None = (*env)->GetStaticFieldID(env, COption_NoneZ_class, "LDKCOption_NoneZ_None", "Lorg/ldk/enums/COption_NoneZ;");
572         CHECK(COption_NoneZ_LDKCOption_NoneZ_None != NULL);
573 }
574 static inline jclass LDKCOption_NoneZ_to_java(JNIEnv *env, LDKCOption_NoneZ val) {
575         switch (val) {
576                 case LDKCOption_NoneZ_Some:
577                         return (*env)->GetStaticObjectField(env, COption_NoneZ_class, COption_NoneZ_LDKCOption_NoneZ_Some);
578                 case LDKCOption_NoneZ_None:
579                         return (*env)->GetStaticObjectField(env, COption_NoneZ_class, COption_NoneZ_LDKCOption_NoneZ_None);
580                 default: abort();
581         }
582 }
583
584 static inline LDKChannelMonitorUpdateStatus LDKChannelMonitorUpdateStatus_from_java(JNIEnv *env, jclass clz) {
585         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
586         if (UNLIKELY((*env)->ExceptionCheck(env))) {
587                 (*env)->ExceptionDescribe(env);
588                 (*env)->FatalError(env, "A call to ChannelMonitorUpdateStatus.ordinal() from rust threw an exception.");
589         }
590         switch (ord) {
591                 case 0: return LDKChannelMonitorUpdateStatus_Completed;
592                 case 1: return LDKChannelMonitorUpdateStatus_InProgress;
593                 case 2: return LDKChannelMonitorUpdateStatus_UnrecoverableError;
594         }
595         (*env)->FatalError(env, "A call to ChannelMonitorUpdateStatus.ordinal() from rust returned an invalid value.");
596         abort(); // Unreachable, but will let the compiler know we don't return here
597 }
598 static jclass ChannelMonitorUpdateStatus_class = NULL;
599 static jfieldID ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed = NULL;
600 static jfieldID ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress = NULL;
601 static jfieldID ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_UnrecoverableError = NULL;
602 JNIEXPORT void JNICALL Java_org_ldk_enums_ChannelMonitorUpdateStatus_init (JNIEnv *env, jclass clz) {
603         ChannelMonitorUpdateStatus_class = (*env)->NewGlobalRef(env, clz);
604         CHECK(ChannelMonitorUpdateStatus_class != NULL);
605         ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateStatus_class, "LDKChannelMonitorUpdateStatus_Completed", "Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
606         CHECK(ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed != NULL);
607         ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateStatus_class, "LDKChannelMonitorUpdateStatus_InProgress", "Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
608         CHECK(ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress != NULL);
609         ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_UnrecoverableError = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateStatus_class, "LDKChannelMonitorUpdateStatus_UnrecoverableError", "Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
610         CHECK(ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_UnrecoverableError != NULL);
611 }
612 static inline jclass LDKChannelMonitorUpdateStatus_to_java(JNIEnv *env, LDKChannelMonitorUpdateStatus val) {
613         switch (val) {
614                 case LDKChannelMonitorUpdateStatus_Completed:
615                         return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateStatus_class, ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed);
616                 case LDKChannelMonitorUpdateStatus_InProgress:
617                         return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateStatus_class, ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress);
618                 case LDKChannelMonitorUpdateStatus_UnrecoverableError:
619                         return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateStatus_class, ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_UnrecoverableError);
620                 default: abort();
621         }
622 }
623
624 static inline LDKChannelShutdownState LDKChannelShutdownState_from_java(JNIEnv *env, jclass clz) {
625         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
626         if (UNLIKELY((*env)->ExceptionCheck(env))) {
627                 (*env)->ExceptionDescribe(env);
628                 (*env)->FatalError(env, "A call to ChannelShutdownState.ordinal() from rust threw an exception.");
629         }
630         switch (ord) {
631                 case 0: return LDKChannelShutdownState_NotShuttingDown;
632                 case 1: return LDKChannelShutdownState_ShutdownInitiated;
633                 case 2: return LDKChannelShutdownState_ResolvingHTLCs;
634                 case 3: return LDKChannelShutdownState_NegotiatingClosingFee;
635                 case 4: return LDKChannelShutdownState_ShutdownComplete;
636         }
637         (*env)->FatalError(env, "A call to ChannelShutdownState.ordinal() from rust returned an invalid value.");
638         abort(); // Unreachable, but will let the compiler know we don't return here
639 }
640 static jclass ChannelShutdownState_class = NULL;
641 static jfieldID ChannelShutdownState_LDKChannelShutdownState_NotShuttingDown = NULL;
642 static jfieldID ChannelShutdownState_LDKChannelShutdownState_ShutdownInitiated = NULL;
643 static jfieldID ChannelShutdownState_LDKChannelShutdownState_ResolvingHTLCs = NULL;
644 static jfieldID ChannelShutdownState_LDKChannelShutdownState_NegotiatingClosingFee = NULL;
645 static jfieldID ChannelShutdownState_LDKChannelShutdownState_ShutdownComplete = NULL;
646 JNIEXPORT void JNICALL Java_org_ldk_enums_ChannelShutdownState_init (JNIEnv *env, jclass clz) {
647         ChannelShutdownState_class = (*env)->NewGlobalRef(env, clz);
648         CHECK(ChannelShutdownState_class != NULL);
649         ChannelShutdownState_LDKChannelShutdownState_NotShuttingDown = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_NotShuttingDown", "Lorg/ldk/enums/ChannelShutdownState;");
650         CHECK(ChannelShutdownState_LDKChannelShutdownState_NotShuttingDown != NULL);
651         ChannelShutdownState_LDKChannelShutdownState_ShutdownInitiated = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_ShutdownInitiated", "Lorg/ldk/enums/ChannelShutdownState;");
652         CHECK(ChannelShutdownState_LDKChannelShutdownState_ShutdownInitiated != NULL);
653         ChannelShutdownState_LDKChannelShutdownState_ResolvingHTLCs = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_ResolvingHTLCs", "Lorg/ldk/enums/ChannelShutdownState;");
654         CHECK(ChannelShutdownState_LDKChannelShutdownState_ResolvingHTLCs != NULL);
655         ChannelShutdownState_LDKChannelShutdownState_NegotiatingClosingFee = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_NegotiatingClosingFee", "Lorg/ldk/enums/ChannelShutdownState;");
656         CHECK(ChannelShutdownState_LDKChannelShutdownState_NegotiatingClosingFee != NULL);
657         ChannelShutdownState_LDKChannelShutdownState_ShutdownComplete = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_ShutdownComplete", "Lorg/ldk/enums/ChannelShutdownState;");
658         CHECK(ChannelShutdownState_LDKChannelShutdownState_ShutdownComplete != NULL);
659 }
660 static inline jclass LDKChannelShutdownState_to_java(JNIEnv *env, LDKChannelShutdownState val) {
661         switch (val) {
662                 case LDKChannelShutdownState_NotShuttingDown:
663                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_NotShuttingDown);
664                 case LDKChannelShutdownState_ShutdownInitiated:
665                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_ShutdownInitiated);
666                 case LDKChannelShutdownState_ResolvingHTLCs:
667                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_ResolvingHTLCs);
668                 case LDKChannelShutdownState_NegotiatingClosingFee:
669                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_NegotiatingClosingFee);
670                 case LDKChannelShutdownState_ShutdownComplete:
671                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_ShutdownComplete);
672                 default: abort();
673         }
674 }
675
676 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass clz) {
677         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
678         if (UNLIKELY((*env)->ExceptionCheck(env))) {
679                 (*env)->ExceptionDescribe(env);
680                 (*env)->FatalError(env, "A call to ConfirmationTarget.ordinal() from rust threw an exception.");
681         }
682         switch (ord) {
683                 case 0: return LDKConfirmationTarget_OnChainSweep;
684                 case 1: return LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee;
685                 case 2: return LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee;
686                 case 3: return LDKConfirmationTarget_AnchorChannelFee;
687                 case 4: return LDKConfirmationTarget_NonAnchorChannelFee;
688                 case 5: return LDKConfirmationTarget_ChannelCloseMinimum;
689         }
690         (*env)->FatalError(env, "A call to ConfirmationTarget.ordinal() from rust returned an invalid value.");
691         abort(); // Unreachable, but will let the compiler know we don't return here
692 }
693 static jclass ConfirmationTarget_class = NULL;
694 static jfieldID ConfirmationTarget_LDKConfirmationTarget_OnChainSweep = NULL;
695 static jfieldID ConfirmationTarget_LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee = NULL;
696 static jfieldID ConfirmationTarget_LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee = NULL;
697 static jfieldID ConfirmationTarget_LDKConfirmationTarget_AnchorChannelFee = NULL;
698 static jfieldID ConfirmationTarget_LDKConfirmationTarget_NonAnchorChannelFee = NULL;
699 static jfieldID ConfirmationTarget_LDKConfirmationTarget_ChannelCloseMinimum = NULL;
700 JNIEXPORT void JNICALL Java_org_ldk_enums_ConfirmationTarget_init (JNIEnv *env, jclass clz) {
701         ConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
702         CHECK(ConfirmationTarget_class != NULL);
703         ConfirmationTarget_LDKConfirmationTarget_OnChainSweep = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_OnChainSweep", "Lorg/ldk/enums/ConfirmationTarget;");
704         CHECK(ConfirmationTarget_LDKConfirmationTarget_OnChainSweep != NULL);
705         ConfirmationTarget_LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee", "Lorg/ldk/enums/ConfirmationTarget;");
706         CHECK(ConfirmationTarget_LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee != NULL);
707         ConfirmationTarget_LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee", "Lorg/ldk/enums/ConfirmationTarget;");
708         CHECK(ConfirmationTarget_LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee != NULL);
709         ConfirmationTarget_LDKConfirmationTarget_AnchorChannelFee = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_AnchorChannelFee", "Lorg/ldk/enums/ConfirmationTarget;");
710         CHECK(ConfirmationTarget_LDKConfirmationTarget_AnchorChannelFee != NULL);
711         ConfirmationTarget_LDKConfirmationTarget_NonAnchorChannelFee = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_NonAnchorChannelFee", "Lorg/ldk/enums/ConfirmationTarget;");
712         CHECK(ConfirmationTarget_LDKConfirmationTarget_NonAnchorChannelFee != NULL);
713         ConfirmationTarget_LDKConfirmationTarget_ChannelCloseMinimum = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_ChannelCloseMinimum", "Lorg/ldk/enums/ConfirmationTarget;");
714         CHECK(ConfirmationTarget_LDKConfirmationTarget_ChannelCloseMinimum != NULL);
715 }
716 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
717         switch (val) {
718                 case LDKConfirmationTarget_OnChainSweep:
719                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_OnChainSweep);
720                 case LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee:
721                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee);
722                 case LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee:
723                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee);
724                 case LDKConfirmationTarget_AnchorChannelFee:
725                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_AnchorChannelFee);
726                 case LDKConfirmationTarget_NonAnchorChannelFee:
727                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_NonAnchorChannelFee);
728                 case LDKConfirmationTarget_ChannelCloseMinimum:
729                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_ChannelCloseMinimum);
730                 default: abort();
731         }
732 }
733
734 static inline LDKCreationError LDKCreationError_from_java(JNIEnv *env, jclass clz) {
735         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
736         if (UNLIKELY((*env)->ExceptionCheck(env))) {
737                 (*env)->ExceptionDescribe(env);
738                 (*env)->FatalError(env, "A call to CreationError.ordinal() from rust threw an exception.");
739         }
740         switch (ord) {
741                 case 0: return LDKCreationError_DescriptionTooLong;
742                 case 1: return LDKCreationError_RouteTooLong;
743                 case 2: return LDKCreationError_TimestampOutOfBounds;
744                 case 3: return LDKCreationError_InvalidAmount;
745                 case 4: return LDKCreationError_MissingRouteHints;
746                 case 5: return LDKCreationError_MinFinalCltvExpiryDeltaTooShort;
747         }
748         (*env)->FatalError(env, "A call to CreationError.ordinal() from rust returned an invalid value.");
749         abort(); // Unreachable, but will let the compiler know we don't return here
750 }
751 static jclass CreationError_class = NULL;
752 static jfieldID CreationError_LDKCreationError_DescriptionTooLong = NULL;
753 static jfieldID CreationError_LDKCreationError_RouteTooLong = NULL;
754 static jfieldID CreationError_LDKCreationError_TimestampOutOfBounds = NULL;
755 static jfieldID CreationError_LDKCreationError_InvalidAmount = NULL;
756 static jfieldID CreationError_LDKCreationError_MissingRouteHints = NULL;
757 static jfieldID CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort = NULL;
758 JNIEXPORT void JNICALL Java_org_ldk_enums_CreationError_init (JNIEnv *env, jclass clz) {
759         CreationError_class = (*env)->NewGlobalRef(env, clz);
760         CHECK(CreationError_class != NULL);
761         CreationError_LDKCreationError_DescriptionTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_DescriptionTooLong", "Lorg/ldk/enums/CreationError;");
762         CHECK(CreationError_LDKCreationError_DescriptionTooLong != NULL);
763         CreationError_LDKCreationError_RouteTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_RouteTooLong", "Lorg/ldk/enums/CreationError;");
764         CHECK(CreationError_LDKCreationError_RouteTooLong != NULL);
765         CreationError_LDKCreationError_TimestampOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_TimestampOutOfBounds", "Lorg/ldk/enums/CreationError;");
766         CHECK(CreationError_LDKCreationError_TimestampOutOfBounds != NULL);
767         CreationError_LDKCreationError_InvalidAmount = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_InvalidAmount", "Lorg/ldk/enums/CreationError;");
768         CHECK(CreationError_LDKCreationError_InvalidAmount != NULL);
769         CreationError_LDKCreationError_MissingRouteHints = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_MissingRouteHints", "Lorg/ldk/enums/CreationError;");
770         CHECK(CreationError_LDKCreationError_MissingRouteHints != NULL);
771         CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_MinFinalCltvExpiryDeltaTooShort", "Lorg/ldk/enums/CreationError;");
772         CHECK(CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort != NULL);
773 }
774 static inline jclass LDKCreationError_to_java(JNIEnv *env, LDKCreationError val) {
775         switch (val) {
776                 case LDKCreationError_DescriptionTooLong:
777                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_DescriptionTooLong);
778                 case LDKCreationError_RouteTooLong:
779                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_RouteTooLong);
780                 case LDKCreationError_TimestampOutOfBounds:
781                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_TimestampOutOfBounds);
782                 case LDKCreationError_InvalidAmount:
783                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_InvalidAmount);
784                 case LDKCreationError_MissingRouteHints:
785                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_MissingRouteHints);
786                 case LDKCreationError_MinFinalCltvExpiryDeltaTooShort:
787                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort);
788                 default: abort();
789         }
790 }
791
792 static inline LDKCurrency LDKCurrency_from_java(JNIEnv *env, jclass clz) {
793         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
794         if (UNLIKELY((*env)->ExceptionCheck(env))) {
795                 (*env)->ExceptionDescribe(env);
796                 (*env)->FatalError(env, "A call to Currency.ordinal() from rust threw an exception.");
797         }
798         switch (ord) {
799                 case 0: return LDKCurrency_Bitcoin;
800                 case 1: return LDKCurrency_BitcoinTestnet;
801                 case 2: return LDKCurrency_Regtest;
802                 case 3: return LDKCurrency_Simnet;
803                 case 4: return LDKCurrency_Signet;
804         }
805         (*env)->FatalError(env, "A call to Currency.ordinal() from rust returned an invalid value.");
806         abort(); // Unreachable, but will let the compiler know we don't return here
807 }
808 static jclass Currency_class = NULL;
809 static jfieldID Currency_LDKCurrency_Bitcoin = NULL;
810 static jfieldID Currency_LDKCurrency_BitcoinTestnet = NULL;
811 static jfieldID Currency_LDKCurrency_Regtest = NULL;
812 static jfieldID Currency_LDKCurrency_Simnet = NULL;
813 static jfieldID Currency_LDKCurrency_Signet = NULL;
814 JNIEXPORT void JNICALL Java_org_ldk_enums_Currency_init (JNIEnv *env, jclass clz) {
815         Currency_class = (*env)->NewGlobalRef(env, clz);
816         CHECK(Currency_class != NULL);
817         Currency_LDKCurrency_Bitcoin = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Bitcoin", "Lorg/ldk/enums/Currency;");
818         CHECK(Currency_LDKCurrency_Bitcoin != NULL);
819         Currency_LDKCurrency_BitcoinTestnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_BitcoinTestnet", "Lorg/ldk/enums/Currency;");
820         CHECK(Currency_LDKCurrency_BitcoinTestnet != NULL);
821         Currency_LDKCurrency_Regtest = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Regtest", "Lorg/ldk/enums/Currency;");
822         CHECK(Currency_LDKCurrency_Regtest != NULL);
823         Currency_LDKCurrency_Simnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Simnet", "Lorg/ldk/enums/Currency;");
824         CHECK(Currency_LDKCurrency_Simnet != NULL);
825         Currency_LDKCurrency_Signet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Signet", "Lorg/ldk/enums/Currency;");
826         CHECK(Currency_LDKCurrency_Signet != NULL);
827 }
828 static inline jclass LDKCurrency_to_java(JNIEnv *env, LDKCurrency val) {
829         switch (val) {
830                 case LDKCurrency_Bitcoin:
831                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Bitcoin);
832                 case LDKCurrency_BitcoinTestnet:
833                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_BitcoinTestnet);
834                 case LDKCurrency_Regtest:
835                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Regtest);
836                 case LDKCurrency_Simnet:
837                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Simnet);
838                 case LDKCurrency_Signet:
839                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Signet);
840                 default: abort();
841         }
842 }
843
844 static inline LDKHTLCClaim LDKHTLCClaim_from_java(JNIEnv *env, jclass clz) {
845         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
846         if (UNLIKELY((*env)->ExceptionCheck(env))) {
847                 (*env)->ExceptionDescribe(env);
848                 (*env)->FatalError(env, "A call to HTLCClaim.ordinal() from rust threw an exception.");
849         }
850         switch (ord) {
851                 case 0: return LDKHTLCClaim_OfferedTimeout;
852                 case 1: return LDKHTLCClaim_OfferedPreimage;
853                 case 2: return LDKHTLCClaim_AcceptedTimeout;
854                 case 3: return LDKHTLCClaim_AcceptedPreimage;
855                 case 4: return LDKHTLCClaim_Revocation;
856         }
857         (*env)->FatalError(env, "A call to HTLCClaim.ordinal() from rust returned an invalid value.");
858         abort(); // Unreachable, but will let the compiler know we don't return here
859 }
860 static jclass HTLCClaim_class = NULL;
861 static jfieldID HTLCClaim_LDKHTLCClaim_OfferedTimeout = NULL;
862 static jfieldID HTLCClaim_LDKHTLCClaim_OfferedPreimage = NULL;
863 static jfieldID HTLCClaim_LDKHTLCClaim_AcceptedTimeout = NULL;
864 static jfieldID HTLCClaim_LDKHTLCClaim_AcceptedPreimage = NULL;
865 static jfieldID HTLCClaim_LDKHTLCClaim_Revocation = NULL;
866 JNIEXPORT void JNICALL Java_org_ldk_enums_HTLCClaim_init (JNIEnv *env, jclass clz) {
867         HTLCClaim_class = (*env)->NewGlobalRef(env, clz);
868         CHECK(HTLCClaim_class != NULL);
869         HTLCClaim_LDKHTLCClaim_OfferedTimeout = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_OfferedTimeout", "Lorg/ldk/enums/HTLCClaim;");
870         CHECK(HTLCClaim_LDKHTLCClaim_OfferedTimeout != NULL);
871         HTLCClaim_LDKHTLCClaim_OfferedPreimage = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_OfferedPreimage", "Lorg/ldk/enums/HTLCClaim;");
872         CHECK(HTLCClaim_LDKHTLCClaim_OfferedPreimage != NULL);
873         HTLCClaim_LDKHTLCClaim_AcceptedTimeout = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_AcceptedTimeout", "Lorg/ldk/enums/HTLCClaim;");
874         CHECK(HTLCClaim_LDKHTLCClaim_AcceptedTimeout != NULL);
875         HTLCClaim_LDKHTLCClaim_AcceptedPreimage = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_AcceptedPreimage", "Lorg/ldk/enums/HTLCClaim;");
876         CHECK(HTLCClaim_LDKHTLCClaim_AcceptedPreimage != NULL);
877         HTLCClaim_LDKHTLCClaim_Revocation = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_Revocation", "Lorg/ldk/enums/HTLCClaim;");
878         CHECK(HTLCClaim_LDKHTLCClaim_Revocation != NULL);
879 }
880 static inline jclass LDKHTLCClaim_to_java(JNIEnv *env, LDKHTLCClaim val) {
881         switch (val) {
882                 case LDKHTLCClaim_OfferedTimeout:
883                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_OfferedTimeout);
884                 case LDKHTLCClaim_OfferedPreimage:
885                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_OfferedPreimage);
886                 case LDKHTLCClaim_AcceptedTimeout:
887                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_AcceptedTimeout);
888                 case LDKHTLCClaim_AcceptedPreimage:
889                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_AcceptedPreimage);
890                 case LDKHTLCClaim_Revocation:
891                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_Revocation);
892                 default: abort();
893         }
894 }
895
896 static inline LDKIOError LDKIOError_from_java(JNIEnv *env, jclass clz) {
897         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
898         if (UNLIKELY((*env)->ExceptionCheck(env))) {
899                 (*env)->ExceptionDescribe(env);
900                 (*env)->FatalError(env, "A call to IOError.ordinal() from rust threw an exception.");
901         }
902         switch (ord) {
903                 case 0: return LDKIOError_NotFound;
904                 case 1: return LDKIOError_PermissionDenied;
905                 case 2: return LDKIOError_ConnectionRefused;
906                 case 3: return LDKIOError_ConnectionReset;
907                 case 4: return LDKIOError_ConnectionAborted;
908                 case 5: return LDKIOError_NotConnected;
909                 case 6: return LDKIOError_AddrInUse;
910                 case 7: return LDKIOError_AddrNotAvailable;
911                 case 8: return LDKIOError_BrokenPipe;
912                 case 9: return LDKIOError_AlreadyExists;
913                 case 10: return LDKIOError_WouldBlock;
914                 case 11: return LDKIOError_InvalidInput;
915                 case 12: return LDKIOError_InvalidData;
916                 case 13: return LDKIOError_TimedOut;
917                 case 14: return LDKIOError_WriteZero;
918                 case 15: return LDKIOError_Interrupted;
919                 case 16: return LDKIOError_Other;
920                 case 17: return LDKIOError_UnexpectedEof;
921         }
922         (*env)->FatalError(env, "A call to IOError.ordinal() from rust returned an invalid value.");
923         abort(); // Unreachable, but will let the compiler know we don't return here
924 }
925 static jclass IOError_class = NULL;
926 static jfieldID IOError_LDKIOError_NotFound = NULL;
927 static jfieldID IOError_LDKIOError_PermissionDenied = NULL;
928 static jfieldID IOError_LDKIOError_ConnectionRefused = NULL;
929 static jfieldID IOError_LDKIOError_ConnectionReset = NULL;
930 static jfieldID IOError_LDKIOError_ConnectionAborted = NULL;
931 static jfieldID IOError_LDKIOError_NotConnected = NULL;
932 static jfieldID IOError_LDKIOError_AddrInUse = NULL;
933 static jfieldID IOError_LDKIOError_AddrNotAvailable = NULL;
934 static jfieldID IOError_LDKIOError_BrokenPipe = NULL;
935 static jfieldID IOError_LDKIOError_AlreadyExists = NULL;
936 static jfieldID IOError_LDKIOError_WouldBlock = NULL;
937 static jfieldID IOError_LDKIOError_InvalidInput = NULL;
938 static jfieldID IOError_LDKIOError_InvalidData = NULL;
939 static jfieldID IOError_LDKIOError_TimedOut = NULL;
940 static jfieldID IOError_LDKIOError_WriteZero = NULL;
941 static jfieldID IOError_LDKIOError_Interrupted = NULL;
942 static jfieldID IOError_LDKIOError_Other = NULL;
943 static jfieldID IOError_LDKIOError_UnexpectedEof = NULL;
944 JNIEXPORT void JNICALL Java_org_ldk_enums_IOError_init (JNIEnv *env, jclass clz) {
945         IOError_class = (*env)->NewGlobalRef(env, clz);
946         CHECK(IOError_class != NULL);
947         IOError_LDKIOError_NotFound = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotFound", "Lorg/ldk/enums/IOError;");
948         CHECK(IOError_LDKIOError_NotFound != NULL);
949         IOError_LDKIOError_PermissionDenied = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_PermissionDenied", "Lorg/ldk/enums/IOError;");
950         CHECK(IOError_LDKIOError_PermissionDenied != NULL);
951         IOError_LDKIOError_ConnectionRefused = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionRefused", "Lorg/ldk/enums/IOError;");
952         CHECK(IOError_LDKIOError_ConnectionRefused != NULL);
953         IOError_LDKIOError_ConnectionReset = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionReset", "Lorg/ldk/enums/IOError;");
954         CHECK(IOError_LDKIOError_ConnectionReset != NULL);
955         IOError_LDKIOError_ConnectionAborted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionAborted", "Lorg/ldk/enums/IOError;");
956         CHECK(IOError_LDKIOError_ConnectionAborted != NULL);
957         IOError_LDKIOError_NotConnected = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotConnected", "Lorg/ldk/enums/IOError;");
958         CHECK(IOError_LDKIOError_NotConnected != NULL);
959         IOError_LDKIOError_AddrInUse = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrInUse", "Lorg/ldk/enums/IOError;");
960         CHECK(IOError_LDKIOError_AddrInUse != NULL);
961         IOError_LDKIOError_AddrNotAvailable = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrNotAvailable", "Lorg/ldk/enums/IOError;");
962         CHECK(IOError_LDKIOError_AddrNotAvailable != NULL);
963         IOError_LDKIOError_BrokenPipe = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_BrokenPipe", "Lorg/ldk/enums/IOError;");
964         CHECK(IOError_LDKIOError_BrokenPipe != NULL);
965         IOError_LDKIOError_AlreadyExists = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AlreadyExists", "Lorg/ldk/enums/IOError;");
966         CHECK(IOError_LDKIOError_AlreadyExists != NULL);
967         IOError_LDKIOError_WouldBlock = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WouldBlock", "Lorg/ldk/enums/IOError;");
968         CHECK(IOError_LDKIOError_WouldBlock != NULL);
969         IOError_LDKIOError_InvalidInput = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidInput", "Lorg/ldk/enums/IOError;");
970         CHECK(IOError_LDKIOError_InvalidInput != NULL);
971         IOError_LDKIOError_InvalidData = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidData", "Lorg/ldk/enums/IOError;");
972         CHECK(IOError_LDKIOError_InvalidData != NULL);
973         IOError_LDKIOError_TimedOut = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_TimedOut", "Lorg/ldk/enums/IOError;");
974         CHECK(IOError_LDKIOError_TimedOut != NULL);
975         IOError_LDKIOError_WriteZero = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WriteZero", "Lorg/ldk/enums/IOError;");
976         CHECK(IOError_LDKIOError_WriteZero != NULL);
977         IOError_LDKIOError_Interrupted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Interrupted", "Lorg/ldk/enums/IOError;");
978         CHECK(IOError_LDKIOError_Interrupted != NULL);
979         IOError_LDKIOError_Other = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Other", "Lorg/ldk/enums/IOError;");
980         CHECK(IOError_LDKIOError_Other != NULL);
981         IOError_LDKIOError_UnexpectedEof = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_UnexpectedEof", "Lorg/ldk/enums/IOError;");
982         CHECK(IOError_LDKIOError_UnexpectedEof != NULL);
983 }
984 static inline jclass LDKIOError_to_java(JNIEnv *env, LDKIOError val) {
985         switch (val) {
986                 case LDKIOError_NotFound:
987                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotFound);
988                 case LDKIOError_PermissionDenied:
989                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_PermissionDenied);
990                 case LDKIOError_ConnectionRefused:
991                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionRefused);
992                 case LDKIOError_ConnectionReset:
993                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionReset);
994                 case LDKIOError_ConnectionAborted:
995                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionAborted);
996                 case LDKIOError_NotConnected:
997                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotConnected);
998                 case LDKIOError_AddrInUse:
999                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrInUse);
1000                 case LDKIOError_AddrNotAvailable:
1001                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrNotAvailable);
1002                 case LDKIOError_BrokenPipe:
1003                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_BrokenPipe);
1004                 case LDKIOError_AlreadyExists:
1005                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AlreadyExists);
1006                 case LDKIOError_WouldBlock:
1007                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WouldBlock);
1008                 case LDKIOError_InvalidInput:
1009                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidInput);
1010                 case LDKIOError_InvalidData:
1011                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidData);
1012                 case LDKIOError_TimedOut:
1013                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_TimedOut);
1014                 case LDKIOError_WriteZero:
1015                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WriteZero);
1016                 case LDKIOError_Interrupted:
1017                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Interrupted);
1018                 case LDKIOError_Other:
1019                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Other);
1020                 case LDKIOError_UnexpectedEof:
1021                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_UnexpectedEof);
1022                 default: abort();
1023         }
1024 }
1025
1026 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass clz) {
1027         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1028         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1029                 (*env)->ExceptionDescribe(env);
1030                 (*env)->FatalError(env, "A call to Level.ordinal() from rust threw an exception.");
1031         }
1032         switch (ord) {
1033                 case 0: return LDKLevel_Gossip;
1034                 case 1: return LDKLevel_Trace;
1035                 case 2: return LDKLevel_Debug;
1036                 case 3: return LDKLevel_Info;
1037                 case 4: return LDKLevel_Warn;
1038                 case 5: return LDKLevel_Error;
1039         }
1040         (*env)->FatalError(env, "A call to Level.ordinal() from rust returned an invalid value.");
1041         abort(); // Unreachable, but will let the compiler know we don't return here
1042 }
1043 static jclass Level_class = NULL;
1044 static jfieldID Level_LDKLevel_Gossip = NULL;
1045 static jfieldID Level_LDKLevel_Trace = NULL;
1046 static jfieldID Level_LDKLevel_Debug = NULL;
1047 static jfieldID Level_LDKLevel_Info = NULL;
1048 static jfieldID Level_LDKLevel_Warn = NULL;
1049 static jfieldID Level_LDKLevel_Error = NULL;
1050 JNIEXPORT void JNICALL Java_org_ldk_enums_Level_init (JNIEnv *env, jclass clz) {
1051         Level_class = (*env)->NewGlobalRef(env, clz);
1052         CHECK(Level_class != NULL);
1053         Level_LDKLevel_Gossip = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Gossip", "Lorg/ldk/enums/Level;");
1054         CHECK(Level_LDKLevel_Gossip != NULL);
1055         Level_LDKLevel_Trace = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Trace", "Lorg/ldk/enums/Level;");
1056         CHECK(Level_LDKLevel_Trace != NULL);
1057         Level_LDKLevel_Debug = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Debug", "Lorg/ldk/enums/Level;");
1058         CHECK(Level_LDKLevel_Debug != NULL);
1059         Level_LDKLevel_Info = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Info", "Lorg/ldk/enums/Level;");
1060         CHECK(Level_LDKLevel_Info != NULL);
1061         Level_LDKLevel_Warn = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Warn", "Lorg/ldk/enums/Level;");
1062         CHECK(Level_LDKLevel_Warn != NULL);
1063         Level_LDKLevel_Error = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Error", "Lorg/ldk/enums/Level;");
1064         CHECK(Level_LDKLevel_Error != NULL);
1065 }
1066 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
1067         switch (val) {
1068                 case LDKLevel_Gossip:
1069                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Gossip);
1070                 case LDKLevel_Trace:
1071                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Trace);
1072                 case LDKLevel_Debug:
1073                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Debug);
1074                 case LDKLevel_Info:
1075                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Info);
1076                 case LDKLevel_Warn:
1077                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Warn);
1078                 case LDKLevel_Error:
1079                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Error);
1080                 default: abort();
1081         }
1082 }
1083
1084 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass clz) {
1085         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1086         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1087                 (*env)->ExceptionDescribe(env);
1088                 (*env)->FatalError(env, "A call to Network.ordinal() from rust threw an exception.");
1089         }
1090         switch (ord) {
1091                 case 0: return LDKNetwork_Bitcoin;
1092                 case 1: return LDKNetwork_Testnet;
1093                 case 2: return LDKNetwork_Regtest;
1094                 case 3: return LDKNetwork_Signet;
1095         }
1096         (*env)->FatalError(env, "A call to Network.ordinal() from rust returned an invalid value.");
1097         abort(); // Unreachable, but will let the compiler know we don't return here
1098 }
1099 static jclass Network_class = NULL;
1100 static jfieldID Network_LDKNetwork_Bitcoin = NULL;
1101 static jfieldID Network_LDKNetwork_Testnet = NULL;
1102 static jfieldID Network_LDKNetwork_Regtest = NULL;
1103 static jfieldID Network_LDKNetwork_Signet = NULL;
1104 JNIEXPORT void JNICALL Java_org_ldk_enums_Network_init (JNIEnv *env, jclass clz) {
1105         Network_class = (*env)->NewGlobalRef(env, clz);
1106         CHECK(Network_class != NULL);
1107         Network_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/Network;");
1108         CHECK(Network_LDKNetwork_Bitcoin != NULL);
1109         Network_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/Network;");
1110         CHECK(Network_LDKNetwork_Testnet != NULL);
1111         Network_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/Network;");
1112         CHECK(Network_LDKNetwork_Regtest != NULL);
1113         Network_LDKNetwork_Signet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Signet", "Lorg/ldk/enums/Network;");
1114         CHECK(Network_LDKNetwork_Signet != NULL);
1115 }
1116 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
1117         switch (val) {
1118                 case LDKNetwork_Bitcoin:
1119                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Bitcoin);
1120                 case LDKNetwork_Testnet:
1121                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Testnet);
1122                 case LDKNetwork_Regtest:
1123                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Regtest);
1124                 case LDKNetwork_Signet:
1125                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Signet);
1126                 default: abort();
1127         }
1128 }
1129
1130 static inline LDKPaymentFailureReason LDKPaymentFailureReason_from_java(JNIEnv *env, jclass clz) {
1131         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1132         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1133                 (*env)->ExceptionDescribe(env);
1134                 (*env)->FatalError(env, "A call to PaymentFailureReason.ordinal() from rust threw an exception.");
1135         }
1136         switch (ord) {
1137                 case 0: return LDKPaymentFailureReason_RecipientRejected;
1138                 case 1: return LDKPaymentFailureReason_UserAbandoned;
1139                 case 2: return LDKPaymentFailureReason_RetriesExhausted;
1140                 case 3: return LDKPaymentFailureReason_PaymentExpired;
1141                 case 4: return LDKPaymentFailureReason_RouteNotFound;
1142                 case 5: return LDKPaymentFailureReason_UnexpectedError;
1143         }
1144         (*env)->FatalError(env, "A call to PaymentFailureReason.ordinal() from rust returned an invalid value.");
1145         abort(); // Unreachable, but will let the compiler know we don't return here
1146 }
1147 static jclass PaymentFailureReason_class = NULL;
1148 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_RecipientRejected = NULL;
1149 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_UserAbandoned = NULL;
1150 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_RetriesExhausted = NULL;
1151 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_PaymentExpired = NULL;
1152 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_RouteNotFound = NULL;
1153 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_UnexpectedError = NULL;
1154 JNIEXPORT void JNICALL Java_org_ldk_enums_PaymentFailureReason_init (JNIEnv *env, jclass clz) {
1155         PaymentFailureReason_class = (*env)->NewGlobalRef(env, clz);
1156         CHECK(PaymentFailureReason_class != NULL);
1157         PaymentFailureReason_LDKPaymentFailureReason_RecipientRejected = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_RecipientRejected", "Lorg/ldk/enums/PaymentFailureReason;");
1158         CHECK(PaymentFailureReason_LDKPaymentFailureReason_RecipientRejected != NULL);
1159         PaymentFailureReason_LDKPaymentFailureReason_UserAbandoned = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_UserAbandoned", "Lorg/ldk/enums/PaymentFailureReason;");
1160         CHECK(PaymentFailureReason_LDKPaymentFailureReason_UserAbandoned != NULL);
1161         PaymentFailureReason_LDKPaymentFailureReason_RetriesExhausted = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_RetriesExhausted", "Lorg/ldk/enums/PaymentFailureReason;");
1162         CHECK(PaymentFailureReason_LDKPaymentFailureReason_RetriesExhausted != NULL);
1163         PaymentFailureReason_LDKPaymentFailureReason_PaymentExpired = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_PaymentExpired", "Lorg/ldk/enums/PaymentFailureReason;");
1164         CHECK(PaymentFailureReason_LDKPaymentFailureReason_PaymentExpired != NULL);
1165         PaymentFailureReason_LDKPaymentFailureReason_RouteNotFound = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_RouteNotFound", "Lorg/ldk/enums/PaymentFailureReason;");
1166         CHECK(PaymentFailureReason_LDKPaymentFailureReason_RouteNotFound != NULL);
1167         PaymentFailureReason_LDKPaymentFailureReason_UnexpectedError = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_UnexpectedError", "Lorg/ldk/enums/PaymentFailureReason;");
1168         CHECK(PaymentFailureReason_LDKPaymentFailureReason_UnexpectedError != NULL);
1169 }
1170 static inline jclass LDKPaymentFailureReason_to_java(JNIEnv *env, LDKPaymentFailureReason val) {
1171         switch (val) {
1172                 case LDKPaymentFailureReason_RecipientRejected:
1173                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_RecipientRejected);
1174                 case LDKPaymentFailureReason_UserAbandoned:
1175                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_UserAbandoned);
1176                 case LDKPaymentFailureReason_RetriesExhausted:
1177                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_RetriesExhausted);
1178                 case LDKPaymentFailureReason_PaymentExpired:
1179                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_PaymentExpired);
1180                 case LDKPaymentFailureReason_RouteNotFound:
1181                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_RouteNotFound);
1182                 case LDKPaymentFailureReason_UnexpectedError:
1183                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_UnexpectedError);
1184                 default: abort();
1185         }
1186 }
1187
1188 static inline LDKRecipient LDKRecipient_from_java(JNIEnv *env, jclass clz) {
1189         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1190         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1191                 (*env)->ExceptionDescribe(env);
1192                 (*env)->FatalError(env, "A call to Recipient.ordinal() from rust threw an exception.");
1193         }
1194         switch (ord) {
1195                 case 0: return LDKRecipient_Node;
1196                 case 1: return LDKRecipient_PhantomNode;
1197         }
1198         (*env)->FatalError(env, "A call to Recipient.ordinal() from rust returned an invalid value.");
1199         abort(); // Unreachable, but will let the compiler know we don't return here
1200 }
1201 static jclass Recipient_class = NULL;
1202 static jfieldID Recipient_LDKRecipient_Node = NULL;
1203 static jfieldID Recipient_LDKRecipient_PhantomNode = NULL;
1204 JNIEXPORT void JNICALL Java_org_ldk_enums_Recipient_init (JNIEnv *env, jclass clz) {
1205         Recipient_class = (*env)->NewGlobalRef(env, clz);
1206         CHECK(Recipient_class != NULL);
1207         Recipient_LDKRecipient_Node = (*env)->GetStaticFieldID(env, Recipient_class, "LDKRecipient_Node", "Lorg/ldk/enums/Recipient;");
1208         CHECK(Recipient_LDKRecipient_Node != NULL);
1209         Recipient_LDKRecipient_PhantomNode = (*env)->GetStaticFieldID(env, Recipient_class, "LDKRecipient_PhantomNode", "Lorg/ldk/enums/Recipient;");
1210         CHECK(Recipient_LDKRecipient_PhantomNode != NULL);
1211 }
1212 static inline jclass LDKRecipient_to_java(JNIEnv *env, LDKRecipient val) {
1213         switch (val) {
1214                 case LDKRecipient_Node:
1215                         return (*env)->GetStaticObjectField(env, Recipient_class, Recipient_LDKRecipient_Node);
1216                 case LDKRecipient_PhantomNode:
1217                         return (*env)->GetStaticObjectField(env, Recipient_class, Recipient_LDKRecipient_PhantomNode);
1218                 default: abort();
1219         }
1220 }
1221
1222 static inline LDKRetryableSendFailure LDKRetryableSendFailure_from_java(JNIEnv *env, jclass clz) {
1223         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1224         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1225                 (*env)->ExceptionDescribe(env);
1226                 (*env)->FatalError(env, "A call to RetryableSendFailure.ordinal() from rust threw an exception.");
1227         }
1228         switch (ord) {
1229                 case 0: return LDKRetryableSendFailure_PaymentExpired;
1230                 case 1: return LDKRetryableSendFailure_RouteNotFound;
1231                 case 2: return LDKRetryableSendFailure_DuplicatePayment;
1232         }
1233         (*env)->FatalError(env, "A call to RetryableSendFailure.ordinal() from rust returned an invalid value.");
1234         abort(); // Unreachable, but will let the compiler know we don't return here
1235 }
1236 static jclass RetryableSendFailure_class = NULL;
1237 static jfieldID RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired = NULL;
1238 static jfieldID RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound = NULL;
1239 static jfieldID RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment = NULL;
1240 JNIEXPORT void JNICALL Java_org_ldk_enums_RetryableSendFailure_init (JNIEnv *env, jclass clz) {
1241         RetryableSendFailure_class = (*env)->NewGlobalRef(env, clz);
1242         CHECK(RetryableSendFailure_class != NULL);
1243         RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired = (*env)->GetStaticFieldID(env, RetryableSendFailure_class, "LDKRetryableSendFailure_PaymentExpired", "Lorg/ldk/enums/RetryableSendFailure;");
1244         CHECK(RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired != NULL);
1245         RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound = (*env)->GetStaticFieldID(env, RetryableSendFailure_class, "LDKRetryableSendFailure_RouteNotFound", "Lorg/ldk/enums/RetryableSendFailure;");
1246         CHECK(RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound != NULL);
1247         RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment = (*env)->GetStaticFieldID(env, RetryableSendFailure_class, "LDKRetryableSendFailure_DuplicatePayment", "Lorg/ldk/enums/RetryableSendFailure;");
1248         CHECK(RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment != NULL);
1249 }
1250 static inline jclass LDKRetryableSendFailure_to_java(JNIEnv *env, LDKRetryableSendFailure val) {
1251         switch (val) {
1252                 case LDKRetryableSendFailure_PaymentExpired:
1253                         return (*env)->GetStaticObjectField(env, RetryableSendFailure_class, RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired);
1254                 case LDKRetryableSendFailure_RouteNotFound:
1255                         return (*env)->GetStaticObjectField(env, RetryableSendFailure_class, RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound);
1256                 case LDKRetryableSendFailure_DuplicatePayment:
1257                         return (*env)->GetStaticObjectField(env, RetryableSendFailure_class, RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment);
1258                 default: abort();
1259         }
1260 }
1261
1262 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass clz) {
1263         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1264         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1265                 (*env)->ExceptionDescribe(env);
1266                 (*env)->FatalError(env, "A call to Secp256k1Error.ordinal() from rust threw an exception.");
1267         }
1268         switch (ord) {
1269                 case 0: return LDKSecp256k1Error_IncorrectSignature;
1270                 case 1: return LDKSecp256k1Error_InvalidMessage;
1271                 case 2: return LDKSecp256k1Error_InvalidPublicKey;
1272                 case 3: return LDKSecp256k1Error_InvalidSignature;
1273                 case 4: return LDKSecp256k1Error_InvalidSecretKey;
1274                 case 5: return LDKSecp256k1Error_InvalidSharedSecret;
1275                 case 6: return LDKSecp256k1Error_InvalidRecoveryId;
1276                 case 7: return LDKSecp256k1Error_InvalidTweak;
1277                 case 8: return LDKSecp256k1Error_NotEnoughMemory;
1278                 case 9: return LDKSecp256k1Error_InvalidPublicKeySum;
1279                 case 10: return LDKSecp256k1Error_InvalidParityValue;
1280         }
1281         (*env)->FatalError(env, "A call to Secp256k1Error.ordinal() from rust returned an invalid value.");
1282         abort(); // Unreachable, but will let the compiler know we don't return here
1283 }
1284 static jclass Secp256k1Error_class = NULL;
1285 static jfieldID Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
1286 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
1287 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
1288 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
1289 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
1290 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret = NULL;
1291 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
1292 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
1293 static jfieldID Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
1294 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum = NULL;
1295 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidParityValue = NULL;
1296 JNIEXPORT void JNICALL Java_org_ldk_enums_Secp256k1Error_init (JNIEnv *env, jclass clz) {
1297         Secp256k1Error_class = (*env)->NewGlobalRef(env, clz);
1298         CHECK(Secp256k1Error_class != NULL);
1299         Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/Secp256k1Error;");
1300         CHECK(Secp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
1301         Secp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/Secp256k1Error;");
1302         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
1303         Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/Secp256k1Error;");
1304         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
1305         Secp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/Secp256k1Error;");
1306         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
1307         Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/Secp256k1Error;");
1308         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
1309         Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSharedSecret", "Lorg/ldk/enums/Secp256k1Error;");
1310         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret != NULL);
1311         Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/Secp256k1Error;");
1312         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
1313         Secp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/Secp256k1Error;");
1314         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
1315         Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/Secp256k1Error;");
1316         CHECK(Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
1317         Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKeySum", "Lorg/ldk/enums/Secp256k1Error;");
1318         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum != NULL);
1319         Secp256k1Error_LDKSecp256k1Error_InvalidParityValue = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidParityValue", "Lorg/ldk/enums/Secp256k1Error;");
1320         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidParityValue != NULL);
1321 }
1322 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
1323         switch (val) {
1324                 case LDKSecp256k1Error_IncorrectSignature:
1325                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_IncorrectSignature);
1326                 case LDKSecp256k1Error_InvalidMessage:
1327                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidMessage);
1328                 case LDKSecp256k1Error_InvalidPublicKey:
1329                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
1330                 case LDKSecp256k1Error_InvalidSignature:
1331                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSignature);
1332                 case LDKSecp256k1Error_InvalidSecretKey:
1333                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
1334                 case LDKSecp256k1Error_InvalidSharedSecret:
1335                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret);
1336                 case LDKSecp256k1Error_InvalidRecoveryId:
1337                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
1338                 case LDKSecp256k1Error_InvalidTweak:
1339                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidTweak);
1340                 case LDKSecp256k1Error_NotEnoughMemory:
1341                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
1342                 case LDKSecp256k1Error_InvalidPublicKeySum:
1343                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum);
1344                 case LDKSecp256k1Error_InvalidParityValue:
1345                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidParityValue);
1346                 default: abort();
1347         }
1348 }
1349
1350 static inline LDKSiPrefix LDKSiPrefix_from_java(JNIEnv *env, jclass clz) {
1351         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1352         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1353                 (*env)->ExceptionDescribe(env);
1354                 (*env)->FatalError(env, "A call to SiPrefix.ordinal() from rust threw an exception.");
1355         }
1356         switch (ord) {
1357                 case 0: return LDKSiPrefix_Milli;
1358                 case 1: return LDKSiPrefix_Micro;
1359                 case 2: return LDKSiPrefix_Nano;
1360                 case 3: return LDKSiPrefix_Pico;
1361         }
1362         (*env)->FatalError(env, "A call to SiPrefix.ordinal() from rust returned an invalid value.");
1363         abort(); // Unreachable, but will let the compiler know we don't return here
1364 }
1365 static jclass SiPrefix_class = NULL;
1366 static jfieldID SiPrefix_LDKSiPrefix_Milli = NULL;
1367 static jfieldID SiPrefix_LDKSiPrefix_Micro = NULL;
1368 static jfieldID SiPrefix_LDKSiPrefix_Nano = NULL;
1369 static jfieldID SiPrefix_LDKSiPrefix_Pico = NULL;
1370 JNIEXPORT void JNICALL Java_org_ldk_enums_SiPrefix_init (JNIEnv *env, jclass clz) {
1371         SiPrefix_class = (*env)->NewGlobalRef(env, clz);
1372         CHECK(SiPrefix_class != NULL);
1373         SiPrefix_LDKSiPrefix_Milli = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Milli", "Lorg/ldk/enums/SiPrefix;");
1374         CHECK(SiPrefix_LDKSiPrefix_Milli != NULL);
1375         SiPrefix_LDKSiPrefix_Micro = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Micro", "Lorg/ldk/enums/SiPrefix;");
1376         CHECK(SiPrefix_LDKSiPrefix_Micro != NULL);
1377         SiPrefix_LDKSiPrefix_Nano = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Nano", "Lorg/ldk/enums/SiPrefix;");
1378         CHECK(SiPrefix_LDKSiPrefix_Nano != NULL);
1379         SiPrefix_LDKSiPrefix_Pico = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Pico", "Lorg/ldk/enums/SiPrefix;");
1380         CHECK(SiPrefix_LDKSiPrefix_Pico != NULL);
1381 }
1382 static inline jclass LDKSiPrefix_to_java(JNIEnv *env, LDKSiPrefix val) {
1383         switch (val) {
1384                 case LDKSiPrefix_Milli:
1385                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Milli);
1386                 case LDKSiPrefix_Micro:
1387                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Micro);
1388                 case LDKSiPrefix_Nano:
1389                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Nano);
1390                 case LDKSiPrefix_Pico:
1391                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Pico);
1392                 default: abort();
1393         }
1394 }
1395
1396 static inline LDKSocketAddressParseError LDKSocketAddressParseError_from_java(JNIEnv *env, jclass clz) {
1397         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1398         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1399                 (*env)->ExceptionDescribe(env);
1400                 (*env)->FatalError(env, "A call to SocketAddressParseError.ordinal() from rust threw an exception.");
1401         }
1402         switch (ord) {
1403                 case 0: return LDKSocketAddressParseError_SocketAddrParse;
1404                 case 1: return LDKSocketAddressParseError_InvalidInput;
1405                 case 2: return LDKSocketAddressParseError_InvalidPort;
1406                 case 3: return LDKSocketAddressParseError_InvalidOnionV3;
1407         }
1408         (*env)->FatalError(env, "A call to SocketAddressParseError.ordinal() from rust returned an invalid value.");
1409         abort(); // Unreachable, but will let the compiler know we don't return here
1410 }
1411 static jclass SocketAddressParseError_class = NULL;
1412 static jfieldID SocketAddressParseError_LDKSocketAddressParseError_SocketAddrParse = NULL;
1413 static jfieldID SocketAddressParseError_LDKSocketAddressParseError_InvalidInput = NULL;
1414 static jfieldID SocketAddressParseError_LDKSocketAddressParseError_InvalidPort = NULL;
1415 static jfieldID SocketAddressParseError_LDKSocketAddressParseError_InvalidOnionV3 = NULL;
1416 JNIEXPORT void JNICALL Java_org_ldk_enums_SocketAddressParseError_init (JNIEnv *env, jclass clz) {
1417         SocketAddressParseError_class = (*env)->NewGlobalRef(env, clz);
1418         CHECK(SocketAddressParseError_class != NULL);
1419         SocketAddressParseError_LDKSocketAddressParseError_SocketAddrParse = (*env)->GetStaticFieldID(env, SocketAddressParseError_class, "LDKSocketAddressParseError_SocketAddrParse", "Lorg/ldk/enums/SocketAddressParseError;");
1420         CHECK(SocketAddressParseError_LDKSocketAddressParseError_SocketAddrParse != NULL);
1421         SocketAddressParseError_LDKSocketAddressParseError_InvalidInput = (*env)->GetStaticFieldID(env, SocketAddressParseError_class, "LDKSocketAddressParseError_InvalidInput", "Lorg/ldk/enums/SocketAddressParseError;");
1422         CHECK(SocketAddressParseError_LDKSocketAddressParseError_InvalidInput != NULL);
1423         SocketAddressParseError_LDKSocketAddressParseError_InvalidPort = (*env)->GetStaticFieldID(env, SocketAddressParseError_class, "LDKSocketAddressParseError_InvalidPort", "Lorg/ldk/enums/SocketAddressParseError;");
1424         CHECK(SocketAddressParseError_LDKSocketAddressParseError_InvalidPort != NULL);
1425         SocketAddressParseError_LDKSocketAddressParseError_InvalidOnionV3 = (*env)->GetStaticFieldID(env, SocketAddressParseError_class, "LDKSocketAddressParseError_InvalidOnionV3", "Lorg/ldk/enums/SocketAddressParseError;");
1426         CHECK(SocketAddressParseError_LDKSocketAddressParseError_InvalidOnionV3 != NULL);
1427 }
1428 static inline jclass LDKSocketAddressParseError_to_java(JNIEnv *env, LDKSocketAddressParseError val) {
1429         switch (val) {
1430                 case LDKSocketAddressParseError_SocketAddrParse:
1431                         return (*env)->GetStaticObjectField(env, SocketAddressParseError_class, SocketAddressParseError_LDKSocketAddressParseError_SocketAddrParse);
1432                 case LDKSocketAddressParseError_InvalidInput:
1433                         return (*env)->GetStaticObjectField(env, SocketAddressParseError_class, SocketAddressParseError_LDKSocketAddressParseError_InvalidInput);
1434                 case LDKSocketAddressParseError_InvalidPort:
1435                         return (*env)->GetStaticObjectField(env, SocketAddressParseError_class, SocketAddressParseError_LDKSocketAddressParseError_InvalidPort);
1436                 case LDKSocketAddressParseError_InvalidOnionV3:
1437                         return (*env)->GetStaticObjectField(env, SocketAddressParseError_class, SocketAddressParseError_LDKSocketAddressParseError_InvalidOnionV3);
1438                 default: abort();
1439         }
1440 }
1441
1442 static inline LDKUtxoLookupError LDKUtxoLookupError_from_java(JNIEnv *env, jclass clz) {
1443         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1444         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1445                 (*env)->ExceptionDescribe(env);
1446                 (*env)->FatalError(env, "A call to UtxoLookupError.ordinal() from rust threw an exception.");
1447         }
1448         switch (ord) {
1449                 case 0: return LDKUtxoLookupError_UnknownChain;
1450                 case 1: return LDKUtxoLookupError_UnknownTx;
1451         }
1452         (*env)->FatalError(env, "A call to UtxoLookupError.ordinal() from rust returned an invalid value.");
1453         abort(); // Unreachable, but will let the compiler know we don't return here
1454 }
1455 static jclass UtxoLookupError_class = NULL;
1456 static jfieldID UtxoLookupError_LDKUtxoLookupError_UnknownChain = NULL;
1457 static jfieldID UtxoLookupError_LDKUtxoLookupError_UnknownTx = NULL;
1458 JNIEXPORT void JNICALL Java_org_ldk_enums_UtxoLookupError_init (JNIEnv *env, jclass clz) {
1459         UtxoLookupError_class = (*env)->NewGlobalRef(env, clz);
1460         CHECK(UtxoLookupError_class != NULL);
1461         UtxoLookupError_LDKUtxoLookupError_UnknownChain = (*env)->GetStaticFieldID(env, UtxoLookupError_class, "LDKUtxoLookupError_UnknownChain", "Lorg/ldk/enums/UtxoLookupError;");
1462         CHECK(UtxoLookupError_LDKUtxoLookupError_UnknownChain != NULL);
1463         UtxoLookupError_LDKUtxoLookupError_UnknownTx = (*env)->GetStaticFieldID(env, UtxoLookupError_class, "LDKUtxoLookupError_UnknownTx", "Lorg/ldk/enums/UtxoLookupError;");
1464         CHECK(UtxoLookupError_LDKUtxoLookupError_UnknownTx != NULL);
1465 }
1466 static inline jclass LDKUtxoLookupError_to_java(JNIEnv *env, LDKUtxoLookupError val) {
1467         switch (val) {
1468                 case LDKUtxoLookupError_UnknownChain:
1469                         return (*env)->GetStaticObjectField(env, UtxoLookupError_class, UtxoLookupError_LDKUtxoLookupError_UnknownChain);
1470                 case LDKUtxoLookupError_UnknownTx:
1471                         return (*env)->GetStaticObjectField(env, UtxoLookupError_class, UtxoLookupError_LDKUtxoLookupError_UnknownTx);
1472                 default: abort();
1473         }
1474 }
1475
1476 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
1477         LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
1478         memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
1479         return ret;
1480 }
1481 struct LDKThirtyTwoBytes BigEndianScalar_get_bytes (struct LDKBigEndianScalar* thing) {
1482         LDKThirtyTwoBytes ret = { .data = *thing->big_endian_bytes };
1483         return ret;
1484 }
1485 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1get_1bytes(JNIEnv *env, jclass clz, int64_t thing) {
1486         LDKBigEndianScalar* thing_conv = (LDKBigEndianScalar*)untag_ptr(thing);
1487         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
1488         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BigEndianScalar_get_bytes(thing_conv).data);
1489         return ret_arr;
1490 }
1491
1492 static void BigEndianScalar_free (struct LDKBigEndianScalar thing) {}
1493 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1free(JNIEnv *env, jclass clz, int64_t thing) {
1494         if (!ptr_is_owned(thing)) return;
1495         void* thing_ptr = untag_ptr(thing);
1496         CHECK_ACCESS(thing_ptr);
1497         LDKBigEndianScalar thing_conv = *(LDKBigEndianScalar*)(thing_ptr);
1498         FREE(untag_ptr(thing));
1499         BigEndianScalar_free(thing_conv);
1500 }
1501
1502 static jclass LDKBech32Error_MissingSeparator_class = NULL;
1503 static jmethodID LDKBech32Error_MissingSeparator_meth = NULL;
1504 static jclass LDKBech32Error_InvalidChecksum_class = NULL;
1505 static jmethodID LDKBech32Error_InvalidChecksum_meth = NULL;
1506 static jclass LDKBech32Error_InvalidLength_class = NULL;
1507 static jmethodID LDKBech32Error_InvalidLength_meth = NULL;
1508 static jclass LDKBech32Error_InvalidChar_class = NULL;
1509 static jmethodID LDKBech32Error_InvalidChar_meth = NULL;
1510 static jclass LDKBech32Error_InvalidData_class = NULL;
1511 static jmethodID LDKBech32Error_InvalidData_meth = NULL;
1512 static jclass LDKBech32Error_InvalidPadding_class = NULL;
1513 static jmethodID LDKBech32Error_InvalidPadding_meth = NULL;
1514 static jclass LDKBech32Error_MixedCase_class = NULL;
1515 static jmethodID LDKBech32Error_MixedCase_meth = NULL;
1516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBech32Error_init (JNIEnv *env, jclass clz) {
1517         LDKBech32Error_MissingSeparator_class =
1518                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$MissingSeparator"));
1519         CHECK(LDKBech32Error_MissingSeparator_class != NULL);
1520         LDKBech32Error_MissingSeparator_meth = (*env)->GetMethodID(env, LDKBech32Error_MissingSeparator_class, "<init>", "()V");
1521         CHECK(LDKBech32Error_MissingSeparator_meth != NULL);
1522         LDKBech32Error_InvalidChecksum_class =
1523                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidChecksum"));
1524         CHECK(LDKBech32Error_InvalidChecksum_class != NULL);
1525         LDKBech32Error_InvalidChecksum_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidChecksum_class, "<init>", "()V");
1526         CHECK(LDKBech32Error_InvalidChecksum_meth != NULL);
1527         LDKBech32Error_InvalidLength_class =
1528                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidLength"));
1529         CHECK(LDKBech32Error_InvalidLength_class != NULL);
1530         LDKBech32Error_InvalidLength_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidLength_class, "<init>", "()V");
1531         CHECK(LDKBech32Error_InvalidLength_meth != NULL);
1532         LDKBech32Error_InvalidChar_class =
1533                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidChar"));
1534         CHECK(LDKBech32Error_InvalidChar_class != NULL);
1535         LDKBech32Error_InvalidChar_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidChar_class, "<init>", "(I)V");
1536         CHECK(LDKBech32Error_InvalidChar_meth != NULL);
1537         LDKBech32Error_InvalidData_class =
1538                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidData"));
1539         CHECK(LDKBech32Error_InvalidData_class != NULL);
1540         LDKBech32Error_InvalidData_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidData_class, "<init>", "(B)V");
1541         CHECK(LDKBech32Error_InvalidData_meth != NULL);
1542         LDKBech32Error_InvalidPadding_class =
1543                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidPadding"));
1544         CHECK(LDKBech32Error_InvalidPadding_class != NULL);
1545         LDKBech32Error_InvalidPadding_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidPadding_class, "<init>", "()V");
1546         CHECK(LDKBech32Error_InvalidPadding_meth != NULL);
1547         LDKBech32Error_MixedCase_class =
1548                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$MixedCase"));
1549         CHECK(LDKBech32Error_MixedCase_class != NULL);
1550         LDKBech32Error_MixedCase_meth = (*env)->GetMethodID(env, LDKBech32Error_MixedCase_class, "<init>", "()V");
1551         CHECK(LDKBech32Error_MixedCase_meth != NULL);
1552 }
1553 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBech32Error_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1554         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
1555         switch(obj->tag) {
1556                 case LDKBech32Error_MissingSeparator: {
1557                         return (*env)->NewObject(env, LDKBech32Error_MissingSeparator_class, LDKBech32Error_MissingSeparator_meth);
1558                 }
1559                 case LDKBech32Error_InvalidChecksum: {
1560                         return (*env)->NewObject(env, LDKBech32Error_InvalidChecksum_class, LDKBech32Error_InvalidChecksum_meth);
1561                 }
1562                 case LDKBech32Error_InvalidLength: {
1563                         return (*env)->NewObject(env, LDKBech32Error_InvalidLength_class, LDKBech32Error_InvalidLength_meth);
1564                 }
1565                 case LDKBech32Error_InvalidChar: {
1566                         int32_t invalid_char_conv = obj->invalid_char;
1567                         return (*env)->NewObject(env, LDKBech32Error_InvalidChar_class, LDKBech32Error_InvalidChar_meth, invalid_char_conv);
1568                 }
1569                 case LDKBech32Error_InvalidData: {
1570                         int8_t invalid_data_conv = obj->invalid_data;
1571                         return (*env)->NewObject(env, LDKBech32Error_InvalidData_class, LDKBech32Error_InvalidData_meth, invalid_data_conv);
1572                 }
1573                 case LDKBech32Error_InvalidPadding: {
1574                         return (*env)->NewObject(env, LDKBech32Error_InvalidPadding_class, LDKBech32Error_InvalidPadding_meth);
1575                 }
1576                 case LDKBech32Error_MixedCase: {
1577                         return (*env)->NewObject(env, LDKBech32Error_MixedCase_class, LDKBech32Error_MixedCase_meth);
1578                 }
1579                 default: abort();
1580         }
1581 }
1582 static jclass LDKCOption_u64Z_Some_class = NULL;
1583 static jmethodID LDKCOption_u64Z_Some_meth = NULL;
1584 static jclass LDKCOption_u64Z_None_class = NULL;
1585 static jmethodID LDKCOption_u64Z_None_meth = NULL;
1586 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u64Z_init (JNIEnv *env, jclass clz) {
1587         LDKCOption_u64Z_Some_class =
1588                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$Some"));
1589         CHECK(LDKCOption_u64Z_Some_class != NULL);
1590         LDKCOption_u64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_Some_class, "<init>", "(J)V");
1591         CHECK(LDKCOption_u64Z_Some_meth != NULL);
1592         LDKCOption_u64Z_None_class =
1593                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$None"));
1594         CHECK(LDKCOption_u64Z_None_class != NULL);
1595         LDKCOption_u64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_None_class, "<init>", "()V");
1596         CHECK(LDKCOption_u64Z_None_meth != NULL);
1597 }
1598 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1599         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
1600         switch(obj->tag) {
1601                 case LDKCOption_u64Z_Some: {
1602                         int64_t some_conv = obj->some;
1603                         return (*env)->NewObject(env, LDKCOption_u64Z_Some_class, LDKCOption_u64Z_Some_meth, some_conv);
1604                 }
1605                 case LDKCOption_u64Z_None: {
1606                         return (*env)->NewObject(env, LDKCOption_u64Z_None_class, LDKCOption_u64Z_None_meth);
1607                 }
1608                 default: abort();
1609         }
1610 }
1611 static inline LDKCVec_BlindedPathZ CVec_BlindedPathZ_clone(const LDKCVec_BlindedPathZ *orig) {
1612         LDKCVec_BlindedPathZ ret = { .data = MALLOC(sizeof(LDKBlindedPath) * orig->datalen, "LDKCVec_BlindedPathZ clone bytes"), .datalen = orig->datalen };
1613         for (size_t i = 0; i < ret.datalen; i++) {
1614                 ret.data[i] = BlindedPath_clone(&orig->data[i]);
1615         }
1616         return ret;
1617 }
1618 static inline struct LDKRefund CResult_RefundBolt12ParseErrorZ_get_ok(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
1619         LDKRefund ret = *owner->contents.result;
1620         ret.is_owned = false;
1621         return ret;
1622 }
1623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1624         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
1625         LDKRefund ret_var = CResult_RefundBolt12ParseErrorZ_get_ok(owner_conv);
1626         int64_t ret_ref = 0;
1627         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1628         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1629         return ret_ref;
1630 }
1631
1632 static inline struct LDKBolt12ParseError CResult_RefundBolt12ParseErrorZ_get_err(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
1633         LDKBolt12ParseError ret = *owner->contents.err;
1634         ret.is_owned = false;
1635         return ret;
1636 }
1637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1638         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
1639         LDKBolt12ParseError ret_var = CResult_RefundBolt12ParseErrorZ_get_err(owner_conv);
1640         int64_t ret_ref = 0;
1641         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1642         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1643         return ret_ref;
1644 }
1645
1646 static jclass LDKRetry_Attempts_class = NULL;
1647 static jmethodID LDKRetry_Attempts_meth = NULL;
1648 static jclass LDKRetry_Timeout_class = NULL;
1649 static jmethodID LDKRetry_Timeout_meth = NULL;
1650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKRetry_init (JNIEnv *env, jclass clz) {
1651         LDKRetry_Attempts_class =
1652                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRetry$Attempts"));
1653         CHECK(LDKRetry_Attempts_class != NULL);
1654         LDKRetry_Attempts_meth = (*env)->GetMethodID(env, LDKRetry_Attempts_class, "<init>", "(I)V");
1655         CHECK(LDKRetry_Attempts_meth != NULL);
1656         LDKRetry_Timeout_class =
1657                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRetry$Timeout"));
1658         CHECK(LDKRetry_Timeout_class != NULL);
1659         LDKRetry_Timeout_meth = (*env)->GetMethodID(env, LDKRetry_Timeout_class, "<init>", "(J)V");
1660         CHECK(LDKRetry_Timeout_meth != NULL);
1661 }
1662 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRetry_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1663         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
1664         switch(obj->tag) {
1665                 case LDKRetry_Attempts: {
1666                         int32_t attempts_conv = obj->attempts;
1667                         return (*env)->NewObject(env, LDKRetry_Attempts_class, LDKRetry_Attempts_meth, attempts_conv);
1668                 }
1669                 case LDKRetry_Timeout: {
1670                         int64_t timeout_conv = obj->timeout;
1671                         return (*env)->NewObject(env, LDKRetry_Timeout_class, LDKRetry_Timeout_meth, timeout_conv);
1672                 }
1673                 default: abort();
1674         }
1675 }
1676 static jclass LDKDecodeError_UnknownVersion_class = NULL;
1677 static jmethodID LDKDecodeError_UnknownVersion_meth = NULL;
1678 static jclass LDKDecodeError_UnknownRequiredFeature_class = NULL;
1679 static jmethodID LDKDecodeError_UnknownRequiredFeature_meth = NULL;
1680 static jclass LDKDecodeError_InvalidValue_class = NULL;
1681 static jmethodID LDKDecodeError_InvalidValue_meth = NULL;
1682 static jclass LDKDecodeError_ShortRead_class = NULL;
1683 static jmethodID LDKDecodeError_ShortRead_meth = NULL;
1684 static jclass LDKDecodeError_BadLengthDescriptor_class = NULL;
1685 static jmethodID LDKDecodeError_BadLengthDescriptor_meth = NULL;
1686 static jclass LDKDecodeError_Io_class = NULL;
1687 static jmethodID LDKDecodeError_Io_meth = NULL;
1688 static jclass LDKDecodeError_UnsupportedCompression_class = NULL;
1689 static jmethodID LDKDecodeError_UnsupportedCompression_meth = NULL;
1690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKDecodeError_init (JNIEnv *env, jclass clz) {
1691         LDKDecodeError_UnknownVersion_class =
1692                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$UnknownVersion"));
1693         CHECK(LDKDecodeError_UnknownVersion_class != NULL);
1694         LDKDecodeError_UnknownVersion_meth = (*env)->GetMethodID(env, LDKDecodeError_UnknownVersion_class, "<init>", "()V");
1695         CHECK(LDKDecodeError_UnknownVersion_meth != NULL);
1696         LDKDecodeError_UnknownRequiredFeature_class =
1697                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$UnknownRequiredFeature"));
1698         CHECK(LDKDecodeError_UnknownRequiredFeature_class != NULL);
1699         LDKDecodeError_UnknownRequiredFeature_meth = (*env)->GetMethodID(env, LDKDecodeError_UnknownRequiredFeature_class, "<init>", "()V");
1700         CHECK(LDKDecodeError_UnknownRequiredFeature_meth != NULL);
1701         LDKDecodeError_InvalidValue_class =
1702                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$InvalidValue"));
1703         CHECK(LDKDecodeError_InvalidValue_class != NULL);
1704         LDKDecodeError_InvalidValue_meth = (*env)->GetMethodID(env, LDKDecodeError_InvalidValue_class, "<init>", "()V");
1705         CHECK(LDKDecodeError_InvalidValue_meth != NULL);
1706         LDKDecodeError_ShortRead_class =
1707                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$ShortRead"));
1708         CHECK(LDKDecodeError_ShortRead_class != NULL);
1709         LDKDecodeError_ShortRead_meth = (*env)->GetMethodID(env, LDKDecodeError_ShortRead_class, "<init>", "()V");
1710         CHECK(LDKDecodeError_ShortRead_meth != NULL);
1711         LDKDecodeError_BadLengthDescriptor_class =
1712                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$BadLengthDescriptor"));
1713         CHECK(LDKDecodeError_BadLengthDescriptor_class != NULL);
1714         LDKDecodeError_BadLengthDescriptor_meth = (*env)->GetMethodID(env, LDKDecodeError_BadLengthDescriptor_class, "<init>", "()V");
1715         CHECK(LDKDecodeError_BadLengthDescriptor_meth != NULL);
1716         LDKDecodeError_Io_class =
1717                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$Io"));
1718         CHECK(LDKDecodeError_Io_class != NULL);
1719         LDKDecodeError_Io_meth = (*env)->GetMethodID(env, LDKDecodeError_Io_class, "<init>", "(Lorg/ldk/enums/IOError;)V");
1720         CHECK(LDKDecodeError_Io_meth != NULL);
1721         LDKDecodeError_UnsupportedCompression_class =
1722                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$UnsupportedCompression"));
1723         CHECK(LDKDecodeError_UnsupportedCompression_class != NULL);
1724         LDKDecodeError_UnsupportedCompression_meth = (*env)->GetMethodID(env, LDKDecodeError_UnsupportedCompression_class, "<init>", "()V");
1725         CHECK(LDKDecodeError_UnsupportedCompression_meth != NULL);
1726 }
1727 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKDecodeError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1728         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
1729         switch(obj->tag) {
1730                 case LDKDecodeError_UnknownVersion: {
1731                         return (*env)->NewObject(env, LDKDecodeError_UnknownVersion_class, LDKDecodeError_UnknownVersion_meth);
1732                 }
1733                 case LDKDecodeError_UnknownRequiredFeature: {
1734                         return (*env)->NewObject(env, LDKDecodeError_UnknownRequiredFeature_class, LDKDecodeError_UnknownRequiredFeature_meth);
1735                 }
1736                 case LDKDecodeError_InvalidValue: {
1737                         return (*env)->NewObject(env, LDKDecodeError_InvalidValue_class, LDKDecodeError_InvalidValue_meth);
1738                 }
1739                 case LDKDecodeError_ShortRead: {
1740                         return (*env)->NewObject(env, LDKDecodeError_ShortRead_class, LDKDecodeError_ShortRead_meth);
1741                 }
1742                 case LDKDecodeError_BadLengthDescriptor: {
1743                         return (*env)->NewObject(env, LDKDecodeError_BadLengthDescriptor_class, LDKDecodeError_BadLengthDescriptor_meth);
1744                 }
1745                 case LDKDecodeError_Io: {
1746                         jclass io_conv = LDKIOError_to_java(env, obj->io);
1747                         return (*env)->NewObject(env, LDKDecodeError_Io_class, LDKDecodeError_Io_meth, io_conv);
1748                 }
1749                 case LDKDecodeError_UnsupportedCompression: {
1750                         return (*env)->NewObject(env, LDKDecodeError_UnsupportedCompression_class, LDKDecodeError_UnsupportedCompression_meth);
1751                 }
1752                 default: abort();
1753         }
1754 }
1755 static inline struct LDKRetry CResult_RetryDecodeErrorZ_get_ok(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR owner){
1756 CHECK(owner->result_ok);
1757         return Retry_clone(&*owner->contents.result);
1758 }
1759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1760         LDKCResult_RetryDecodeErrorZ* owner_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(owner);
1761         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
1762         *ret_copy = CResult_RetryDecodeErrorZ_get_ok(owner_conv);
1763         int64_t ret_ref = tag_ptr(ret_copy, true);
1764         return ret_ref;
1765 }
1766
1767 static inline struct LDKDecodeError CResult_RetryDecodeErrorZ_get_err(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR owner){
1768 CHECK(!owner->result_ok);
1769         return DecodeError_clone(&*owner->contents.err);
1770 }
1771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1772         LDKCResult_RetryDecodeErrorZ* owner_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(owner);
1773         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1774         *ret_copy = CResult_RetryDecodeErrorZ_get_err(owner_conv);
1775         int64_t ret_ref = tag_ptr(ret_copy, true);
1776         return ret_ref;
1777 }
1778
1779 static jclass LDKAPIError_APIMisuseError_class = NULL;
1780 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
1781 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
1782 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
1783 static jclass LDKAPIError_InvalidRoute_class = NULL;
1784 static jmethodID LDKAPIError_InvalidRoute_meth = NULL;
1785 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
1786 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
1787 static jclass LDKAPIError_MonitorUpdateInProgress_class = NULL;
1788 static jmethodID LDKAPIError_MonitorUpdateInProgress_meth = NULL;
1789 static jclass LDKAPIError_IncompatibleShutdownScript_class = NULL;
1790 static jmethodID LDKAPIError_IncompatibleShutdownScript_meth = NULL;
1791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
1792         LDKAPIError_APIMisuseError_class =
1793                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$APIMisuseError"));
1794         CHECK(LDKAPIError_APIMisuseError_class != NULL);
1795         LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(Ljava/lang/String;)V");
1796         CHECK(LDKAPIError_APIMisuseError_meth != NULL);
1797         LDKAPIError_FeeRateTooHigh_class =
1798                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh"));
1799         CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
1800         LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(Ljava/lang/String;I)V");
1801         CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
1802         LDKAPIError_InvalidRoute_class =
1803                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$InvalidRoute"));
1804         CHECK(LDKAPIError_InvalidRoute_class != NULL);
1805         LDKAPIError_InvalidRoute_meth = (*env)->GetMethodID(env, LDKAPIError_InvalidRoute_class, "<init>", "(Ljava/lang/String;)V");
1806         CHECK(LDKAPIError_InvalidRoute_meth != NULL);
1807         LDKAPIError_ChannelUnavailable_class =
1808                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$ChannelUnavailable"));
1809         CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
1810         LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(Ljava/lang/String;)V");
1811         CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
1812         LDKAPIError_MonitorUpdateInProgress_class =
1813                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$MonitorUpdateInProgress"));
1814         CHECK(LDKAPIError_MonitorUpdateInProgress_class != NULL);
1815         LDKAPIError_MonitorUpdateInProgress_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateInProgress_class, "<init>", "()V");
1816         CHECK(LDKAPIError_MonitorUpdateInProgress_meth != NULL);
1817         LDKAPIError_IncompatibleShutdownScript_class =
1818                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$IncompatibleShutdownScript"));
1819         CHECK(LDKAPIError_IncompatibleShutdownScript_class != NULL);
1820         LDKAPIError_IncompatibleShutdownScript_meth = (*env)->GetMethodID(env, LDKAPIError_IncompatibleShutdownScript_class, "<init>", "(J)V");
1821         CHECK(LDKAPIError_IncompatibleShutdownScript_meth != NULL);
1822 }
1823 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1824         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
1825         switch(obj->tag) {
1826                 case LDKAPIError_APIMisuseError: {
1827                         LDKStr err_str = obj->api_misuse_error.err;
1828                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
1829                         return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_conv);
1830                 }
1831                 case LDKAPIError_FeeRateTooHigh: {
1832                         LDKStr err_str = obj->fee_rate_too_high.err;
1833                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
1834                         int32_t feerate_conv = obj->fee_rate_too_high.feerate;
1835                         return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_conv, feerate_conv);
1836                 }
1837                 case LDKAPIError_InvalidRoute: {
1838                         LDKStr err_str = obj->invalid_route.err;
1839                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
1840                         return (*env)->NewObject(env, LDKAPIError_InvalidRoute_class, LDKAPIError_InvalidRoute_meth, err_conv);
1841                 }
1842                 case LDKAPIError_ChannelUnavailable: {
1843                         LDKStr err_str = obj->channel_unavailable.err;
1844                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
1845                         return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_conv);
1846                 }
1847                 case LDKAPIError_MonitorUpdateInProgress: {
1848                         return (*env)->NewObject(env, LDKAPIError_MonitorUpdateInProgress_class, LDKAPIError_MonitorUpdateInProgress_meth);
1849                 }
1850                 case LDKAPIError_IncompatibleShutdownScript: {
1851                         LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
1852                         int64_t script_ref = 0;
1853                         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
1854                         script_ref = tag_ptr(script_var.inner, false);
1855                         return (*env)->NewObject(env, LDKAPIError_IncompatibleShutdownScript_class, LDKAPIError_IncompatibleShutdownScript_meth, script_ref);
1856                 }
1857                 default: abort();
1858         }
1859 }
1860 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
1861 CHECK(owner->result_ok);
1862         return *owner->contents.result;
1863 }
1864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1865         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
1866         CResult_NoneAPIErrorZ_get_ok(owner_conv);
1867 }
1868
1869 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
1870 CHECK(!owner->result_ok);
1871         return APIError_clone(&*owner->contents.err);
1872 }
1873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1874         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
1875         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
1876         *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
1877         int64_t ret_ref = tag_ptr(ret_copy, true);
1878         return ret_ref;
1879 }
1880
1881 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
1882         LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
1883         for (size_t i = 0; i < ret.datalen; i++) {
1884                 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
1885         }
1886         return ret;
1887 }
1888 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
1889         LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
1890         for (size_t i = 0; i < ret.datalen; i++) {
1891                 ret.data[i] = APIError_clone(&orig->data[i]);
1892         }
1893         return ret;
1894 }
1895 static jclass LDKCOption_ThirtyTwoBytesZ_Some_class = NULL;
1896 static jmethodID LDKCOption_ThirtyTwoBytesZ_Some_meth = NULL;
1897 static jclass LDKCOption_ThirtyTwoBytesZ_None_class = NULL;
1898 static jmethodID LDKCOption_ThirtyTwoBytesZ_None_meth = NULL;
1899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ThirtyTwoBytesZ_init (JNIEnv *env, jclass clz) {
1900         LDKCOption_ThirtyTwoBytesZ_Some_class =
1901                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ThirtyTwoBytesZ$Some"));
1902         CHECK(LDKCOption_ThirtyTwoBytesZ_Some_class != NULL);
1903         LDKCOption_ThirtyTwoBytesZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ThirtyTwoBytesZ_Some_class, "<init>", "([B)V");
1904         CHECK(LDKCOption_ThirtyTwoBytesZ_Some_meth != NULL);
1905         LDKCOption_ThirtyTwoBytesZ_None_class =
1906                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ThirtyTwoBytesZ$None"));
1907         CHECK(LDKCOption_ThirtyTwoBytesZ_None_class != NULL);
1908         LDKCOption_ThirtyTwoBytesZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ThirtyTwoBytesZ_None_class, "<init>", "()V");
1909         CHECK(LDKCOption_ThirtyTwoBytesZ_None_meth != NULL);
1910 }
1911 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ThirtyTwoBytesZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1912         LDKCOption_ThirtyTwoBytesZ *obj = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(ptr);
1913         switch(obj->tag) {
1914                 case LDKCOption_ThirtyTwoBytesZ_Some: {
1915                         int8_tArray some_arr = (*env)->NewByteArray(env, 32);
1916                         (*env)->SetByteArrayRegion(env, some_arr, 0, 32, obj->some.data);
1917                         return (*env)->NewObject(env, LDKCOption_ThirtyTwoBytesZ_Some_class, LDKCOption_ThirtyTwoBytesZ_Some_meth, some_arr);
1918                 }
1919                 case LDKCOption_ThirtyTwoBytesZ_None: {
1920                         return (*env)->NewObject(env, LDKCOption_ThirtyTwoBytesZ_None_class, LDKCOption_ThirtyTwoBytesZ_None_meth);
1921                 }
1922                 default: abort();
1923         }
1924 }
1925 static jclass LDKCOption_CVec_u8ZZ_Some_class = NULL;
1926 static jmethodID LDKCOption_CVec_u8ZZ_Some_meth = NULL;
1927 static jclass LDKCOption_CVec_u8ZZ_None_class = NULL;
1928 static jmethodID LDKCOption_CVec_u8ZZ_None_meth = NULL;
1929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1u8ZZ_init (JNIEnv *env, jclass clz) {
1930         LDKCOption_CVec_u8ZZ_Some_class =
1931                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_u8ZZ$Some"));
1932         CHECK(LDKCOption_CVec_u8ZZ_Some_class != NULL);
1933         LDKCOption_CVec_u8ZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_u8ZZ_Some_class, "<init>", "([B)V");
1934         CHECK(LDKCOption_CVec_u8ZZ_Some_meth != NULL);
1935         LDKCOption_CVec_u8ZZ_None_class =
1936                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_u8ZZ$None"));
1937         CHECK(LDKCOption_CVec_u8ZZ_None_class != NULL);
1938         LDKCOption_CVec_u8ZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_u8ZZ_None_class, "<init>", "()V");
1939         CHECK(LDKCOption_CVec_u8ZZ_None_meth != NULL);
1940 }
1941 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1u8ZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1942         LDKCOption_CVec_u8ZZ *obj = (LDKCOption_CVec_u8ZZ*)untag_ptr(ptr);
1943         switch(obj->tag) {
1944                 case LDKCOption_CVec_u8ZZ_Some: {
1945                         LDKCVec_u8Z some_var = obj->some;
1946                         int8_tArray some_arr = (*env)->NewByteArray(env, some_var.datalen);
1947                         (*env)->SetByteArrayRegion(env, some_arr, 0, some_var.datalen, some_var.data);
1948                         return (*env)->NewObject(env, LDKCOption_CVec_u8ZZ_Some_class, LDKCOption_CVec_u8ZZ_Some_meth, some_arr);
1949                 }
1950                 case LDKCOption_CVec_u8ZZ_None: {
1951                         return (*env)->NewObject(env, LDKCOption_CVec_u8ZZ_None_class, LDKCOption_CVec_u8ZZ_None_meth);
1952                 }
1953                 default: abort();
1954         }
1955 }
1956 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
1957         LDKRecipientOnionFields ret = *owner->contents.result;
1958         ret.is_owned = false;
1959         return ret;
1960 }
1961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1962         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
1963         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(owner_conv);
1964         int64_t ret_ref = 0;
1965         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1966         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1967         return ret_ref;
1968 }
1969
1970 static inline struct LDKDecodeError CResult_RecipientOnionFieldsDecodeErrorZ_get_err(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
1971 CHECK(!owner->result_ok);
1972         return DecodeError_clone(&*owner->contents.err);
1973 }
1974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1975         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
1976         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1977         *ret_copy = CResult_RecipientOnionFieldsDecodeErrorZ_get_err(owner_conv);
1978         int64_t ret_ref = tag_ptr(ret_copy, true);
1979         return ret_ref;
1980 }
1981
1982 static inline uint64_t C2Tuple_u64CVec_u8ZZ_get_a(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR owner){
1983         return owner->a;
1984 }
1985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
1986         LDKC2Tuple_u64CVec_u8ZZ* owner_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(owner);
1987         int64_t ret_conv = C2Tuple_u64CVec_u8ZZ_get_a(owner_conv);
1988         return ret_conv;
1989 }
1990
1991 static inline struct LDKCVec_u8Z C2Tuple_u64CVec_u8ZZ_get_b(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR owner){
1992         return CVec_u8Z_clone(&owner->b);
1993 }
1994 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
1995         LDKC2Tuple_u64CVec_u8ZZ* owner_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(owner);
1996         LDKCVec_u8Z ret_var = C2Tuple_u64CVec_u8ZZ_get_b(owner_conv);
1997         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
1998         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
1999         CVec_u8Z_free(ret_var);
2000         return ret_arr;
2001 }
2002
2003 static inline LDKCVec_C2Tuple_u64CVec_u8ZZZ CVec_C2Tuple_u64CVec_u8ZZZ_clone(const LDKCVec_C2Tuple_u64CVec_u8ZZZ *orig) {
2004         LDKCVec_C2Tuple_u64CVec_u8ZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ) * orig->datalen, "LDKCVec_C2Tuple_u64CVec_u8ZZZ clone bytes"), .datalen = orig->datalen };
2005         for (size_t i = 0; i < ret.datalen; i++) {
2006                 ret.data[i] = C2Tuple_u64CVec_u8ZZ_clone(&orig->data[i]);
2007         }
2008         return ret;
2009 }
2010 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsNoneZ_get_ok(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR owner){
2011         LDKRecipientOnionFields ret = *owner->contents.result;
2012         ret.is_owned = false;
2013         return ret;
2014 }
2015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2016         LDKCResult_RecipientOnionFieldsNoneZ* owner_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(owner);
2017         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsNoneZ_get_ok(owner_conv);
2018         int64_t ret_ref = 0;
2019         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2020         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2021         return ret_ref;
2022 }
2023
2024 static inline void CResult_RecipientOnionFieldsNoneZ_get_err(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR owner){
2025 CHECK(!owner->result_ok);
2026         return *owner->contents.err;
2027 }
2028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2029         LDKCResult_RecipientOnionFieldsNoneZ* owner_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(owner);
2030         CResult_RecipientOnionFieldsNoneZ_get_err(owner_conv);
2031 }
2032
2033 static inline LDKCVec_ThirtyTwoBytesZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_ThirtyTwoBytesZ *orig) {
2034         LDKCVec_ThirtyTwoBytesZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ThirtyTwoBytesZ clone bytes"), .datalen = orig->datalen };
2035         for (size_t i = 0; i < ret.datalen; i++) {
2036                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
2037         }
2038         return ret;
2039 }
2040 static jclass LDKCOption_CVec_ThirtyTwoBytesZZ_Some_class = NULL;
2041 static jmethodID LDKCOption_CVec_ThirtyTwoBytesZZ_Some_meth = NULL;
2042 static jclass LDKCOption_CVec_ThirtyTwoBytesZZ_None_class = NULL;
2043 static jmethodID LDKCOption_CVec_ThirtyTwoBytesZZ_None_meth = NULL;
2044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1ThirtyTwoBytesZZ_init (JNIEnv *env, jclass clz) {
2045         LDKCOption_CVec_ThirtyTwoBytesZZ_Some_class =
2046                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_ThirtyTwoBytesZZ$Some"));
2047         CHECK(LDKCOption_CVec_ThirtyTwoBytesZZ_Some_class != NULL);
2048         LDKCOption_CVec_ThirtyTwoBytesZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_ThirtyTwoBytesZZ_Some_class, "<init>", "([[B)V");
2049         CHECK(LDKCOption_CVec_ThirtyTwoBytesZZ_Some_meth != NULL);
2050         LDKCOption_CVec_ThirtyTwoBytesZZ_None_class =
2051                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_ThirtyTwoBytesZZ$None"));
2052         CHECK(LDKCOption_CVec_ThirtyTwoBytesZZ_None_class != NULL);
2053         LDKCOption_CVec_ThirtyTwoBytesZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_ThirtyTwoBytesZZ_None_class, "<init>", "()V");
2054         CHECK(LDKCOption_CVec_ThirtyTwoBytesZZ_None_meth != NULL);
2055 }
2056 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1ThirtyTwoBytesZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2057         LDKCOption_CVec_ThirtyTwoBytesZZ *obj = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(ptr);
2058         switch(obj->tag) {
2059                 case LDKCOption_CVec_ThirtyTwoBytesZZ_Some: {
2060                         LDKCVec_ThirtyTwoBytesZ some_var = obj->some;
2061                         jobjectArray some_arr = NULL;
2062                         some_arr = (*env)->NewObjectArray(env, some_var.datalen, arr_of_B_clz, NULL);
2063                         ;
2064                         for (size_t i = 0; i < some_var.datalen; i++) {
2065                                 int8_tArray some_conv_8_arr = (*env)->NewByteArray(env, 32);
2066                                 (*env)->SetByteArrayRegion(env, some_conv_8_arr, 0, 32, some_var.data[i].data);
2067                                 (*env)->SetObjectArrayElement(env, some_arr, i, some_conv_8_arr);
2068                         }
2069                         
2070                         return (*env)->NewObject(env, LDKCOption_CVec_ThirtyTwoBytesZZ_Some_class, LDKCOption_CVec_ThirtyTwoBytesZZ_Some_meth, some_arr);
2071                 }
2072                 case LDKCOption_CVec_ThirtyTwoBytesZZ_None: {
2073                         return (*env)->NewObject(env, LDKCOption_CVec_ThirtyTwoBytesZZ_None_class, LDKCOption_CVec_ThirtyTwoBytesZZ_None_meth);
2074                 }
2075                 default: abort();
2076         }
2077 }
2078 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesNoneZ_get_ok(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR owner){
2079 CHECK(owner->result_ok);
2080         return ThirtyTwoBytes_clone(&*owner->contents.result);
2081 }
2082 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2083         LDKCResult_ThirtyTwoBytesNoneZ* owner_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(owner);
2084         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2085         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_ThirtyTwoBytesNoneZ_get_ok(owner_conv).data);
2086         return ret_arr;
2087 }
2088
2089 static inline void CResult_ThirtyTwoBytesNoneZ_get_err(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR owner){
2090 CHECK(!owner->result_ok);
2091         return *owner->contents.err;
2092 }
2093 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2094         LDKCResult_ThirtyTwoBytesNoneZ* owner_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(owner);
2095         CResult_ThirtyTwoBytesNoneZ_get_err(owner_conv);
2096 }
2097
2098 static inline struct LDKBlindedPayInfo CResult_BlindedPayInfoDecodeErrorZ_get_ok(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
2099         LDKBlindedPayInfo ret = *owner->contents.result;
2100         ret.is_owned = false;
2101         return ret;
2102 }
2103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2104         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
2105         LDKBlindedPayInfo ret_var = CResult_BlindedPayInfoDecodeErrorZ_get_ok(owner_conv);
2106         int64_t ret_ref = 0;
2107         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2108         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2109         return ret_ref;
2110 }
2111
2112 static inline struct LDKDecodeError CResult_BlindedPayInfoDecodeErrorZ_get_err(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
2113 CHECK(!owner->result_ok);
2114         return DecodeError_clone(&*owner->contents.err);
2115 }
2116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2117         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
2118         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2119         *ret_copy = CResult_BlindedPayInfoDecodeErrorZ_get_err(owner_conv);
2120         int64_t ret_ref = tag_ptr(ret_copy, true);
2121         return ret_ref;
2122 }
2123
2124 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2125         LDKDelayedPaymentOutputDescriptor ret = *owner->contents.result;
2126         ret.is_owned = false;
2127         return ret;
2128 }
2129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2130         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2131         LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
2132         int64_t ret_ref = 0;
2133         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2134         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2135         return ret_ref;
2136 }
2137
2138 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2139 CHECK(!owner->result_ok);
2140         return DecodeError_clone(&*owner->contents.err);
2141 }
2142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2143         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2144         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2145         *ret_copy = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
2146         int64_t ret_ref = tag_ptr(ret_copy, true);
2147         return ret_ref;
2148 }
2149
2150 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2151         LDKStaticPaymentOutputDescriptor ret = *owner->contents.result;
2152         ret.is_owned = false;
2153         return ret;
2154 }
2155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2156         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2157         LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_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 struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2165 CHECK(!owner->result_ok);
2166         return DecodeError_clone(&*owner->contents.err);
2167 }
2168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2169         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2170         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2171         *ret_copy = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
2172         int64_t ret_ref = tag_ptr(ret_copy, true);
2173         return ret_ref;
2174 }
2175
2176 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
2177 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
2178 static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL;
2179 static jmethodID LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = NULL;
2180 static jclass LDKSpendableOutputDescriptor_StaticPaymentOutput_class = NULL;
2181 static jmethodID LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = NULL;
2182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
2183         LDKSpendableOutputDescriptor_StaticOutput_class =
2184                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput"));
2185         CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
2186         LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ[B)V");
2187         CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
2188         LDKSpendableOutputDescriptor_DelayedPaymentOutput_class =
2189                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput"));
2190         CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_class != NULL);
2191         LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, "<init>", "(J)V");
2192         CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth != NULL);
2193         LDKSpendableOutputDescriptor_StaticPaymentOutput_class =
2194                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput"));
2195         CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_class != NULL);
2196         LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, "<init>", "(J)V");
2197         CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_meth != NULL);
2198 }
2199 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2200         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
2201         switch(obj->tag) {
2202                 case LDKSpendableOutputDescriptor_StaticOutput: {
2203                         LDKOutPoint outpoint_var = obj->static_output.outpoint;
2204                         int64_t outpoint_ref = 0;
2205                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
2206                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
2207                         LDKTxOut* output_ref = &obj->static_output.output;
2208                         int8_tArray channel_keys_id_arr = (*env)->NewByteArray(env, 32);
2209                         (*env)->SetByteArrayRegion(env, channel_keys_id_arr, 0, 32, obj->static_output.channel_keys_id.data);
2210                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, tag_ptr(output_ref, false), channel_keys_id_arr);
2211                 }
2212                 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
2213                         LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
2214                         int64_t delayed_payment_output_ref = 0;
2215                         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
2216                         delayed_payment_output_ref = tag_ptr(delayed_payment_output_var.inner, false);
2217                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth, delayed_payment_output_ref);
2218                 }
2219                 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
2220                         LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
2221                         int64_t static_payment_output_ref = 0;
2222                         CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
2223                         static_payment_output_ref = tag_ptr(static_payment_output_var.inner, false);
2224                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, LDKSpendableOutputDescriptor_StaticPaymentOutput_meth, static_payment_output_ref);
2225                 }
2226                 default: abort();
2227         }
2228 }
2229 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2230 CHECK(owner->result_ok);
2231         return SpendableOutputDescriptor_clone(&*owner->contents.result);
2232 }
2233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2234         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2235         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
2236         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
2237         int64_t ret_ref = tag_ptr(ret_copy, true);
2238         return ret_ref;
2239 }
2240
2241 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2242 CHECK(!owner->result_ok);
2243         return DecodeError_clone(&*owner->contents.err);
2244 }
2245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2246         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2247         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2248         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
2249         int64_t ret_ref = tag_ptr(ret_copy, true);
2250         return ret_ref;
2251 }
2252
2253 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
2254         LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
2255         for (size_t i = 0; i < ret.datalen; i++) {
2256                 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
2257         }
2258         return ret;
2259 }
2260 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
2261         LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
2262         for (size_t i = 0; i < ret.datalen; i++) {
2263                 ret.data[i] = TxOut_clone(&orig->data[i]);
2264         }
2265         return ret;
2266 }
2267 static jclass LDKCOption_u32Z_Some_class = NULL;
2268 static jmethodID LDKCOption_u32Z_Some_meth = NULL;
2269 static jclass LDKCOption_u32Z_None_class = NULL;
2270 static jmethodID LDKCOption_u32Z_None_meth = NULL;
2271 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u32Z_init (JNIEnv *env, jclass clz) {
2272         LDKCOption_u32Z_Some_class =
2273                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$Some"));
2274         CHECK(LDKCOption_u32Z_Some_class != NULL);
2275         LDKCOption_u32Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_Some_class, "<init>", "(I)V");
2276         CHECK(LDKCOption_u32Z_Some_meth != NULL);
2277         LDKCOption_u32Z_None_class =
2278                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$None"));
2279         CHECK(LDKCOption_u32Z_None_class != NULL);
2280         LDKCOption_u32Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_None_class, "<init>", "()V");
2281         CHECK(LDKCOption_u32Z_None_meth != NULL);
2282 }
2283 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u32Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2284         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
2285         switch(obj->tag) {
2286                 case LDKCOption_u32Z_Some: {
2287                         int32_t some_conv = obj->some;
2288                         return (*env)->NewObject(env, LDKCOption_u32Z_Some_class, LDKCOption_u32Z_Some_meth, some_conv);
2289                 }
2290                 case LDKCOption_u32Z_None: {
2291                         return (*env)->NewObject(env, LDKCOption_u32Z_None_class, LDKCOption_u32Z_None_meth);
2292                 }
2293                 default: abort();
2294         }
2295 }
2296 static inline struct LDKCVec_u8Z C2Tuple_CVec_u8Zu64Z_get_a(LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR owner){
2297         return CVec_u8Z_clone(&owner->a);
2298 }
2299 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8Zu64Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
2300         LDKC2Tuple_CVec_u8Zu64Z* owner_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(owner);
2301         LDKCVec_u8Z ret_var = C2Tuple_CVec_u8Zu64Z_get_a(owner_conv);
2302         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
2303         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
2304         CVec_u8Z_free(ret_var);
2305         return ret_arr;
2306 }
2307
2308 static inline uint64_t C2Tuple_CVec_u8Zu64Z_get_b(LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR owner){
2309         return owner->b;
2310 }
2311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8Zu64Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
2312         LDKC2Tuple_CVec_u8Zu64Z* owner_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(owner);
2313         int64_t ret_conv = C2Tuple_CVec_u8Zu64Z_get_b(owner_conv);
2314         return ret_conv;
2315 }
2316
2317 static inline struct LDKC2Tuple_CVec_u8Zu64Z CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_ok(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR owner){
2318 CHECK(owner->result_ok);
2319         return C2Tuple_CVec_u8Zu64Z_clone(&*owner->contents.result);
2320 }
2321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8Zu64ZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2322         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* owner_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(owner);
2323         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
2324         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_ok(owner_conv);
2325         return tag_ptr(ret_conv, true);
2326 }
2327
2328 static inline void CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_err(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR owner){
2329 CHECK(!owner->result_ok);
2330         return *owner->contents.err;
2331 }
2332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8Zu64ZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2333         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* owner_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(owner);
2334         CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_err(owner_conv);
2335 }
2336
2337 static inline struct LDKChannelDerivationParameters CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){
2338         LDKChannelDerivationParameters ret = *owner->contents.result;
2339         ret.is_owned = false;
2340         return ret;
2341 }
2342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2343         LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner);
2344         LDKChannelDerivationParameters ret_var = CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(owner_conv);
2345         int64_t ret_ref = 0;
2346         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2347         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2348         return ret_ref;
2349 }
2350
2351 static inline struct LDKDecodeError CResult_ChannelDerivationParametersDecodeErrorZ_get_err(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){
2352 CHECK(!owner->result_ok);
2353         return DecodeError_clone(&*owner->contents.err);
2354 }
2355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2356         LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner);
2357         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2358         *ret_copy = CResult_ChannelDerivationParametersDecodeErrorZ_get_err(owner_conv);
2359         int64_t ret_ref = tag_ptr(ret_copy, true);
2360         return ret_ref;
2361 }
2362
2363 static inline struct LDKHTLCDescriptor CResult_HTLCDescriptorDecodeErrorZ_get_ok(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){
2364         LDKHTLCDescriptor ret = *owner->contents.result;
2365         ret.is_owned = false;
2366         return ret;
2367 }
2368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2369         LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner);
2370         LDKHTLCDescriptor ret_var = CResult_HTLCDescriptorDecodeErrorZ_get_ok(owner_conv);
2371         int64_t ret_ref = 0;
2372         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2373         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2374         return ret_ref;
2375 }
2376
2377 static inline struct LDKDecodeError CResult_HTLCDescriptorDecodeErrorZ_get_err(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){
2378 CHECK(!owner->result_ok);
2379         return DecodeError_clone(&*owner->contents.err);
2380 }
2381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2382         LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner);
2383         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2384         *ret_copy = CResult_HTLCDescriptorDecodeErrorZ_get_err(owner_conv);
2385         int64_t ret_ref = tag_ptr(ret_copy, true);
2386         return ret_ref;
2387 }
2388
2389 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
2390 CHECK(owner->result_ok);
2391         return *owner->contents.result;
2392 }
2393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2394         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
2395         CResult_NoneNoneZ_get_ok(owner_conv);
2396 }
2397
2398 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
2399 CHECK(!owner->result_ok);
2400         return *owner->contents.err;
2401 }
2402 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2403         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
2404         CResult_NoneNoneZ_get_err(owner_conv);
2405 }
2406
2407 static inline struct LDKPublicKey CResult_PublicKeyNoneZ_get_ok(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
2408 CHECK(owner->result_ok);
2409         return *owner->contents.result;
2410 }
2411 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2412         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
2413         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
2414         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CResult_PublicKeyNoneZ_get_ok(owner_conv).compressed_form);
2415         return ret_arr;
2416 }
2417
2418 static inline void CResult_PublicKeyNoneZ_get_err(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
2419 CHECK(!owner->result_ok);
2420         return *owner->contents.err;
2421 }
2422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2423         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
2424         CResult_PublicKeyNoneZ_get_err(owner_conv);
2425 }
2426
2427 static jclass LDKCOption_BigEndianScalarZ_Some_class = NULL;
2428 static jmethodID LDKCOption_BigEndianScalarZ_Some_meth = NULL;
2429 static jclass LDKCOption_BigEndianScalarZ_None_class = NULL;
2430 static jmethodID LDKCOption_BigEndianScalarZ_None_meth = NULL;
2431 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1BigEndianScalarZ_init (JNIEnv *env, jclass clz) {
2432         LDKCOption_BigEndianScalarZ_Some_class =
2433                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_BigEndianScalarZ$Some"));
2434         CHECK(LDKCOption_BigEndianScalarZ_Some_class != NULL);
2435         LDKCOption_BigEndianScalarZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_BigEndianScalarZ_Some_class, "<init>", "(J)V");
2436         CHECK(LDKCOption_BigEndianScalarZ_Some_meth != NULL);
2437         LDKCOption_BigEndianScalarZ_None_class =
2438                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_BigEndianScalarZ$None"));
2439         CHECK(LDKCOption_BigEndianScalarZ_None_class != NULL);
2440         LDKCOption_BigEndianScalarZ_None_meth = (*env)->GetMethodID(env, LDKCOption_BigEndianScalarZ_None_class, "<init>", "()V");
2441         CHECK(LDKCOption_BigEndianScalarZ_None_meth != NULL);
2442 }
2443 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1BigEndianScalarZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2444         LDKCOption_BigEndianScalarZ *obj = (LDKCOption_BigEndianScalarZ*)untag_ptr(ptr);
2445         switch(obj->tag) {
2446                 case LDKCOption_BigEndianScalarZ_Some: {
2447                         LDKBigEndianScalar* some_ref = &obj->some;
2448                         return (*env)->NewObject(env, LDKCOption_BigEndianScalarZ_Some_class, LDKCOption_BigEndianScalarZ_Some_meth, tag_ptr(some_ref, false));
2449                 }
2450                 case LDKCOption_BigEndianScalarZ_None: {
2451                         return (*env)->NewObject(env, LDKCOption_BigEndianScalarZ_None_class, LDKCOption_BigEndianScalarZ_None_meth);
2452                 }
2453                 default: abort();
2454         }
2455 }
2456 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
2457 CHECK(owner->result_ok);
2458         return *owner->contents.result;
2459 }
2460 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2461         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
2462         int8_tArray ret_arr = (*env)->NewByteArray(env, 68);
2463         (*env)->SetByteArrayRegion(env, ret_arr, 0, 68, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form);
2464         return ret_arr;
2465 }
2466
2467 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
2468 CHECK(!owner->result_ok);
2469         return *owner->contents.err;
2470 }
2471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2472         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
2473         CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
2474 }
2475
2476 static inline struct LDKSchnorrSignature CResult_SchnorrSignatureNoneZ_get_ok(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR owner){
2477 CHECK(owner->result_ok);
2478         return *owner->contents.result;
2479 }
2480 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2481         LDKCResult_SchnorrSignatureNoneZ* owner_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(owner);
2482         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
2483         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CResult_SchnorrSignatureNoneZ_get_ok(owner_conv).compact_form);
2484         return ret_arr;
2485 }
2486
2487 static inline void CResult_SchnorrSignatureNoneZ_get_err(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR owner){
2488 CHECK(!owner->result_ok);
2489         return *owner->contents.err;
2490 }
2491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2492         LDKCResult_SchnorrSignatureNoneZ* owner_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(owner);
2493         CResult_SchnorrSignatureNoneZ_get_err(owner_conv);
2494 }
2495
2496 static inline struct LDKECDSASignature CResult_ECDSASignatureNoneZ_get_ok(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR owner){
2497 CHECK(owner->result_ok);
2498         return *owner->contents.result;
2499 }
2500 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2501         LDKCResult_ECDSASignatureNoneZ* owner_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(owner);
2502         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
2503         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CResult_ECDSASignatureNoneZ_get_ok(owner_conv).compact_form);
2504         return ret_arr;
2505 }
2506
2507 static inline void CResult_ECDSASignatureNoneZ_get_err(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR owner){
2508 CHECK(!owner->result_ok);
2509         return *owner->contents.err;
2510 }
2511 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2512         LDKCResult_ECDSASignatureNoneZ* owner_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(owner);
2513         CResult_ECDSASignatureNoneZ_get_err(owner_conv);
2514 }
2515
2516 static inline struct LDKECDSASignature C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR owner){
2517         return owner->a;
2518 }
2519 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
2520         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* owner_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(owner);
2521         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
2522         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(owner_conv).compact_form);
2523         return ret_arr;
2524 }
2525
2526 static inline struct LDKCVec_ECDSASignatureZ C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR owner){
2527         return owner->b;
2528 }
2529 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
2530         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* owner_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(owner);
2531         LDKCVec_ECDSASignatureZ ret_var = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(owner_conv);
2532         jobjectArray ret_arr = NULL;
2533         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
2534         ;
2535         for (size_t i = 0; i < ret_var.datalen; i++) {
2536                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
2537                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
2538                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
2539         }
2540         
2541         return ret_arr;
2542 }
2543
2544 static inline struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR owner){
2545 CHECK(owner->result_ok);
2546         return C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(&*owner->contents.result);
2547 }
2548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2549         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(owner);
2550         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
2551         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(owner_conv);
2552         return tag_ptr(ret_conv, true);
2553 }
2554
2555 static inline void CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR owner){
2556 CHECK(!owner->result_ok);
2557         return *owner->contents.err;
2558 }
2559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2560         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(owner);
2561         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(owner_conv);
2562 }
2563
2564 typedef struct LDKChannelSigner_JCalls {
2565         atomic_size_t refcnt;
2566         JavaVM *vm;
2567         jweak o;
2568         jmethodID get_per_commitment_point_meth;
2569         jmethodID release_commitment_secret_meth;
2570         jmethodID validate_holder_commitment_meth;
2571         jmethodID validate_counterparty_revocation_meth;
2572         jmethodID channel_keys_id_meth;
2573         jmethodID provide_channel_parameters_meth;
2574 } LDKChannelSigner_JCalls;
2575 static void LDKChannelSigner_JCalls_free(void* this_arg) {
2576         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2577         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2578                 JNIEnv *env;
2579                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2580                 if (get_jenv_res == JNI_EDETACHED) {
2581                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2582                 } else {
2583                         DO_ASSERT(get_jenv_res == JNI_OK);
2584                 }
2585                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2586                 if (get_jenv_res == JNI_EDETACHED) {
2587                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2588                 }
2589                 FREE(j_calls);
2590         }
2591 }
2592 LDKPublicKey get_per_commitment_point_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
2593         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2594         JNIEnv *env;
2595         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2596         if (get_jenv_res == JNI_EDETACHED) {
2597                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2598         } else {
2599                 DO_ASSERT(get_jenv_res == JNI_OK);
2600         }
2601         int64_t idx_conv = idx;
2602         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2603         CHECK(obj != NULL);
2604         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx_conv);
2605         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2606                 (*env)->ExceptionDescribe(env);
2607                 (*env)->FatalError(env, "A call to get_per_commitment_point in LDKChannelSigner from rust threw an exception.");
2608         }
2609         LDKPublicKey ret_ref;
2610         CHECK((*env)->GetArrayLength(env, ret) == 33);
2611         (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
2612         if (get_jenv_res == JNI_EDETACHED) {
2613                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2614         }
2615         return ret_ref;
2616 }
2617 LDKThirtyTwoBytes release_commitment_secret_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
2618         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2619         JNIEnv *env;
2620         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2621         if (get_jenv_res == JNI_EDETACHED) {
2622                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2623         } else {
2624                 DO_ASSERT(get_jenv_res == JNI_OK);
2625         }
2626         int64_t idx_conv = idx;
2627         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2628         CHECK(obj != NULL);
2629         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx_conv);
2630         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2631                 (*env)->ExceptionDescribe(env);
2632                 (*env)->FatalError(env, "A call to release_commitment_secret in LDKChannelSigner from rust threw an exception.");
2633         }
2634         LDKThirtyTwoBytes ret_ref;
2635         CHECK((*env)->GetArrayLength(env, ret) == 32);
2636         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2637         if (get_jenv_res == JNI_EDETACHED) {
2638                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2639         }
2640         return ret_ref;
2641 }
2642 LDKCResult_NoneNoneZ validate_holder_commitment_LDKChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages) {
2643         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2644         JNIEnv *env;
2645         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2646         if (get_jenv_res == JNI_EDETACHED) {
2647                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2648         } else {
2649                 DO_ASSERT(get_jenv_res == JNI_OK);
2650         }
2651         LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
2652         int64_t holder_tx_ref = 0;
2653         holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
2654         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
2655         holder_tx_ref = tag_ptr(holder_tx_var.inner, holder_tx_var.is_owned);
2656         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_var = outbound_htlc_preimages;
2657         jobjectArray outbound_htlc_preimages_arr = NULL;
2658         outbound_htlc_preimages_arr = (*env)->NewObjectArray(env, outbound_htlc_preimages_var.datalen, arr_of_B_clz, NULL);
2659         ;
2660         for (size_t i = 0; i < outbound_htlc_preimages_var.datalen; i++) {
2661                 int8_tArray outbound_htlc_preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
2662                 (*env)->SetByteArrayRegion(env, outbound_htlc_preimages_conv_8_arr, 0, 32, outbound_htlc_preimages_var.data[i].data);
2663                 (*env)->SetObjectArrayElement(env, outbound_htlc_preimages_arr, i, outbound_htlc_preimages_conv_8_arr);
2664         }
2665         
2666         FREE(outbound_htlc_preimages_var.data);
2667         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2668         CHECK(obj != NULL);
2669         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_holder_commitment_meth, holder_tx_ref, outbound_htlc_preimages_arr);
2670         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2671                 (*env)->ExceptionDescribe(env);
2672                 (*env)->FatalError(env, "A call to validate_holder_commitment in LDKChannelSigner from rust threw an exception.");
2673         }
2674         void* ret_ptr = untag_ptr(ret);
2675         CHECK_ACCESS(ret_ptr);
2676         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
2677         FREE(untag_ptr(ret));
2678         if (get_jenv_res == JNI_EDETACHED) {
2679                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2680         }
2681         return ret_conv;
2682 }
2683 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
2684         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2685         JNIEnv *env;
2686         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2687         if (get_jenv_res == JNI_EDETACHED) {
2688                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2689         } else {
2690                 DO_ASSERT(get_jenv_res == JNI_OK);
2691         }
2692         int64_t idx_conv = idx;
2693         int8_tArray secret_arr = (*env)->NewByteArray(env, 32);
2694         (*env)->SetByteArrayRegion(env, secret_arr, 0, 32, *secret);
2695         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2696         CHECK(obj != NULL);
2697         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_counterparty_revocation_meth, idx_conv, secret_arr);
2698         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2699                 (*env)->ExceptionDescribe(env);
2700                 (*env)->FatalError(env, "A call to validate_counterparty_revocation in LDKChannelSigner from rust threw an exception.");
2701         }
2702         void* ret_ptr = untag_ptr(ret);
2703         CHECK_ACCESS(ret_ptr);
2704         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
2705         FREE(untag_ptr(ret));
2706         if (get_jenv_res == JNI_EDETACHED) {
2707                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2708         }
2709         return ret_conv;
2710 }
2711 LDKThirtyTwoBytes channel_keys_id_LDKChannelSigner_jcall(const void* this_arg) {
2712         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2713         JNIEnv *env;
2714         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2715         if (get_jenv_res == JNI_EDETACHED) {
2716                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2717         } else {
2718                 DO_ASSERT(get_jenv_res == JNI_OK);
2719         }
2720         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2721         CHECK(obj != NULL);
2722         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth);
2723         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2724                 (*env)->ExceptionDescribe(env);
2725                 (*env)->FatalError(env, "A call to channel_keys_id in LDKChannelSigner from rust threw an exception.");
2726         }
2727         LDKThirtyTwoBytes ret_ref;
2728         CHECK((*env)->GetArrayLength(env, ret) == 32);
2729         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2730         if (get_jenv_res == JNI_EDETACHED) {
2731                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2732         }
2733         return ret_ref;
2734 }
2735 void provide_channel_parameters_LDKChannelSigner_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
2736         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2737         JNIEnv *env;
2738         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2739         if (get_jenv_res == JNI_EDETACHED) {
2740                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2741         } else {
2742                 DO_ASSERT(get_jenv_res == JNI_OK);
2743         }
2744         LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
2745         int64_t channel_parameters_ref = 0;
2746         channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
2747         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
2748         channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned);
2749         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2750         CHECK(obj != NULL);
2751         (*env)->CallVoidMethod(env, obj, j_calls->provide_channel_parameters_meth, channel_parameters_ref);
2752         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2753                 (*env)->ExceptionDescribe(env);
2754                 (*env)->FatalError(env, "A call to provide_channel_parameters in LDKChannelSigner from rust threw an exception.");
2755         }
2756         if (get_jenv_res == JNI_EDETACHED) {
2757                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2758         }
2759 }
2760 static inline LDKChannelSigner LDKChannelSigner_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2761         jclass c = (*env)->GetObjectClass(env, o);
2762         CHECK(c != NULL);
2763         LDKChannelSigner_JCalls *calls = MALLOC(sizeof(LDKChannelSigner_JCalls), "LDKChannelSigner_JCalls");
2764         atomic_init(&calls->refcnt, 1);
2765         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2766         calls->o = (*env)->NewWeakGlobalRef(env, o);
2767         calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
2768         CHECK(calls->get_per_commitment_point_meth != NULL);
2769         calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
2770         CHECK(calls->release_commitment_secret_meth != NULL);
2771         calls->validate_holder_commitment_meth = (*env)->GetMethodID(env, c, "validate_holder_commitment", "(J[[B)J");
2772         CHECK(calls->validate_holder_commitment_meth != NULL);
2773         calls->validate_counterparty_revocation_meth = (*env)->GetMethodID(env, c, "validate_counterparty_revocation", "(J[B)J");
2774         CHECK(calls->validate_counterparty_revocation_meth != NULL);
2775         calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
2776         CHECK(calls->channel_keys_id_meth != NULL);
2777         calls->provide_channel_parameters_meth = (*env)->GetMethodID(env, c, "provide_channel_parameters", "(J)V");
2778         CHECK(calls->provide_channel_parameters_meth != NULL);
2779
2780         LDKChannelPublicKeys pubkeys_conv;
2781         pubkeys_conv.inner = untag_ptr(pubkeys);
2782         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
2783         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2784
2785         LDKChannelSigner ret = {
2786                 .this_arg = (void*) calls,
2787                 .get_per_commitment_point = get_per_commitment_point_LDKChannelSigner_jcall,
2788                 .release_commitment_secret = release_commitment_secret_LDKChannelSigner_jcall,
2789                 .validate_holder_commitment = validate_holder_commitment_LDKChannelSigner_jcall,
2790                 .validate_counterparty_revocation = validate_counterparty_revocation_LDKChannelSigner_jcall,
2791                 .channel_keys_id = channel_keys_id_LDKChannelSigner_jcall,
2792                 .provide_channel_parameters = provide_channel_parameters_LDKChannelSigner_jcall,
2793                 .free = LDKChannelSigner_JCalls_free,
2794                 .pubkeys = pubkeys_conv,
2795                 .set_pubkeys = NULL,
2796         };
2797         return ret;
2798 }
2799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelSigner_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2800         LDKChannelSigner *res_ptr = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
2801         *res_ptr = LDKChannelSigner_init(env, clz, o, pubkeys);
2802         return tag_ptr(res_ptr, true);
2803 }
2804 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) {
2805         void* this_arg_ptr = untag_ptr(this_arg);
2806         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2807         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2808         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
2809         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
2810         return ret_arr;
2811 }
2812
2813 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
2814         void* this_arg_ptr = untag_ptr(this_arg);
2815         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2816         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2817         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2818         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
2819         return ret_arr;
2820 }
2821
2822 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) {
2823         void* this_arg_ptr = untag_ptr(this_arg);
2824         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2825         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2826         LDKHolderCommitmentTransaction holder_tx_conv;
2827         holder_tx_conv.inner = untag_ptr(holder_tx);
2828         holder_tx_conv.is_owned = ptr_is_owned(holder_tx);
2829         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
2830         holder_tx_conv.is_owned = false;
2831         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_constr;
2832         outbound_htlc_preimages_constr.datalen = (*env)->GetArrayLength(env, outbound_htlc_preimages);
2833         if (outbound_htlc_preimages_constr.datalen > 0)
2834                 outbound_htlc_preimages_constr.data = MALLOC(outbound_htlc_preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
2835         else
2836                 outbound_htlc_preimages_constr.data = NULL;
2837         for (size_t i = 0; i < outbound_htlc_preimages_constr.datalen; i++) {
2838                 int8_tArray outbound_htlc_preimages_conv_8 = (*env)->GetObjectArrayElement(env, outbound_htlc_preimages, i);
2839                 LDKThirtyTwoBytes outbound_htlc_preimages_conv_8_ref;
2840                 CHECK((*env)->GetArrayLength(env, outbound_htlc_preimages_conv_8) == 32);
2841                 (*env)->GetByteArrayRegion(env, outbound_htlc_preimages_conv_8, 0, 32, outbound_htlc_preimages_conv_8_ref.data);
2842                 outbound_htlc_preimages_constr.data[i] = outbound_htlc_preimages_conv_8_ref;
2843         }
2844         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
2845         *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, outbound_htlc_preimages_constr);
2846         return tag_ptr(ret_conv, true);
2847 }
2848
2849 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) {
2850         void* this_arg_ptr = untag_ptr(this_arg);
2851         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2852         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2853         uint8_t secret_arr[32];
2854         CHECK((*env)->GetArrayLength(env, secret) == 32);
2855         (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_arr);
2856         uint8_t (*secret_ref)[32] = &secret_arr;
2857         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
2858         *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
2859         return tag_ptr(ret_conv, true);
2860 }
2861
2862 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
2863         void* this_arg_ptr = untag_ptr(this_arg);
2864         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2865         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2866         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2867         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data);
2868         return ret_arr;
2869 }
2870
2871 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1provide_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
2872         void* this_arg_ptr = untag_ptr(this_arg);
2873         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2874         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2875         LDKChannelTransactionParameters channel_parameters_conv;
2876         channel_parameters_conv.inner = untag_ptr(channel_parameters);
2877         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
2878         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
2879         channel_parameters_conv.is_owned = false;
2880         (this_arg_conv->provide_channel_parameters)(this_arg_conv->this_arg, &channel_parameters_conv);
2881 }
2882
2883 LDKChannelPublicKeys LDKChannelSigner_set_get_pubkeys(LDKChannelSigner* this_arg) {
2884         if (this_arg->set_pubkeys != NULL)
2885                 this_arg->set_pubkeys(this_arg);
2886         return this_arg->pubkeys;
2887 }
2888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
2889         void* this_arg_ptr = untag_ptr(this_arg);
2890         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2891         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2892         LDKChannelPublicKeys ret_var = LDKChannelSigner_set_get_pubkeys(this_arg_conv);
2893         int64_t ret_ref = 0;
2894         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2895         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2896         return ret_ref;
2897 }
2898
2899 typedef struct LDKEcdsaChannelSigner_JCalls {
2900         atomic_size_t refcnt;
2901         JavaVM *vm;
2902         jweak o;
2903         LDKChannelSigner_JCalls* ChannelSigner;
2904         jmethodID sign_counterparty_commitment_meth;
2905         jmethodID sign_holder_commitment_meth;
2906         jmethodID sign_justice_revoked_output_meth;
2907         jmethodID sign_justice_revoked_htlc_meth;
2908         jmethodID sign_holder_htlc_transaction_meth;
2909         jmethodID sign_counterparty_htlc_transaction_meth;
2910         jmethodID sign_closing_transaction_meth;
2911         jmethodID sign_holder_anchor_input_meth;
2912         jmethodID sign_channel_announcement_with_funding_key_meth;
2913 } LDKEcdsaChannelSigner_JCalls;
2914 static void LDKEcdsaChannelSigner_JCalls_free(void* this_arg) {
2915         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2916         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2917                 JNIEnv *env;
2918                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2919                 if (get_jenv_res == JNI_EDETACHED) {
2920                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2921                 } else {
2922                         DO_ASSERT(get_jenv_res == JNI_OK);
2923                 }
2924                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2925                 if (get_jenv_res == JNI_EDETACHED) {
2926                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2927                 }
2928                 FREE(j_calls);
2929         }
2930 }
2931 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) {
2932         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2933         JNIEnv *env;
2934         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2935         if (get_jenv_res == JNI_EDETACHED) {
2936                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2937         } else {
2938                 DO_ASSERT(get_jenv_res == JNI_OK);
2939         }
2940         LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
2941         int64_t commitment_tx_ref = 0;
2942         commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
2943         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
2944         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
2945         LDKCVec_ThirtyTwoBytesZ inbound_htlc_preimages_var = inbound_htlc_preimages;
2946         jobjectArray inbound_htlc_preimages_arr = NULL;
2947         inbound_htlc_preimages_arr = (*env)->NewObjectArray(env, inbound_htlc_preimages_var.datalen, arr_of_B_clz, NULL);
2948         ;
2949         for (size_t i = 0; i < inbound_htlc_preimages_var.datalen; i++) {
2950                 int8_tArray inbound_htlc_preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
2951                 (*env)->SetByteArrayRegion(env, inbound_htlc_preimages_conv_8_arr, 0, 32, inbound_htlc_preimages_var.data[i].data);
2952                 (*env)->SetObjectArrayElement(env, inbound_htlc_preimages_arr, i, inbound_htlc_preimages_conv_8_arr);
2953         }
2954         
2955         FREE(inbound_htlc_preimages_var.data);
2956         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_var = outbound_htlc_preimages;
2957         jobjectArray outbound_htlc_preimages_arr = NULL;
2958         outbound_htlc_preimages_arr = (*env)->NewObjectArray(env, outbound_htlc_preimages_var.datalen, arr_of_B_clz, NULL);
2959         ;
2960         for (size_t i = 0; i < outbound_htlc_preimages_var.datalen; i++) {
2961                 int8_tArray outbound_htlc_preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
2962                 (*env)->SetByteArrayRegion(env, outbound_htlc_preimages_conv_8_arr, 0, 32, outbound_htlc_preimages_var.data[i].data);
2963                 (*env)->SetObjectArrayElement(env, outbound_htlc_preimages_arr, i, outbound_htlc_preimages_conv_8_arr);
2964         }
2965         
2966         FREE(outbound_htlc_preimages_var.data);
2967         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2968         CHECK(obj != NULL);
2969         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref, inbound_htlc_preimages_arr, outbound_htlc_preimages_arr);
2970         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2971                 (*env)->ExceptionDescribe(env);
2972                 (*env)->FatalError(env, "A call to sign_counterparty_commitment in LDKEcdsaChannelSigner from rust threw an exception.");
2973         }
2974         void* ret_ptr = untag_ptr(ret);
2975         CHECK_ACCESS(ret_ptr);
2976         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(ret_ptr);
2977         FREE(untag_ptr(ret));
2978         if (get_jenv_res == JNI_EDETACHED) {
2979                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2980         }
2981         return ret_conv;
2982 }
2983 LDKCResult_ECDSASignatureNoneZ sign_holder_commitment_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
2984         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2985         JNIEnv *env;
2986         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2987         if (get_jenv_res == JNI_EDETACHED) {
2988                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2989         } else {
2990                 DO_ASSERT(get_jenv_res == JNI_OK);
2991         }
2992         LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
2993         int64_t commitment_tx_ref = 0;
2994         commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
2995         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
2996         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
2997         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2998         CHECK(obj != NULL);
2999         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_meth, commitment_tx_ref);
3000         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3001                 (*env)->ExceptionDescribe(env);
3002                 (*env)->FatalError(env, "A call to sign_holder_commitment in LDKEcdsaChannelSigner from rust threw an exception.");
3003         }
3004         void* ret_ptr = untag_ptr(ret);
3005         CHECK_ACCESS(ret_ptr);
3006         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3007         FREE(untag_ptr(ret));
3008         if (get_jenv_res == JNI_EDETACHED) {
3009                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3010         }
3011         return ret_conv;
3012 }
3013 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]) {
3014         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3015         JNIEnv *env;
3016         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3017         if (get_jenv_res == JNI_EDETACHED) {
3018                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3019         } else {
3020                 DO_ASSERT(get_jenv_res == JNI_OK);
3021         }
3022         LDKTransaction justice_tx_var = justice_tx;
3023         int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
3024         (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
3025         Transaction_free(justice_tx_var);
3026         int64_t input_conv = input;
3027         int64_t amount_conv = amount;
3028         int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
3029         (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
3030         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3031         CHECK(obj != NULL);
3032         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);
3033         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3034                 (*env)->ExceptionDescribe(env);
3035                 (*env)->FatalError(env, "A call to sign_justice_revoked_output in LDKEcdsaChannelSigner from rust threw an exception.");
3036         }
3037         void* ret_ptr = untag_ptr(ret);
3038         CHECK_ACCESS(ret_ptr);
3039         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3040         FREE(untag_ptr(ret));
3041         if (get_jenv_res == JNI_EDETACHED) {
3042                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3043         }
3044         return ret_conv;
3045 }
3046 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) {
3047         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3048         JNIEnv *env;
3049         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3050         if (get_jenv_res == JNI_EDETACHED) {
3051                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3052         } else {
3053                 DO_ASSERT(get_jenv_res == JNI_OK);
3054         }
3055         LDKTransaction justice_tx_var = justice_tx;
3056         int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
3057         (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
3058         Transaction_free(justice_tx_var);
3059         int64_t input_conv = input;
3060         int64_t amount_conv = amount;
3061         int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
3062         (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
3063         LDKHTLCOutputInCommitment htlc_var = *htlc;
3064         int64_t htlc_ref = 0;
3065         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
3066         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
3067         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
3068         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3069         CHECK(obj != NULL);
3070         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);
3071         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3072                 (*env)->ExceptionDescribe(env);
3073                 (*env)->FatalError(env, "A call to sign_justice_revoked_htlc in LDKEcdsaChannelSigner from rust threw an exception.");
3074         }
3075         void* ret_ptr = untag_ptr(ret);
3076         CHECK_ACCESS(ret_ptr);
3077         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3078         FREE(untag_ptr(ret));
3079         if (get_jenv_res == JNI_EDETACHED) {
3080                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3081         }
3082         return ret_conv;
3083 }
3084 LDKCResult_ECDSASignatureNoneZ sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, const LDKHTLCDescriptor * htlc_descriptor) {
3085         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3086         JNIEnv *env;
3087         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3088         if (get_jenv_res == JNI_EDETACHED) {
3089                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3090         } else {
3091                 DO_ASSERT(get_jenv_res == JNI_OK);
3092         }
3093         LDKTransaction htlc_tx_var = htlc_tx;
3094         int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
3095         (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
3096         Transaction_free(htlc_tx_var);
3097         int64_t input_conv = input;
3098         LDKHTLCDescriptor htlc_descriptor_var = *htlc_descriptor;
3099         int64_t htlc_descriptor_ref = 0;
3100         htlc_descriptor_var = HTLCDescriptor_clone(&htlc_descriptor_var);
3101         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_var);
3102         htlc_descriptor_ref = tag_ptr(htlc_descriptor_var.inner, htlc_descriptor_var.is_owned);
3103         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3104         CHECK(obj != NULL);
3105         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_htlc_transaction_meth, htlc_tx_arr, input_conv, htlc_descriptor_ref);
3106         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3107                 (*env)->ExceptionDescribe(env);
3108                 (*env)->FatalError(env, "A call to sign_holder_htlc_transaction in LDKEcdsaChannelSigner from rust threw an exception.");
3109         }
3110         void* ret_ptr = untag_ptr(ret);
3111         CHECK_ACCESS(ret_ptr);
3112         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3113         FREE(untag_ptr(ret));
3114         if (get_jenv_res == JNI_EDETACHED) {
3115                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3116         }
3117         return ret_conv;
3118 }
3119 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) {
3120         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3121         JNIEnv *env;
3122         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3123         if (get_jenv_res == JNI_EDETACHED) {
3124                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3125         } else {
3126                 DO_ASSERT(get_jenv_res == JNI_OK);
3127         }
3128         LDKTransaction htlc_tx_var = htlc_tx;
3129         int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
3130         (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
3131         Transaction_free(htlc_tx_var);
3132         int64_t input_conv = input;
3133         int64_t amount_conv = amount;
3134         int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
3135         (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
3136         LDKHTLCOutputInCommitment htlc_var = *htlc;
3137         int64_t htlc_ref = 0;
3138         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
3139         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
3140         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
3141         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3142         CHECK(obj != NULL);
3143         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);
3144         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3145                 (*env)->ExceptionDescribe(env);
3146                 (*env)->FatalError(env, "A call to sign_counterparty_htlc_transaction in LDKEcdsaChannelSigner from rust threw an exception.");
3147         }
3148         void* ret_ptr = untag_ptr(ret);
3149         CHECK_ACCESS(ret_ptr);
3150         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3151         FREE(untag_ptr(ret));
3152         if (get_jenv_res == JNI_EDETACHED) {
3153                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3154         }
3155         return ret_conv;
3156 }
3157 LDKCResult_ECDSASignatureNoneZ sign_closing_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
3158         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3159         JNIEnv *env;
3160         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3161         if (get_jenv_res == JNI_EDETACHED) {
3162                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3163         } else {
3164                 DO_ASSERT(get_jenv_res == JNI_OK);
3165         }
3166         LDKClosingTransaction closing_tx_var = *closing_tx;
3167         int64_t closing_tx_ref = 0;
3168         closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
3169         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
3170         closing_tx_ref = tag_ptr(closing_tx_var.inner, closing_tx_var.is_owned);
3171         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3172         CHECK(obj != NULL);
3173         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
3174         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3175                 (*env)->ExceptionDescribe(env);
3176                 (*env)->FatalError(env, "A call to sign_closing_transaction in LDKEcdsaChannelSigner from rust threw an exception.");
3177         }
3178         void* ret_ptr = untag_ptr(ret);
3179         CHECK_ACCESS(ret_ptr);
3180         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3181         FREE(untag_ptr(ret));
3182         if (get_jenv_res == JNI_EDETACHED) {
3183                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3184         }
3185         return ret_conv;
3186 }
3187 LDKCResult_ECDSASignatureNoneZ sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction anchor_tx, uintptr_t input) {
3188         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3189         JNIEnv *env;
3190         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3191         if (get_jenv_res == JNI_EDETACHED) {
3192                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3193         } else {
3194                 DO_ASSERT(get_jenv_res == JNI_OK);
3195         }
3196         LDKTransaction anchor_tx_var = anchor_tx;
3197         int8_tArray anchor_tx_arr = (*env)->NewByteArray(env, anchor_tx_var.datalen);
3198         (*env)->SetByteArrayRegion(env, anchor_tx_arr, 0, anchor_tx_var.datalen, anchor_tx_var.data);
3199         Transaction_free(anchor_tx_var);
3200         int64_t input_conv = input;
3201         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3202         CHECK(obj != NULL);
3203         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_anchor_input_meth, anchor_tx_arr, input_conv);
3204         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3205                 (*env)->ExceptionDescribe(env);
3206                 (*env)->FatalError(env, "A call to sign_holder_anchor_input in LDKEcdsaChannelSigner from rust threw an exception.");
3207         }
3208         void* ret_ptr = untag_ptr(ret);
3209         CHECK_ACCESS(ret_ptr);
3210         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3211         FREE(untag_ptr(ret));
3212         if (get_jenv_res == JNI_EDETACHED) {
3213                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3214         }
3215         return ret_conv;
3216 }
3217 LDKCResult_ECDSASignatureNoneZ sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
3218         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3219         JNIEnv *env;
3220         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3221         if (get_jenv_res == JNI_EDETACHED) {
3222                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3223         } else {
3224                 DO_ASSERT(get_jenv_res == JNI_OK);
3225         }
3226         LDKUnsignedChannelAnnouncement msg_var = *msg;
3227         int64_t msg_ref = 0;
3228         msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
3229         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3230         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
3231         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3232         CHECK(obj != NULL);
3233         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_with_funding_key_meth, msg_ref);
3234         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3235                 (*env)->ExceptionDescribe(env);
3236                 (*env)->FatalError(env, "A call to sign_channel_announcement_with_funding_key in LDKEcdsaChannelSigner from rust threw an exception.");
3237         }
3238         void* ret_ptr = untag_ptr(ret);
3239         CHECK_ACCESS(ret_ptr);
3240         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3241         FREE(untag_ptr(ret));
3242         if (get_jenv_res == JNI_EDETACHED) {
3243                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3244         }
3245         return ret_conv;
3246 }
3247 static void LDKEcdsaChannelSigner_JCalls_cloned(LDKEcdsaChannelSigner* new_obj) {
3248         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) new_obj->this_arg;
3249         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3250         atomic_fetch_add_explicit(&j_calls->ChannelSigner->refcnt, 1, memory_order_release);
3251 }
3252 static inline LDKEcdsaChannelSigner LDKEcdsaChannelSigner_init (JNIEnv *env, jclass clz, jobject o, jobject ChannelSigner, int64_t pubkeys) {
3253         jclass c = (*env)->GetObjectClass(env, o);
3254         CHECK(c != NULL);
3255         LDKEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKEcdsaChannelSigner_JCalls), "LDKEcdsaChannelSigner_JCalls");
3256         atomic_init(&calls->refcnt, 1);
3257         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3258         calls->o = (*env)->NewWeakGlobalRef(env, o);
3259         calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J[[B[[B)J");
3260         CHECK(calls->sign_counterparty_commitment_meth != NULL);
3261         calls->sign_holder_commitment_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment", "(J)J");
3262         CHECK(calls->sign_holder_commitment_meth != NULL);
3263         calls->sign_justice_revoked_output_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_output", "([BJJ[B)J");
3264         CHECK(calls->sign_justice_revoked_output_meth != NULL);
3265         calls->sign_justice_revoked_htlc_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_htlc", "([BJJ[BJ)J");
3266         CHECK(calls->sign_justice_revoked_htlc_meth != NULL);
3267         calls->sign_holder_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_holder_htlc_transaction", "([BJJ)J");
3268         CHECK(calls->sign_holder_htlc_transaction_meth != NULL);
3269         calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
3270         CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
3271         calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
3272         CHECK(calls->sign_closing_transaction_meth != NULL);
3273         calls->sign_holder_anchor_input_meth = (*env)->GetMethodID(env, c, "sign_holder_anchor_input", "([BJ)J");
3274         CHECK(calls->sign_holder_anchor_input_meth != NULL);
3275         calls->sign_channel_announcement_with_funding_key_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement_with_funding_key", "(J)J");
3276         CHECK(calls->sign_channel_announcement_with_funding_key_meth != NULL);
3277
3278         LDKChannelPublicKeys pubkeys_conv;
3279         pubkeys_conv.inner = untag_ptr(pubkeys);
3280         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
3281         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
3282
3283         LDKEcdsaChannelSigner ret = {
3284                 .this_arg = (void*) calls,
3285                 .sign_counterparty_commitment = sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall,
3286                 .sign_holder_commitment = sign_holder_commitment_LDKEcdsaChannelSigner_jcall,
3287                 .sign_justice_revoked_output = sign_justice_revoked_output_LDKEcdsaChannelSigner_jcall,
3288                 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKEcdsaChannelSigner_jcall,
3289                 .sign_holder_htlc_transaction = sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall,
3290                 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKEcdsaChannelSigner_jcall,
3291                 .sign_closing_transaction = sign_closing_transaction_LDKEcdsaChannelSigner_jcall,
3292                 .sign_holder_anchor_input = sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall,
3293                 .sign_channel_announcement_with_funding_key = sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall,
3294                 .free = LDKEcdsaChannelSigner_JCalls_free,
3295                 .ChannelSigner = LDKChannelSigner_init(env, clz, ChannelSigner, pubkeys),
3296         };
3297         calls->ChannelSigner = ret.ChannelSigner.this_arg;
3298         return ret;
3299 }
3300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEcdsaChannelSigner_1new(JNIEnv *env, jclass clz, jobject o, jobject ChannelSigner, int64_t pubkeys) {
3301         LDKEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
3302         *res_ptr = LDKEcdsaChannelSigner_init(env, clz, o, ChannelSigner, pubkeys);
3303         return tag_ptr(res_ptr, true);
3304 }
3305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEcdsaChannelSigner_1get_1ChannelSigner(JNIEnv *env, jclass clz, int64_t arg) {
3306         LDKEcdsaChannelSigner *inp = (LDKEcdsaChannelSigner *)untag_ptr(arg);
3307         return tag_ptr(&inp->ChannelSigner, false);
3308 }
3309 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) {
3310         void* this_arg_ptr = untag_ptr(this_arg);
3311         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3312         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3313         LDKCommitmentTransaction commitment_tx_conv;
3314         commitment_tx_conv.inner = untag_ptr(commitment_tx);
3315         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
3316         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
3317         commitment_tx_conv.is_owned = false;
3318         LDKCVec_ThirtyTwoBytesZ inbound_htlc_preimages_constr;
3319         inbound_htlc_preimages_constr.datalen = (*env)->GetArrayLength(env, inbound_htlc_preimages);
3320         if (inbound_htlc_preimages_constr.datalen > 0)
3321                 inbound_htlc_preimages_constr.data = MALLOC(inbound_htlc_preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
3322         else
3323                 inbound_htlc_preimages_constr.data = NULL;
3324         for (size_t i = 0; i < inbound_htlc_preimages_constr.datalen; i++) {
3325                 int8_tArray inbound_htlc_preimages_conv_8 = (*env)->GetObjectArrayElement(env, inbound_htlc_preimages, i);
3326                 LDKThirtyTwoBytes inbound_htlc_preimages_conv_8_ref;
3327                 CHECK((*env)->GetArrayLength(env, inbound_htlc_preimages_conv_8) == 32);
3328                 (*env)->GetByteArrayRegion(env, inbound_htlc_preimages_conv_8, 0, 32, inbound_htlc_preimages_conv_8_ref.data);
3329                 inbound_htlc_preimages_constr.data[i] = inbound_htlc_preimages_conv_8_ref;
3330         }
3331         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_constr;
3332         outbound_htlc_preimages_constr.datalen = (*env)->GetArrayLength(env, outbound_htlc_preimages);
3333         if (outbound_htlc_preimages_constr.datalen > 0)
3334                 outbound_htlc_preimages_constr.data = MALLOC(outbound_htlc_preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
3335         else
3336                 outbound_htlc_preimages_constr.data = NULL;
3337         for (size_t i = 0; i < outbound_htlc_preimages_constr.datalen; i++) {
3338                 int8_tArray outbound_htlc_preimages_conv_8 = (*env)->GetObjectArrayElement(env, outbound_htlc_preimages, i);
3339                 LDKThirtyTwoBytes outbound_htlc_preimages_conv_8_ref;
3340                 CHECK((*env)->GetArrayLength(env, outbound_htlc_preimages_conv_8) == 32);
3341                 (*env)->GetByteArrayRegion(env, outbound_htlc_preimages_conv_8, 0, 32, outbound_htlc_preimages_conv_8_ref.data);
3342                 outbound_htlc_preimages_constr.data[i] = outbound_htlc_preimages_conv_8_ref;
3343         }
3344         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
3345         *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, inbound_htlc_preimages_constr, outbound_htlc_preimages_constr);
3346         return tag_ptr(ret_conv, true);
3347 }
3348
3349 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) {
3350         void* this_arg_ptr = untag_ptr(this_arg);
3351         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3352         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3353         LDKHolderCommitmentTransaction commitment_tx_conv;
3354         commitment_tx_conv.inner = untag_ptr(commitment_tx);
3355         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
3356         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
3357         commitment_tx_conv.is_owned = false;
3358         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3359         *ret_conv = (this_arg_conv->sign_holder_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
3360         return tag_ptr(ret_conv, true);
3361 }
3362
3363 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) {
3364         void* this_arg_ptr = untag_ptr(this_arg);
3365         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3366         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3367         LDKTransaction justice_tx_ref;
3368         justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
3369         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
3370         (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
3371         justice_tx_ref.data_is_owned = true;
3372         uint8_t per_commitment_key_arr[32];
3373         CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
3374         (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
3375         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
3376         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3377         *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
3378         return tag_ptr(ret_conv, true);
3379 }
3380
3381 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) {
3382         void* this_arg_ptr = untag_ptr(this_arg);
3383         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3384         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3385         LDKTransaction justice_tx_ref;
3386         justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
3387         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
3388         (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
3389         justice_tx_ref.data_is_owned = true;
3390         uint8_t per_commitment_key_arr[32];
3391         CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
3392         (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
3393         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
3394         LDKHTLCOutputInCommitment htlc_conv;
3395         htlc_conv.inner = untag_ptr(htlc);
3396         htlc_conv.is_owned = ptr_is_owned(htlc);
3397         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
3398         htlc_conv.is_owned = false;
3399         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3400         *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);
3401         return tag_ptr(ret_conv, true);
3402 }
3403
3404 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) {
3405         void* this_arg_ptr = untag_ptr(this_arg);
3406         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3407         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3408         LDKTransaction htlc_tx_ref;
3409         htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
3410         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
3411         (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
3412         htlc_tx_ref.data_is_owned = true;
3413         LDKHTLCDescriptor htlc_descriptor_conv;
3414         htlc_descriptor_conv.inner = untag_ptr(htlc_descriptor);
3415         htlc_descriptor_conv.is_owned = ptr_is_owned(htlc_descriptor);
3416         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_conv);
3417         htlc_descriptor_conv.is_owned = false;
3418         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3419         *ret_conv = (this_arg_conv->sign_holder_htlc_transaction)(this_arg_conv->this_arg, htlc_tx_ref, input, &htlc_descriptor_conv);
3420         return tag_ptr(ret_conv, true);
3421 }
3422
3423 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) {
3424         void* this_arg_ptr = untag_ptr(this_arg);
3425         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3426         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3427         LDKTransaction htlc_tx_ref;
3428         htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
3429         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
3430         (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
3431         htlc_tx_ref.data_is_owned = true;
3432         LDKPublicKey per_commitment_point_ref;
3433         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
3434         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
3435         LDKHTLCOutputInCommitment htlc_conv;
3436         htlc_conv.inner = untag_ptr(htlc);
3437         htlc_conv.is_owned = ptr_is_owned(htlc);
3438         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
3439         htlc_conv.is_owned = false;
3440         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3441         *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);
3442         return tag_ptr(ret_conv, true);
3443 }
3444
3445 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) {
3446         void* this_arg_ptr = untag_ptr(this_arg);
3447         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3448         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3449         LDKClosingTransaction closing_tx_conv;
3450         closing_tx_conv.inner = untag_ptr(closing_tx);
3451         closing_tx_conv.is_owned = ptr_is_owned(closing_tx);
3452         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
3453         closing_tx_conv.is_owned = false;
3454         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3455         *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
3456         return tag_ptr(ret_conv, true);
3457 }
3458
3459 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) {
3460         void* this_arg_ptr = untag_ptr(this_arg);
3461         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3462         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3463         LDKTransaction anchor_tx_ref;
3464         anchor_tx_ref.datalen = (*env)->GetArrayLength(env, anchor_tx);
3465         anchor_tx_ref.data = MALLOC(anchor_tx_ref.datalen, "LDKTransaction Bytes");
3466         (*env)->GetByteArrayRegion(env, anchor_tx, 0, anchor_tx_ref.datalen, anchor_tx_ref.data);
3467         anchor_tx_ref.data_is_owned = true;
3468         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3469         *ret_conv = (this_arg_conv->sign_holder_anchor_input)(this_arg_conv->this_arg, anchor_tx_ref, input);
3470         return tag_ptr(ret_conv, true);
3471 }
3472
3473 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) {
3474         void* this_arg_ptr = untag_ptr(this_arg);
3475         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3476         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3477         LDKUnsignedChannelAnnouncement msg_conv;
3478         msg_conv.inner = untag_ptr(msg);
3479         msg_conv.is_owned = ptr_is_owned(msg);
3480         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
3481         msg_conv.is_owned = false;
3482         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3483         *ret_conv = (this_arg_conv->sign_channel_announcement_with_funding_key)(this_arg_conv->this_arg, &msg_conv);
3484         return tag_ptr(ret_conv, true);
3485 }
3486
3487 typedef struct LDKWriteableEcdsaChannelSigner_JCalls {
3488         atomic_size_t refcnt;
3489         JavaVM *vm;
3490         jweak o;
3491         LDKEcdsaChannelSigner_JCalls* EcdsaChannelSigner;
3492         LDKChannelSigner_JCalls* ChannelSigner;
3493         jmethodID write_meth;
3494 } LDKWriteableEcdsaChannelSigner_JCalls;
3495 static void LDKWriteableEcdsaChannelSigner_JCalls_free(void* this_arg) {
3496         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
3497         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3498                 JNIEnv *env;
3499                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3500                 if (get_jenv_res == JNI_EDETACHED) {
3501                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3502                 } else {
3503                         DO_ASSERT(get_jenv_res == JNI_OK);
3504                 }
3505                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3506                 if (get_jenv_res == JNI_EDETACHED) {
3507                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3508                 }
3509                 FREE(j_calls);
3510         }
3511 }
3512 LDKCVec_u8Z write_LDKWriteableEcdsaChannelSigner_jcall(const void* this_arg) {
3513         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
3514         JNIEnv *env;
3515         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3516         if (get_jenv_res == JNI_EDETACHED) {
3517                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3518         } else {
3519                 DO_ASSERT(get_jenv_res == JNI_OK);
3520         }
3521         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3522         CHECK(obj != NULL);
3523         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
3524         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3525                 (*env)->ExceptionDescribe(env);
3526                 (*env)->FatalError(env, "A call to write in LDKWriteableEcdsaChannelSigner from rust threw an exception.");
3527         }
3528         LDKCVec_u8Z ret_ref;
3529         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
3530         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3531         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
3532         if (get_jenv_res == JNI_EDETACHED) {
3533                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3534         }
3535         return ret_ref;
3536 }
3537 static void LDKWriteableEcdsaChannelSigner_JCalls_cloned(LDKWriteableEcdsaChannelSigner* new_obj) {
3538         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) new_obj->this_arg;
3539         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3540         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->refcnt, 1, memory_order_release);
3541         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->ChannelSigner->refcnt, 1, memory_order_release);
3542 }
3543 static inline LDKWriteableEcdsaChannelSigner LDKWriteableEcdsaChannelSigner_init (JNIEnv *env, jclass clz, jobject o, jobject EcdsaChannelSigner, jobject ChannelSigner, int64_t pubkeys) {
3544         jclass c = (*env)->GetObjectClass(env, o);
3545         CHECK(c != NULL);
3546         LDKWriteableEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner_JCalls), "LDKWriteableEcdsaChannelSigner_JCalls");
3547         atomic_init(&calls->refcnt, 1);
3548         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3549         calls->o = (*env)->NewWeakGlobalRef(env, o);
3550         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
3551         CHECK(calls->write_meth != NULL);
3552
3553         LDKChannelPublicKeys pubkeys_conv;
3554         pubkeys_conv.inner = untag_ptr(pubkeys);
3555         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
3556         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
3557
3558         LDKWriteableEcdsaChannelSigner ret = {
3559                 .this_arg = (void*) calls,
3560                 .write = write_LDKWriteableEcdsaChannelSigner_jcall,
3561                 .cloned = LDKWriteableEcdsaChannelSigner_JCalls_cloned,
3562                 .free = LDKWriteableEcdsaChannelSigner_JCalls_free,
3563                 .EcdsaChannelSigner = LDKEcdsaChannelSigner_init(env, clz, EcdsaChannelSigner, ChannelSigner, pubkeys),
3564         };
3565         calls->EcdsaChannelSigner = ret.EcdsaChannelSigner.this_arg;
3566         calls->ChannelSigner = ret.EcdsaChannelSigner.ChannelSigner.this_arg;
3567         return ret;
3568 }
3569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableEcdsaChannelSigner_1new(JNIEnv *env, jclass clz, jobject o, jobject EcdsaChannelSigner, jobject ChannelSigner, int64_t pubkeys) {
3570         LDKWriteableEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
3571         *res_ptr = LDKWriteableEcdsaChannelSigner_init(env, clz, o, EcdsaChannelSigner, ChannelSigner, pubkeys);
3572         return tag_ptr(res_ptr, true);
3573 }
3574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableEcdsaChannelSigner_1get_1EcdsaChannelSigner(JNIEnv *env, jclass clz, int64_t arg) {
3575         LDKWriteableEcdsaChannelSigner *inp = (LDKWriteableEcdsaChannelSigner *)untag_ptr(arg);
3576         return tag_ptr(&inp->EcdsaChannelSigner, false);
3577 }
3578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableEcdsaChannelSigner_1get_1ChannelSigner(JNIEnv *env, jclass clz, int64_t arg) {
3579         LDKWriteableEcdsaChannelSigner *inp = (LDKWriteableEcdsaChannelSigner *)untag_ptr(arg);
3580         return tag_ptr(&inp->EcdsaChannelSigner.ChannelSigner, false);
3581 }
3582 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
3583         void* this_arg_ptr = untag_ptr(this_arg);
3584         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3585         LDKWriteableEcdsaChannelSigner* this_arg_conv = (LDKWriteableEcdsaChannelSigner*)this_arg_ptr;
3586         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
3587         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3588         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3589         CVec_u8Z_free(ret_var);
3590         return ret_arr;
3591 }
3592
3593 static inline struct LDKWriteableEcdsaChannelSigner CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
3594 CHECK(owner->result_ok);
3595         return WriteableEcdsaChannelSigner_clone(&*owner->contents.result);
3596 }
3597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3598         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
3599         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
3600         *ret_ret = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(owner_conv);
3601         return tag_ptr(ret_ret, true);
3602 }
3603
3604 static inline struct LDKDecodeError CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
3605 CHECK(!owner->result_ok);
3606         return DecodeError_clone(&*owner->contents.err);
3607 }
3608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3609         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
3610         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3611         *ret_copy = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(owner_conv);
3612         int64_t ret_ref = tag_ptr(ret_copy, true);
3613         return ret_ref;
3614 }
3615
3616 static inline struct LDKCVec_u8Z CResult_CVec_u8ZNoneZ_get_ok(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR owner){
3617 CHECK(owner->result_ok);
3618         return CVec_u8Z_clone(&*owner->contents.result);
3619 }
3620 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3621         LDKCResult_CVec_u8ZNoneZ* owner_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(owner);
3622         LDKCVec_u8Z ret_var = CResult_CVec_u8ZNoneZ_get_ok(owner_conv);
3623         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3624         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3625         CVec_u8Z_free(ret_var);
3626         return ret_arr;
3627 }
3628
3629 static inline void CResult_CVec_u8ZNoneZ_get_err(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR owner){
3630 CHECK(!owner->result_ok);
3631         return *owner->contents.err;
3632 }
3633 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3634         LDKCResult_CVec_u8ZNoneZ* owner_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(owner);
3635         CResult_CVec_u8ZNoneZ_get_err(owner_conv);
3636 }
3637
3638 static inline struct LDKShutdownScript CResult_ShutdownScriptNoneZ_get_ok(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
3639         LDKShutdownScript ret = *owner->contents.result;
3640         ret.is_owned = false;
3641         return ret;
3642 }
3643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3644         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
3645         LDKShutdownScript ret_var = CResult_ShutdownScriptNoneZ_get_ok(owner_conv);
3646         int64_t ret_ref = 0;
3647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3649         return ret_ref;
3650 }
3651
3652 static inline void CResult_ShutdownScriptNoneZ_get_err(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
3653 CHECK(!owner->result_ok);
3654         return *owner->contents.err;
3655 }
3656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3657         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
3658         CResult_ShutdownScriptNoneZ_get_err(owner_conv);
3659 }
3660
3661 static jclass LDKCOption_u16Z_Some_class = NULL;
3662 static jmethodID LDKCOption_u16Z_Some_meth = NULL;
3663 static jclass LDKCOption_u16Z_None_class = NULL;
3664 static jmethodID LDKCOption_u16Z_None_meth = NULL;
3665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u16Z_init (JNIEnv *env, jclass clz) {
3666         LDKCOption_u16Z_Some_class =
3667                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$Some"));
3668         CHECK(LDKCOption_u16Z_Some_class != NULL);
3669         LDKCOption_u16Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_Some_class, "<init>", "(S)V");
3670         CHECK(LDKCOption_u16Z_Some_meth != NULL);
3671         LDKCOption_u16Z_None_class =
3672                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$None"));
3673         CHECK(LDKCOption_u16Z_None_class != NULL);
3674         LDKCOption_u16Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_None_class, "<init>", "()V");
3675         CHECK(LDKCOption_u16Z_None_meth != NULL);
3676 }
3677 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u16Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3678         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
3679         switch(obj->tag) {
3680                 case LDKCOption_u16Z_Some: {
3681                         int16_t some_conv = obj->some;
3682                         return (*env)->NewObject(env, LDKCOption_u16Z_Some_class, LDKCOption_u16Z_Some_meth, some_conv);
3683                 }
3684                 case LDKCOption_u16Z_None: {
3685                         return (*env)->NewObject(env, LDKCOption_u16Z_None_class, LDKCOption_u16Z_None_meth);
3686                 }
3687                 default: abort();
3688         }
3689 }
3690 static jclass LDKCOption_boolZ_Some_class = NULL;
3691 static jmethodID LDKCOption_boolZ_Some_meth = NULL;
3692 static jclass LDKCOption_boolZ_None_class = NULL;
3693 static jmethodID LDKCOption_boolZ_None_meth = NULL;
3694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1boolZ_init (JNIEnv *env, jclass clz) {
3695         LDKCOption_boolZ_Some_class =
3696                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_boolZ$Some"));
3697         CHECK(LDKCOption_boolZ_Some_class != NULL);
3698         LDKCOption_boolZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_boolZ_Some_class, "<init>", "(Z)V");
3699         CHECK(LDKCOption_boolZ_Some_meth != NULL);
3700         LDKCOption_boolZ_None_class =
3701                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_boolZ$None"));
3702         CHECK(LDKCOption_boolZ_None_class != NULL);
3703         LDKCOption_boolZ_None_meth = (*env)->GetMethodID(env, LDKCOption_boolZ_None_class, "<init>", "()V");
3704         CHECK(LDKCOption_boolZ_None_meth != NULL);
3705 }
3706 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1boolZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3707         LDKCOption_boolZ *obj = (LDKCOption_boolZ*)untag_ptr(ptr);
3708         switch(obj->tag) {
3709                 case LDKCOption_boolZ_Some: {
3710                         jboolean some_conv = obj->some;
3711                         return (*env)->NewObject(env, LDKCOption_boolZ_Some_class, LDKCOption_boolZ_Some_meth, some_conv);
3712                 }
3713                 case LDKCOption_boolZ_None: {
3714                         return (*env)->NewObject(env, LDKCOption_boolZ_None_class, LDKCOption_boolZ_None_meth);
3715                 }
3716                 default: abort();
3717         }
3718 }
3719 static inline struct LDKWitness CResult_WitnessNoneZ_get_ok(LDKCResult_WitnessNoneZ *NONNULL_PTR owner){
3720 CHECK(owner->result_ok);
3721         return Witness_clone(&*owner->contents.result);
3722 }
3723 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1WitnessNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3724         LDKCResult_WitnessNoneZ* owner_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(owner);
3725         LDKWitness ret_var = CResult_WitnessNoneZ_get_ok(owner_conv);
3726         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3727         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3728         Witness_free(ret_var);
3729         return ret_arr;
3730 }
3731
3732 static inline void CResult_WitnessNoneZ_get_err(LDKCResult_WitnessNoneZ *NONNULL_PTR owner){
3733 CHECK(!owner->result_ok);
3734         return *owner->contents.err;
3735 }
3736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WitnessNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3737         LDKCResult_WitnessNoneZ* owner_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(owner);
3738         CResult_WitnessNoneZ_get_err(owner_conv);
3739 }
3740
3741 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
3742         LDKInMemorySigner ret = *owner->contents.result;
3743         ret.is_owned = false;
3744         return ret;
3745 }
3746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3747         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
3748         LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
3749         int64_t ret_ref = 0;
3750         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3751         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3752         return ret_ref;
3753 }
3754
3755 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
3756 CHECK(!owner->result_ok);
3757         return DecodeError_clone(&*owner->contents.err);
3758 }
3759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3760         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
3761         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3762         *ret_copy = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
3763         int64_t ret_ref = tag_ptr(ret_copy, true);
3764         return ret_ref;
3765 }
3766
3767 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
3768 CHECK(owner->result_ok);
3769         return *owner->contents.result;
3770 }
3771 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3772         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
3773         LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
3774         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3775         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3776         return ret_arr;
3777 }
3778
3779 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
3780 CHECK(!owner->result_ok);
3781         return *owner->contents.err;
3782 }
3783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3784         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
3785         CResult_TransactionNoneZ_get_err(owner_conv);
3786 }
3787
3788 static jclass LDKCandidateRouteHop_FirstHop_class = NULL;
3789 static jmethodID LDKCandidateRouteHop_FirstHop_meth = NULL;
3790 static jclass LDKCandidateRouteHop_PublicHop_class = NULL;
3791 static jmethodID LDKCandidateRouteHop_PublicHop_meth = NULL;
3792 static jclass LDKCandidateRouteHop_PrivateHop_class = NULL;
3793 static jmethodID LDKCandidateRouteHop_PrivateHop_meth = NULL;
3794 static jclass LDKCandidateRouteHop_Blinded_class = NULL;
3795 static jmethodID LDKCandidateRouteHop_Blinded_meth = NULL;
3796 static jclass LDKCandidateRouteHop_OneHopBlinded_class = NULL;
3797 static jmethodID LDKCandidateRouteHop_OneHopBlinded_meth = NULL;
3798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCandidateRouteHop_init (JNIEnv *env, jclass clz) {
3799         LDKCandidateRouteHop_FirstHop_class =
3800                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCandidateRouteHop$FirstHop"));
3801         CHECK(LDKCandidateRouteHop_FirstHop_class != NULL);
3802         LDKCandidateRouteHop_FirstHop_meth = (*env)->GetMethodID(env, LDKCandidateRouteHop_FirstHop_class, "<init>", "(J)V");
3803         CHECK(LDKCandidateRouteHop_FirstHop_meth != NULL);
3804         LDKCandidateRouteHop_PublicHop_class =
3805                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCandidateRouteHop$PublicHop"));
3806         CHECK(LDKCandidateRouteHop_PublicHop_class != NULL);
3807         LDKCandidateRouteHop_PublicHop_meth = (*env)->GetMethodID(env, LDKCandidateRouteHop_PublicHop_class, "<init>", "(J)V");
3808         CHECK(LDKCandidateRouteHop_PublicHop_meth != NULL);
3809         LDKCandidateRouteHop_PrivateHop_class =
3810                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCandidateRouteHop$PrivateHop"));
3811         CHECK(LDKCandidateRouteHop_PrivateHop_class != NULL);
3812         LDKCandidateRouteHop_PrivateHop_meth = (*env)->GetMethodID(env, LDKCandidateRouteHop_PrivateHop_class, "<init>", "(J)V");
3813         CHECK(LDKCandidateRouteHop_PrivateHop_meth != NULL);
3814         LDKCandidateRouteHop_Blinded_class =
3815                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCandidateRouteHop$Blinded"));
3816         CHECK(LDKCandidateRouteHop_Blinded_class != NULL);
3817         LDKCandidateRouteHop_Blinded_meth = (*env)->GetMethodID(env, LDKCandidateRouteHop_Blinded_class, "<init>", "(J)V");
3818         CHECK(LDKCandidateRouteHop_Blinded_meth != NULL);
3819         LDKCandidateRouteHop_OneHopBlinded_class =
3820                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCandidateRouteHop$OneHopBlinded"));
3821         CHECK(LDKCandidateRouteHop_OneHopBlinded_class != NULL);
3822         LDKCandidateRouteHop_OneHopBlinded_meth = (*env)->GetMethodID(env, LDKCandidateRouteHop_OneHopBlinded_class, "<init>", "(J)V");
3823         CHECK(LDKCandidateRouteHop_OneHopBlinded_meth != NULL);
3824 }
3825 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCandidateRouteHop_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3826         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
3827         switch(obj->tag) {
3828                 case LDKCandidateRouteHop_FirstHop: {
3829                         LDKFirstHopCandidate first_hop_var = obj->first_hop;
3830                         int64_t first_hop_ref = 0;
3831                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hop_var);
3832                         first_hop_ref = tag_ptr(first_hop_var.inner, false);
3833                         return (*env)->NewObject(env, LDKCandidateRouteHop_FirstHop_class, LDKCandidateRouteHop_FirstHop_meth, first_hop_ref);
3834                 }
3835                 case LDKCandidateRouteHop_PublicHop: {
3836                         LDKPublicHopCandidate public_hop_var = obj->public_hop;
3837                         int64_t public_hop_ref = 0;
3838                         CHECK_INNER_FIELD_ACCESS_OR_NULL(public_hop_var);
3839                         public_hop_ref = tag_ptr(public_hop_var.inner, false);
3840                         return (*env)->NewObject(env, LDKCandidateRouteHop_PublicHop_class, LDKCandidateRouteHop_PublicHop_meth, public_hop_ref);
3841                 }
3842                 case LDKCandidateRouteHop_PrivateHop: {
3843                         LDKPrivateHopCandidate private_hop_var = obj->private_hop;
3844                         int64_t private_hop_ref = 0;
3845                         CHECK_INNER_FIELD_ACCESS_OR_NULL(private_hop_var);
3846                         private_hop_ref = tag_ptr(private_hop_var.inner, false);
3847                         return (*env)->NewObject(env, LDKCandidateRouteHop_PrivateHop_class, LDKCandidateRouteHop_PrivateHop_meth, private_hop_ref);
3848                 }
3849                 case LDKCandidateRouteHop_Blinded: {
3850                         LDKBlindedPathCandidate blinded_var = obj->blinded;
3851                         int64_t blinded_ref = 0;
3852                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_var);
3853                         blinded_ref = tag_ptr(blinded_var.inner, false);
3854                         return (*env)->NewObject(env, LDKCandidateRouteHop_Blinded_class, LDKCandidateRouteHop_Blinded_meth, blinded_ref);
3855                 }
3856                 case LDKCandidateRouteHop_OneHopBlinded: {
3857                         LDKOneHopBlindedPathCandidate one_hop_blinded_var = obj->one_hop_blinded;
3858                         int64_t one_hop_blinded_ref = 0;
3859                         CHECK_INNER_FIELD_ACCESS_OR_NULL(one_hop_blinded_var);
3860                         one_hop_blinded_ref = tag_ptr(one_hop_blinded_var.inner, false);
3861                         return (*env)->NewObject(env, LDKCandidateRouteHop_OneHopBlinded_class, LDKCandidateRouteHop_OneHopBlinded_meth, one_hop_blinded_ref);
3862                 }
3863                 default: abort();
3864         }
3865 }
3866 typedef struct LDKScoreLookUp_JCalls {
3867         atomic_size_t refcnt;
3868         JavaVM *vm;
3869         jweak o;
3870         jmethodID channel_penalty_msat_meth;
3871 } LDKScoreLookUp_JCalls;
3872 static void LDKScoreLookUp_JCalls_free(void* this_arg) {
3873         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) this_arg;
3874         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3875                 JNIEnv *env;
3876                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3877                 if (get_jenv_res == JNI_EDETACHED) {
3878                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3879                 } else {
3880                         DO_ASSERT(get_jenv_res == JNI_OK);
3881                 }
3882                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3883                 if (get_jenv_res == JNI_EDETACHED) {
3884                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3885                 }
3886                 FREE(j_calls);
3887         }
3888 }
3889 uint64_t channel_penalty_msat_LDKScoreLookUp_jcall(const void* this_arg, const LDKCandidateRouteHop * candidate, LDKChannelUsage usage, const LDKProbabilisticScoringFeeParameters * score_params) {
3890         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) this_arg;
3891         JNIEnv *env;
3892         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3893         if (get_jenv_res == JNI_EDETACHED) {
3894                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3895         } else {
3896                 DO_ASSERT(get_jenv_res == JNI_OK);
3897         }
3898         LDKCandidateRouteHop *ret_candidate = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop ret conversion");
3899         *ret_candidate = CandidateRouteHop_clone(candidate);
3900         int64_t ref_candidate = tag_ptr(ret_candidate, true);
3901         LDKChannelUsage usage_var = usage;
3902         int64_t usage_ref = 0;
3903         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
3904         usage_ref = tag_ptr(usage_var.inner, usage_var.is_owned);
3905         LDKProbabilisticScoringFeeParameters score_params_var = *score_params;
3906         int64_t score_params_ref = 0;
3907         score_params_var = ProbabilisticScoringFeeParameters_clone(&score_params_var);
3908         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_var);
3909         score_params_ref = tag_ptr(score_params_var.inner, score_params_var.is_owned);
3910         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3911         CHECK(obj != NULL);
3912         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->channel_penalty_msat_meth, ref_candidate, usage_ref, score_params_ref);
3913         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3914                 (*env)->ExceptionDescribe(env);
3915                 (*env)->FatalError(env, "A call to channel_penalty_msat in LDKScoreLookUp from rust threw an exception.");
3916         }
3917         if (get_jenv_res == JNI_EDETACHED) {
3918                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3919         }
3920         return ret;
3921 }
3922 static void LDKScoreLookUp_JCalls_cloned(LDKScoreLookUp* new_obj) {
3923         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) new_obj->this_arg;
3924         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3925 }
3926 static inline LDKScoreLookUp LDKScoreLookUp_init (JNIEnv *env, jclass clz, jobject o) {
3927         jclass c = (*env)->GetObjectClass(env, o);
3928         CHECK(c != NULL);
3929         LDKScoreLookUp_JCalls *calls = MALLOC(sizeof(LDKScoreLookUp_JCalls), "LDKScoreLookUp_JCalls");
3930         atomic_init(&calls->refcnt, 1);
3931         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3932         calls->o = (*env)->NewWeakGlobalRef(env, o);
3933         calls->channel_penalty_msat_meth = (*env)->GetMethodID(env, c, "channel_penalty_msat", "(JJJ)J");
3934         CHECK(calls->channel_penalty_msat_meth != NULL);
3935
3936         LDKScoreLookUp ret = {
3937                 .this_arg = (void*) calls,
3938                 .channel_penalty_msat = channel_penalty_msat_LDKScoreLookUp_jcall,
3939                 .free = LDKScoreLookUp_JCalls_free,
3940         };
3941         return ret;
3942 }
3943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScoreLookUp_1new(JNIEnv *env, jclass clz, jobject o) {
3944         LDKScoreLookUp *res_ptr = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
3945         *res_ptr = LDKScoreLookUp_init(env, clz, o);
3946         return tag_ptr(res_ptr, true);
3947 }
3948 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) {
3949         void* this_arg_ptr = untag_ptr(this_arg);
3950         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3951         LDKScoreLookUp* this_arg_conv = (LDKScoreLookUp*)this_arg_ptr;
3952         LDKCandidateRouteHop* candidate_conv = (LDKCandidateRouteHop*)untag_ptr(candidate);
3953         LDKChannelUsage usage_conv;
3954         usage_conv.inner = untag_ptr(usage);
3955         usage_conv.is_owned = ptr_is_owned(usage);
3956         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
3957         usage_conv = ChannelUsage_clone(&usage_conv);
3958         LDKProbabilisticScoringFeeParameters score_params_conv;
3959         score_params_conv.inner = untag_ptr(score_params);
3960         score_params_conv.is_owned = ptr_is_owned(score_params);
3961         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
3962         score_params_conv.is_owned = false;
3963         int64_t ret_conv = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, candidate_conv, usage_conv, &score_params_conv);
3964         return ret_conv;
3965 }
3966
3967 typedef struct LDKScoreUpdate_JCalls {
3968         atomic_size_t refcnt;
3969         JavaVM *vm;
3970         jweak o;
3971         jmethodID payment_path_failed_meth;
3972         jmethodID payment_path_successful_meth;
3973         jmethodID probe_failed_meth;
3974         jmethodID probe_successful_meth;
3975         jmethodID time_passed_meth;
3976 } LDKScoreUpdate_JCalls;
3977 static void LDKScoreUpdate_JCalls_free(void* this_arg) {
3978         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
3979         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3980                 JNIEnv *env;
3981                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3982                 if (get_jenv_res == JNI_EDETACHED) {
3983                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3984                 } else {
3985                         DO_ASSERT(get_jenv_res == JNI_OK);
3986                 }
3987                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3988                 if (get_jenv_res == JNI_EDETACHED) {
3989                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3990                 }
3991                 FREE(j_calls);
3992         }
3993 }
3994 void payment_path_failed_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id, uint64_t duration_since_epoch) {
3995         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
3996         JNIEnv *env;
3997         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3998         if (get_jenv_res == JNI_EDETACHED) {
3999                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4000         } else {
4001                 DO_ASSERT(get_jenv_res == JNI_OK);
4002         }
4003         LDKPath path_var = *path;
4004         int64_t path_ref = 0;
4005         path_var = Path_clone(&path_var);
4006         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
4007         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
4008         int64_t short_channel_id_conv = short_channel_id;
4009         int64_t duration_since_epoch_conv = duration_since_epoch;
4010         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4011         CHECK(obj != NULL);
4012         (*env)->CallVoidMethod(env, obj, j_calls->payment_path_failed_meth, path_ref, short_channel_id_conv, duration_since_epoch_conv);
4013         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4014                 (*env)->ExceptionDescribe(env);
4015                 (*env)->FatalError(env, "A call to payment_path_failed in LDKScoreUpdate from rust threw an exception.");
4016         }
4017         if (get_jenv_res == JNI_EDETACHED) {
4018                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4019         }
4020 }
4021 void payment_path_successful_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t duration_since_epoch) {
4022         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
4023         JNIEnv *env;
4024         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4025         if (get_jenv_res == JNI_EDETACHED) {
4026                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4027         } else {
4028                 DO_ASSERT(get_jenv_res == JNI_OK);
4029         }
4030         LDKPath path_var = *path;
4031         int64_t path_ref = 0;
4032         path_var = Path_clone(&path_var);
4033         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
4034         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
4035         int64_t duration_since_epoch_conv = duration_since_epoch;
4036         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4037         CHECK(obj != NULL);
4038         (*env)->CallVoidMethod(env, obj, j_calls->payment_path_successful_meth, path_ref, duration_since_epoch_conv);
4039         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4040                 (*env)->ExceptionDescribe(env);
4041                 (*env)->FatalError(env, "A call to payment_path_successful in LDKScoreUpdate from rust threw an exception.");
4042         }
4043         if (get_jenv_res == JNI_EDETACHED) {
4044                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4045         }
4046 }
4047 void probe_failed_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id, uint64_t duration_since_epoch) {
4048         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
4049         JNIEnv *env;
4050         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4051         if (get_jenv_res == JNI_EDETACHED) {
4052                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4053         } else {
4054                 DO_ASSERT(get_jenv_res == JNI_OK);
4055         }
4056         LDKPath path_var = *path;
4057         int64_t path_ref = 0;
4058         path_var = Path_clone(&path_var);
4059         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
4060         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
4061         int64_t short_channel_id_conv = short_channel_id;
4062         int64_t duration_since_epoch_conv = duration_since_epoch;
4063         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4064         CHECK(obj != NULL);
4065         (*env)->CallVoidMethod(env, obj, j_calls->probe_failed_meth, path_ref, short_channel_id_conv, duration_since_epoch_conv);
4066         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4067                 (*env)->ExceptionDescribe(env);
4068                 (*env)->FatalError(env, "A call to probe_failed in LDKScoreUpdate from rust threw an exception.");
4069         }
4070         if (get_jenv_res == JNI_EDETACHED) {
4071                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4072         }
4073 }
4074 void probe_successful_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t duration_since_epoch) {
4075         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
4076         JNIEnv *env;
4077         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4078         if (get_jenv_res == JNI_EDETACHED) {
4079                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4080         } else {
4081                 DO_ASSERT(get_jenv_res == JNI_OK);
4082         }
4083         LDKPath path_var = *path;
4084         int64_t path_ref = 0;
4085         path_var = Path_clone(&path_var);
4086         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
4087         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
4088         int64_t duration_since_epoch_conv = duration_since_epoch;
4089         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4090         CHECK(obj != NULL);
4091         (*env)->CallVoidMethod(env, obj, j_calls->probe_successful_meth, path_ref, duration_since_epoch_conv);
4092         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4093                 (*env)->ExceptionDescribe(env);
4094                 (*env)->FatalError(env, "A call to probe_successful in LDKScoreUpdate from rust threw an exception.");
4095         }
4096         if (get_jenv_res == JNI_EDETACHED) {
4097                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4098         }
4099 }
4100 void time_passed_LDKScoreUpdate_jcall(void* this_arg, uint64_t duration_since_epoch) {
4101         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
4102         JNIEnv *env;
4103         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4104         if (get_jenv_res == JNI_EDETACHED) {
4105                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4106         } else {
4107                 DO_ASSERT(get_jenv_res == JNI_OK);
4108         }
4109         int64_t duration_since_epoch_conv = duration_since_epoch;
4110         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4111         CHECK(obj != NULL);
4112         (*env)->CallVoidMethod(env, obj, j_calls->time_passed_meth, duration_since_epoch_conv);
4113         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4114                 (*env)->ExceptionDescribe(env);
4115                 (*env)->FatalError(env, "A call to time_passed in LDKScoreUpdate from rust threw an exception.");
4116         }
4117         if (get_jenv_res == JNI_EDETACHED) {
4118                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4119         }
4120 }
4121 static void LDKScoreUpdate_JCalls_cloned(LDKScoreUpdate* new_obj) {
4122         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) new_obj->this_arg;
4123         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4124 }
4125 static inline LDKScoreUpdate LDKScoreUpdate_init (JNIEnv *env, jclass clz, jobject o) {
4126         jclass c = (*env)->GetObjectClass(env, o);
4127         CHECK(c != NULL);
4128         LDKScoreUpdate_JCalls *calls = MALLOC(sizeof(LDKScoreUpdate_JCalls), "LDKScoreUpdate_JCalls");
4129         atomic_init(&calls->refcnt, 1);
4130         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4131         calls->o = (*env)->NewWeakGlobalRef(env, o);
4132         calls->payment_path_failed_meth = (*env)->GetMethodID(env, c, "payment_path_failed", "(JJJ)V");
4133         CHECK(calls->payment_path_failed_meth != NULL);
4134         calls->payment_path_successful_meth = (*env)->GetMethodID(env, c, "payment_path_successful", "(JJ)V");
4135         CHECK(calls->payment_path_successful_meth != NULL);
4136         calls->probe_failed_meth = (*env)->GetMethodID(env, c, "probe_failed", "(JJJ)V");
4137         CHECK(calls->probe_failed_meth != NULL);
4138         calls->probe_successful_meth = (*env)->GetMethodID(env, c, "probe_successful", "(JJ)V");
4139         CHECK(calls->probe_successful_meth != NULL);
4140         calls->time_passed_meth = (*env)->GetMethodID(env, c, "time_passed", "(J)V");
4141         CHECK(calls->time_passed_meth != NULL);
4142
4143         LDKScoreUpdate ret = {
4144                 .this_arg = (void*) calls,
4145                 .payment_path_failed = payment_path_failed_LDKScoreUpdate_jcall,
4146                 .payment_path_successful = payment_path_successful_LDKScoreUpdate_jcall,
4147                 .probe_failed = probe_failed_LDKScoreUpdate_jcall,
4148                 .probe_successful = probe_successful_LDKScoreUpdate_jcall,
4149                 .time_passed = time_passed_LDKScoreUpdate_jcall,
4150                 .free = LDKScoreUpdate_JCalls_free,
4151         };
4152         return ret;
4153 }
4154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScoreUpdate_1new(JNIEnv *env, jclass clz, jobject o) {
4155         LDKScoreUpdate *res_ptr = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
4156         *res_ptr = LDKScoreUpdate_init(env, clz, o);
4157         return tag_ptr(res_ptr, true);
4158 }
4159 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) {
4160         void* this_arg_ptr = untag_ptr(this_arg);
4161         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4162         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
4163         LDKPath path_conv;
4164         path_conv.inner = untag_ptr(path);
4165         path_conv.is_owned = ptr_is_owned(path);
4166         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
4167         path_conv.is_owned = false;
4168         (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id, duration_since_epoch);
4169 }
4170
4171 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) {
4172         void* this_arg_ptr = untag_ptr(this_arg);
4173         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4174         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
4175         LDKPath path_conv;
4176         path_conv.inner = untag_ptr(path);
4177         path_conv.is_owned = ptr_is_owned(path);
4178         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
4179         path_conv.is_owned = false;
4180         (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, &path_conv, duration_since_epoch);
4181 }
4182
4183 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) {
4184         void* this_arg_ptr = untag_ptr(this_arg);
4185         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4186         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
4187         LDKPath path_conv;
4188         path_conv.inner = untag_ptr(path);
4189         path_conv.is_owned = ptr_is_owned(path);
4190         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
4191         path_conv.is_owned = false;
4192         (this_arg_conv->probe_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id, duration_since_epoch);
4193 }
4194
4195 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) {
4196         void* this_arg_ptr = untag_ptr(this_arg);
4197         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4198         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
4199         LDKPath path_conv;
4200         path_conv.inner = untag_ptr(path);
4201         path_conv.is_owned = ptr_is_owned(path);
4202         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
4203         path_conv.is_owned = false;
4204         (this_arg_conv->probe_successful)(this_arg_conv->this_arg, &path_conv, duration_since_epoch);
4205 }
4206
4207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoreUpdate_1time_1passed(JNIEnv *env, jclass clz, int64_t this_arg, int64_t duration_since_epoch) {
4208         void* this_arg_ptr = untag_ptr(this_arg);
4209         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4210         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
4211         (this_arg_conv->time_passed)(this_arg_conv->this_arg, duration_since_epoch);
4212 }
4213
4214 typedef struct LDKLockableScore_JCalls {
4215         atomic_size_t refcnt;
4216         JavaVM *vm;
4217         jweak o;
4218         jmethodID read_lock_meth;
4219         jmethodID write_lock_meth;
4220 } LDKLockableScore_JCalls;
4221 static void LDKLockableScore_JCalls_free(void* this_arg) {
4222         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
4223         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4224                 JNIEnv *env;
4225                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4226                 if (get_jenv_res == JNI_EDETACHED) {
4227                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4228                 } else {
4229                         DO_ASSERT(get_jenv_res == JNI_OK);
4230                 }
4231                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4232                 if (get_jenv_res == JNI_EDETACHED) {
4233                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4234                 }
4235                 FREE(j_calls);
4236         }
4237 }
4238 LDKScoreLookUp read_lock_LDKLockableScore_jcall(const void* this_arg) {
4239         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
4240         JNIEnv *env;
4241         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4242         if (get_jenv_res == JNI_EDETACHED) {
4243                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4244         } else {
4245                 DO_ASSERT(get_jenv_res == JNI_OK);
4246         }
4247         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4248         CHECK(obj != NULL);
4249         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_lock_meth);
4250         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4251                 (*env)->ExceptionDescribe(env);
4252                 (*env)->FatalError(env, "A call to read_lock in LDKLockableScore from rust threw an exception.");
4253         }
4254         void* ret_ptr = untag_ptr(ret);
4255         CHECK_ACCESS(ret_ptr);
4256         LDKScoreLookUp ret_conv = *(LDKScoreLookUp*)(ret_ptr);
4257         if (ret_conv.free == LDKScoreLookUp_JCalls_free) {
4258                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4259                 LDKScoreLookUp_JCalls_cloned(&ret_conv);
4260         }// WARNING: we may need a move here but no clone is available for LDKScoreLookUp
4261         
4262         if (get_jenv_res == JNI_EDETACHED) {
4263                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4264         }
4265         return ret_conv;
4266 }
4267 LDKScoreUpdate write_lock_LDKLockableScore_jcall(const void* this_arg) {
4268         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
4269         JNIEnv *env;
4270         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4271         if (get_jenv_res == JNI_EDETACHED) {
4272                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4273         } else {
4274                 DO_ASSERT(get_jenv_res == JNI_OK);
4275         }
4276         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4277         CHECK(obj != NULL);
4278         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->write_lock_meth);
4279         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4280                 (*env)->ExceptionDescribe(env);
4281                 (*env)->FatalError(env, "A call to write_lock in LDKLockableScore from rust threw an exception.");
4282         }
4283         void* ret_ptr = untag_ptr(ret);
4284         CHECK_ACCESS(ret_ptr);
4285         LDKScoreUpdate ret_conv = *(LDKScoreUpdate*)(ret_ptr);
4286         if (ret_conv.free == LDKScoreUpdate_JCalls_free) {
4287                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4288                 LDKScoreUpdate_JCalls_cloned(&ret_conv);
4289         }// WARNING: we may need a move here but no clone is available for LDKScoreUpdate
4290         
4291         if (get_jenv_res == JNI_EDETACHED) {
4292                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4293         }
4294         return ret_conv;
4295 }
4296 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
4297         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
4298         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4299 }
4300 static inline LDKLockableScore LDKLockableScore_init (JNIEnv *env, jclass clz, jobject o) {
4301         jclass c = (*env)->GetObjectClass(env, o);
4302         CHECK(c != NULL);
4303         LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
4304         atomic_init(&calls->refcnt, 1);
4305         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4306         calls->o = (*env)->NewWeakGlobalRef(env, o);
4307         calls->read_lock_meth = (*env)->GetMethodID(env, c, "read_lock", "()J");
4308         CHECK(calls->read_lock_meth != NULL);
4309         calls->write_lock_meth = (*env)->GetMethodID(env, c, "write_lock", "()J");
4310         CHECK(calls->write_lock_meth != NULL);
4311
4312         LDKLockableScore ret = {
4313                 .this_arg = (void*) calls,
4314                 .read_lock = read_lock_LDKLockableScore_jcall,
4315                 .write_lock = write_lock_LDKLockableScore_jcall,
4316                 .free = LDKLockableScore_JCalls_free,
4317         };
4318         return ret;
4319 }
4320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLockableScore_1new(JNIEnv *env, jclass clz, jobject o) {
4321         LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
4322         *res_ptr = LDKLockableScore_init(env, clz, o);
4323         return tag_ptr(res_ptr, true);
4324 }
4325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockableScore_1read_1lock(JNIEnv *env, jclass clz, int64_t this_arg) {
4326         void* this_arg_ptr = untag_ptr(this_arg);
4327         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4328         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
4329         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
4330         *ret_ret = (this_arg_conv->read_lock)(this_arg_conv->this_arg);
4331         return tag_ptr(ret_ret, true);
4332 }
4333
4334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockableScore_1write_1lock(JNIEnv *env, jclass clz, int64_t this_arg) {
4335         void* this_arg_ptr = untag_ptr(this_arg);
4336         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4337         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
4338         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
4339         *ret_ret = (this_arg_conv->write_lock)(this_arg_conv->this_arg);
4340         return tag_ptr(ret_ret, true);
4341 }
4342
4343 typedef struct LDKWriteableScore_JCalls {
4344         atomic_size_t refcnt;
4345         JavaVM *vm;
4346         jweak o;
4347         LDKLockableScore_JCalls* LockableScore;
4348         jmethodID write_meth;
4349 } LDKWriteableScore_JCalls;
4350 static void LDKWriteableScore_JCalls_free(void* this_arg) {
4351         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
4352         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4353                 JNIEnv *env;
4354                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4355                 if (get_jenv_res == JNI_EDETACHED) {
4356                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4357                 } else {
4358                         DO_ASSERT(get_jenv_res == JNI_OK);
4359                 }
4360                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4361                 if (get_jenv_res == JNI_EDETACHED) {
4362                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4363                 }
4364                 FREE(j_calls);
4365         }
4366 }
4367 LDKCVec_u8Z write_LDKWriteableScore_jcall(const void* this_arg) {
4368         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
4369         JNIEnv *env;
4370         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4371         if (get_jenv_res == JNI_EDETACHED) {
4372                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4373         } else {
4374                 DO_ASSERT(get_jenv_res == JNI_OK);
4375         }
4376         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4377         CHECK(obj != NULL);
4378         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
4379         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4380                 (*env)->ExceptionDescribe(env);
4381                 (*env)->FatalError(env, "A call to write in LDKWriteableScore from rust threw an exception.");
4382         }
4383         LDKCVec_u8Z ret_ref;
4384         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
4385         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
4386         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
4387         if (get_jenv_res == JNI_EDETACHED) {
4388                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4389         }
4390         return ret_ref;
4391 }
4392 static void LDKWriteableScore_JCalls_cloned(LDKWriteableScore* new_obj) {
4393         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) new_obj->this_arg;
4394         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4395         atomic_fetch_add_explicit(&j_calls->LockableScore->refcnt, 1, memory_order_release);
4396 }
4397 static inline LDKWriteableScore LDKWriteableScore_init (JNIEnv *env, jclass clz, jobject o, jobject LockableScore) {
4398         jclass c = (*env)->GetObjectClass(env, o);
4399         CHECK(c != NULL);
4400         LDKWriteableScore_JCalls *calls = MALLOC(sizeof(LDKWriteableScore_JCalls), "LDKWriteableScore_JCalls");
4401         atomic_init(&calls->refcnt, 1);
4402         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4403         calls->o = (*env)->NewWeakGlobalRef(env, o);
4404         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
4405         CHECK(calls->write_meth != NULL);
4406
4407         LDKWriteableScore ret = {
4408                 .this_arg = (void*) calls,
4409                 .write = write_LDKWriteableScore_jcall,
4410                 .free = LDKWriteableScore_JCalls_free,
4411                 .LockableScore = LDKLockableScore_init(env, clz, LockableScore),
4412         };
4413         calls->LockableScore = ret.LockableScore.this_arg;
4414         return ret;
4415 }
4416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableScore_1new(JNIEnv *env, jclass clz, jobject o, jobject LockableScore) {
4417         LDKWriteableScore *res_ptr = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
4418         *res_ptr = LDKWriteableScore_init(env, clz, o, LockableScore);
4419         return tag_ptr(res_ptr, true);
4420 }
4421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableScore_1get_1LockableScore(JNIEnv *env, jclass clz, int64_t arg) {
4422         LDKWriteableScore *inp = (LDKWriteableScore *)untag_ptr(arg);
4423         return tag_ptr(&inp->LockableScore, false);
4424 }
4425 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WriteableScore_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
4426         void* this_arg_ptr = untag_ptr(this_arg);
4427         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4428         LDKWriteableScore* this_arg_conv = (LDKWriteableScore*)this_arg_ptr;
4429         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
4430         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
4431         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
4432         CVec_u8Z_free(ret_var);
4433         return ret_arr;
4434 }
4435
4436 static jclass LDKCOption_WriteableScoreZ_Some_class = NULL;
4437 static jmethodID LDKCOption_WriteableScoreZ_Some_meth = NULL;
4438 static jclass LDKCOption_WriteableScoreZ_None_class = NULL;
4439 static jmethodID LDKCOption_WriteableScoreZ_None_meth = NULL;
4440 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1WriteableScoreZ_init (JNIEnv *env, jclass clz) {
4441         LDKCOption_WriteableScoreZ_Some_class =
4442                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_WriteableScoreZ$Some"));
4443         CHECK(LDKCOption_WriteableScoreZ_Some_class != NULL);
4444         LDKCOption_WriteableScoreZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_WriteableScoreZ_Some_class, "<init>", "(J)V");
4445         CHECK(LDKCOption_WriteableScoreZ_Some_meth != NULL);
4446         LDKCOption_WriteableScoreZ_None_class =
4447                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_WriteableScoreZ$None"));
4448         CHECK(LDKCOption_WriteableScoreZ_None_class != NULL);
4449         LDKCOption_WriteableScoreZ_None_meth = (*env)->GetMethodID(env, LDKCOption_WriteableScoreZ_None_class, "<init>", "()V");
4450         CHECK(LDKCOption_WriteableScoreZ_None_meth != NULL);
4451 }
4452 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1WriteableScoreZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4453         LDKCOption_WriteableScoreZ *obj = (LDKCOption_WriteableScoreZ*)untag_ptr(ptr);
4454         switch(obj->tag) {
4455                 case LDKCOption_WriteableScoreZ_Some: {
4456                         LDKWriteableScore* some_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
4457                         *some_ret = obj->some;
4458                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
4459                         if ((*some_ret).free == LDKWriteableScore_JCalls_free) {
4460                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4461                                 LDKWriteableScore_JCalls_cloned(&(*some_ret));
4462                         }
4463                         return (*env)->NewObject(env, LDKCOption_WriteableScoreZ_Some_class, LDKCOption_WriteableScoreZ_Some_meth, tag_ptr(some_ret, true));
4464                 }
4465                 case LDKCOption_WriteableScoreZ_None: {
4466                         return (*env)->NewObject(env, LDKCOption_WriteableScoreZ_None_class, LDKCOption_WriteableScoreZ_None_meth);
4467                 }
4468                 default: abort();
4469         }
4470 }
4471 static inline void CResult_NoneIOErrorZ_get_ok(LDKCResult_NoneIOErrorZ *NONNULL_PTR owner){
4472 CHECK(owner->result_ok);
4473         return *owner->contents.result;
4474 }
4475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4476         LDKCResult_NoneIOErrorZ* owner_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(owner);
4477         CResult_NoneIOErrorZ_get_ok(owner_conv);
4478 }
4479
4480 static inline enum LDKIOError CResult_NoneIOErrorZ_get_err(LDKCResult_NoneIOErrorZ *NONNULL_PTR owner){
4481 CHECK(!owner->result_ok);
4482         return *owner->contents.err;
4483 }
4484 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4485         LDKCResult_NoneIOErrorZ* owner_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(owner);
4486         jclass ret_conv = LDKIOError_to_java(env, CResult_NoneIOErrorZ_get_err(owner_conv));
4487         return ret_conv;
4488 }
4489
4490 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
4491         LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
4492         for (size_t i = 0; i < ret.datalen; i++) {
4493                 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
4494         }
4495         return ret;
4496 }
4497 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
4498         LDKRoute ret = *owner->contents.result;
4499         ret.is_owned = false;
4500         return ret;
4501 }
4502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4503         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
4504         LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
4505         int64_t ret_ref = 0;
4506         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4507         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4508         return ret_ref;
4509 }
4510
4511 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
4512         LDKLightningError ret = *owner->contents.err;
4513         ret.is_owned = false;
4514         return ret;
4515 }
4516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4517         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
4518         LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
4519         int64_t ret_ref = 0;
4520         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4521         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4522         return ret_ref;
4523 }
4524
4525 static inline struct LDKBlindedPayInfo C2Tuple_BlindedPayInfoBlindedPathZ_get_a(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
4526         LDKBlindedPayInfo ret = owner->a;
4527         ret.is_owned = false;
4528         return ret;
4529 }
4530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4531         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
4532         LDKBlindedPayInfo ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_a(owner_conv);
4533         int64_t ret_ref = 0;
4534         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4535         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4536         return ret_ref;
4537 }
4538
4539 static inline struct LDKBlindedPath C2Tuple_BlindedPayInfoBlindedPathZ_get_b(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
4540         LDKBlindedPath ret = owner->b;
4541         ret.is_owned = false;
4542         return ret;
4543 }
4544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4545         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
4546         LDKBlindedPath ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_b(owner_conv);
4547         int64_t ret_ref = 0;
4548         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4549         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4550         return ret_ref;
4551 }
4552
4553 static inline LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_clone(const LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ *orig) {
4554         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ) * orig->datalen, "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ clone bytes"), .datalen = orig->datalen };
4555         for (size_t i = 0; i < ret.datalen; i++) {
4556                 ret.data[i] = C2Tuple_BlindedPayInfoBlindedPathZ_clone(&orig->data[i]);
4557         }
4558         return ret;
4559 }
4560 static inline struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_ok(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ *NONNULL_PTR owner){
4561 CHECK(owner->result_ok);
4562         return CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_clone(&*owner->contents.result);
4563 }
4564 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4565         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(owner);
4566         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ ret_var = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_ok(owner_conv);
4567         int64_tArray ret_arr = NULL;
4568         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
4569         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
4570         for (size_t l = 0; l < ret_var.datalen; l++) {
4571                 LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv_37_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
4572                 *ret_conv_37_conv = ret_var.data[l];
4573                 ret_arr_ptr[l] = tag_ptr(ret_conv_37_conv, true);
4574         }
4575         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
4576         FREE(ret_var.data);
4577         return ret_arr;
4578 }
4579
4580 static inline void CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_err(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ *NONNULL_PTR owner){
4581 CHECK(!owner->result_ok);
4582         return *owner->contents.err;
4583 }
4584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4585         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(owner);
4586         CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_err(owner_conv);
4587 }
4588
4589 static inline struct LDKOnionMessagePath CResult_OnionMessagePathNoneZ_get_ok(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
4590         LDKOnionMessagePath ret = *owner->contents.result;
4591         ret.is_owned = false;
4592         return ret;
4593 }
4594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4595         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
4596         LDKOnionMessagePath ret_var = CResult_OnionMessagePathNoneZ_get_ok(owner_conv);
4597         int64_t ret_ref = 0;
4598         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4599         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4600         return ret_ref;
4601 }
4602
4603 static inline void CResult_OnionMessagePathNoneZ_get_err(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
4604 CHECK(!owner->result_ok);
4605         return *owner->contents.err;
4606 }
4607 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4608         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
4609         CResult_OnionMessagePathNoneZ_get_err(owner_conv);
4610 }
4611
4612 static inline struct LDKCVec_BlindedPathZ CResult_CVec_BlindedPathZNoneZ_get_ok(LDKCResult_CVec_BlindedPathZNoneZ *NONNULL_PTR owner){
4613 CHECK(owner->result_ok);
4614         return CVec_BlindedPathZ_clone(&*owner->contents.result);
4615 }
4616 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1BlindedPathZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4617         LDKCResult_CVec_BlindedPathZNoneZ* owner_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(owner);
4618         LDKCVec_BlindedPathZ ret_var = CResult_CVec_BlindedPathZNoneZ_get_ok(owner_conv);
4619         int64_tArray ret_arr = NULL;
4620         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
4621         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
4622         for (size_t n = 0; n < ret_var.datalen; n++) {
4623                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
4624                 int64_t ret_conv_13_ref = 0;
4625                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
4626                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
4627                 ret_arr_ptr[n] = ret_conv_13_ref;
4628         }
4629         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
4630         FREE(ret_var.data);
4631         return ret_arr;
4632 }
4633
4634 static inline void CResult_CVec_BlindedPathZNoneZ_get_err(LDKCResult_CVec_BlindedPathZNoneZ *NONNULL_PTR owner){
4635 CHECK(!owner->result_ok);
4636         return *owner->contents.err;
4637 }
4638 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1BlindedPathZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4639         LDKCResult_CVec_BlindedPathZNoneZ* owner_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(owner);
4640         CResult_CVec_BlindedPathZNoneZ_get_err(owner_conv);
4641 }
4642
4643 static inline struct LDKInFlightHtlcs CResult_InFlightHtlcsDecodeErrorZ_get_ok(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
4644         LDKInFlightHtlcs ret = *owner->contents.result;
4645         ret.is_owned = false;
4646         return ret;
4647 }
4648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4649         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
4650         LDKInFlightHtlcs ret_var = CResult_InFlightHtlcsDecodeErrorZ_get_ok(owner_conv);
4651         int64_t ret_ref = 0;
4652         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4653         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4654         return ret_ref;
4655 }
4656
4657 static inline struct LDKDecodeError CResult_InFlightHtlcsDecodeErrorZ_get_err(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
4658 CHECK(!owner->result_ok);
4659         return DecodeError_clone(&*owner->contents.err);
4660 }
4661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4662         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
4663         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4664         *ret_copy = CResult_InFlightHtlcsDecodeErrorZ_get_err(owner_conv);
4665         int64_t ret_ref = tag_ptr(ret_copy, true);
4666         return ret_ref;
4667 }
4668
4669 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
4670         LDKRouteHop ret = *owner->contents.result;
4671         ret.is_owned = false;
4672         return ret;
4673 }
4674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4675         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
4676         LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
4677         int64_t ret_ref = 0;
4678         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4679         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4680         return ret_ref;
4681 }
4682
4683 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
4684 CHECK(!owner->result_ok);
4685         return DecodeError_clone(&*owner->contents.err);
4686 }
4687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4688         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
4689         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4690         *ret_copy = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
4691         int64_t ret_ref = tag_ptr(ret_copy, true);
4692         return ret_ref;
4693 }
4694
4695 static inline LDKCVec_BlindedHopZ CVec_BlindedHopZ_clone(const LDKCVec_BlindedHopZ *orig) {
4696         LDKCVec_BlindedHopZ ret = { .data = MALLOC(sizeof(LDKBlindedHop) * orig->datalen, "LDKCVec_BlindedHopZ clone bytes"), .datalen = orig->datalen };
4697         for (size_t i = 0; i < ret.datalen; i++) {
4698                 ret.data[i] = BlindedHop_clone(&orig->data[i]);
4699         }
4700         return ret;
4701 }
4702 static inline struct LDKBlindedTail CResult_BlindedTailDecodeErrorZ_get_ok(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
4703         LDKBlindedTail ret = *owner->contents.result;
4704         ret.is_owned = false;
4705         return ret;
4706 }
4707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4708         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
4709         LDKBlindedTail ret_var = CResult_BlindedTailDecodeErrorZ_get_ok(owner_conv);
4710         int64_t ret_ref = 0;
4711         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4712         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4713         return ret_ref;
4714 }
4715
4716 static inline struct LDKDecodeError CResult_BlindedTailDecodeErrorZ_get_err(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
4717 CHECK(!owner->result_ok);
4718         return DecodeError_clone(&*owner->contents.err);
4719 }
4720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4721         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
4722         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4723         *ret_copy = CResult_BlindedTailDecodeErrorZ_get_err(owner_conv);
4724         int64_t ret_ref = tag_ptr(ret_copy, true);
4725         return ret_ref;
4726 }
4727
4728 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
4729         LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
4730         for (size_t i = 0; i < ret.datalen; i++) {
4731                 ret.data[i] = RouteHop_clone(&orig->data[i]);
4732         }
4733         return ret;
4734 }
4735 static inline LDKCVec_PathZ CVec_PathZ_clone(const LDKCVec_PathZ *orig) {
4736         LDKCVec_PathZ ret = { .data = MALLOC(sizeof(LDKPath) * orig->datalen, "LDKCVec_PathZ clone bytes"), .datalen = orig->datalen };
4737         for (size_t i = 0; i < ret.datalen; i++) {
4738                 ret.data[i] = Path_clone(&orig->data[i]);
4739         }
4740         return ret;
4741 }
4742 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
4743         LDKRoute ret = *owner->contents.result;
4744         ret.is_owned = false;
4745         return ret;
4746 }
4747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4748         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
4749         LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
4750         int64_t ret_ref = 0;
4751         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4752         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4753         return ret_ref;
4754 }
4755
4756 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
4757 CHECK(!owner->result_ok);
4758         return DecodeError_clone(&*owner->contents.err);
4759 }
4760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4761         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
4762         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4763         *ret_copy = CResult_RouteDecodeErrorZ_get_err(owner_conv);
4764         int64_t ret_ref = tag_ptr(ret_copy, true);
4765         return ret_ref;
4766 }
4767
4768 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
4769         LDKRouteParameters ret = *owner->contents.result;
4770         ret.is_owned = false;
4771         return ret;
4772 }
4773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4774         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
4775         LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
4776         int64_t ret_ref = 0;
4777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4779         return ret_ref;
4780 }
4781
4782 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
4783 CHECK(!owner->result_ok);
4784         return DecodeError_clone(&*owner->contents.err);
4785 }
4786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4787         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
4788         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4789         *ret_copy = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
4790         int64_t ret_ref = tag_ptr(ret_copy, true);
4791         return ret_ref;
4792 }
4793
4794 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
4795         LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
4796         memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
4797         return ret;
4798 }
4799 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
4800         LDKPaymentParameters ret = *owner->contents.result;
4801         ret.is_owned = false;
4802         return ret;
4803 }
4804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4805         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
4806         LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
4807         int64_t ret_ref = 0;
4808         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4809         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4810         return ret_ref;
4811 }
4812
4813 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
4814 CHECK(!owner->result_ok);
4815         return DecodeError_clone(&*owner->contents.err);
4816 }
4817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4818         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
4819         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4820         *ret_copy = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
4821         int64_t ret_ref = tag_ptr(ret_copy, true);
4822         return ret_ref;
4823 }
4824
4825 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
4826         LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
4827         for (size_t i = 0; i < ret.datalen; i++) {
4828                 ret.data[i] = RouteHint_clone(&orig->data[i]);
4829         }
4830         return ret;
4831 }
4832 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
4833         LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
4834         for (size_t i = 0; i < ret.datalen; i++) {
4835                 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
4836         }
4837         return ret;
4838 }
4839 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
4840         LDKRouteHint ret = *owner->contents.result;
4841         ret.is_owned = false;
4842         return ret;
4843 }
4844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4845         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
4846         LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
4847         int64_t ret_ref = 0;
4848         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4849         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4850         return ret_ref;
4851 }
4852
4853 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
4854 CHECK(!owner->result_ok);
4855         return DecodeError_clone(&*owner->contents.err);
4856 }
4857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4858         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
4859         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4860         *ret_copy = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
4861         int64_t ret_ref = tag_ptr(ret_copy, true);
4862         return ret_ref;
4863 }
4864
4865 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
4866         LDKRouteHintHop ret = *owner->contents.result;
4867         ret.is_owned = false;
4868         return ret;
4869 }
4870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4871         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
4872         LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
4873         int64_t ret_ref = 0;
4874         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4875         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4876         return ret_ref;
4877 }
4878
4879 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
4880 CHECK(!owner->result_ok);
4881         return DecodeError_clone(&*owner->contents.err);
4882 }
4883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4884         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
4885         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4886         *ret_copy = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
4887         int64_t ret_ref = tag_ptr(ret_copy, true);
4888         return ret_ref;
4889 }
4890
4891 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
4892         LDKFixedPenaltyScorer ret = *owner->contents.result;
4893         ret.is_owned = false;
4894         return ret;
4895 }
4896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4897         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
4898         LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
4899         int64_t ret_ref = 0;
4900         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4901         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4902         return ret_ref;
4903 }
4904
4905 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
4906 CHECK(!owner->result_ok);
4907         return DecodeError_clone(&*owner->contents.err);
4908 }
4909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4910         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
4911         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4912         *ret_copy = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
4913         int64_t ret_ref = tag_ptr(ret_copy, true);
4914         return ret_ref;
4915 }
4916
4917 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
4918         LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
4919         for (size_t i = 0; i < ret.datalen; i++) {
4920                 ret.data[i] = NodeId_clone(&orig->data[i]);
4921         }
4922         return ret;
4923 }
4924 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
4925         return owner->a;
4926 }
4927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4928         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
4929         int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
4930         return ret_conv;
4931 }
4932
4933 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
4934         return owner->b;
4935 }
4936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4937         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
4938         int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
4939         return ret_conv;
4940 }
4941
4942 static jclass LDKCOption_C2Tuple_u64u64ZZ_Some_class = NULL;
4943 static jmethodID LDKCOption_C2Tuple_u64u64ZZ_Some_meth = NULL;
4944 static jclass LDKCOption_C2Tuple_u64u64ZZ_None_class = NULL;
4945 static jmethodID LDKCOption_C2Tuple_u64u64ZZ_None_meth = NULL;
4946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1u64u64ZZ_init (JNIEnv *env, jclass clz) {
4947         LDKCOption_C2Tuple_u64u64ZZ_Some_class =
4948                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u64ZZ$Some"));
4949         CHECK(LDKCOption_C2Tuple_u64u64ZZ_Some_class != NULL);
4950         LDKCOption_C2Tuple_u64u64ZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u64ZZ_Some_class, "<init>", "(J)V");
4951         CHECK(LDKCOption_C2Tuple_u64u64ZZ_Some_meth != NULL);
4952         LDKCOption_C2Tuple_u64u64ZZ_None_class =
4953                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u64ZZ$None"));
4954         CHECK(LDKCOption_C2Tuple_u64u64ZZ_None_class != NULL);
4955         LDKCOption_C2Tuple_u64u64ZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u64ZZ_None_class, "<init>", "()V");
4956         CHECK(LDKCOption_C2Tuple_u64u64ZZ_None_meth != NULL);
4957 }
4958 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1u64u64ZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4959         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
4960         switch(obj->tag) {
4961                 case LDKCOption_C2Tuple_u64u64ZZ_Some: {
4962                         LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
4963                         *some_conv = obj->some;
4964                         *some_conv = C2Tuple_u64u64Z_clone(some_conv);
4965                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u64ZZ_Some_class, LDKCOption_C2Tuple_u64u64ZZ_Some_meth, tag_ptr(some_conv, true));
4966                 }
4967                 case LDKCOption_C2Tuple_u64u64ZZ_None: {
4968                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u64ZZ_None_class, LDKCOption_C2Tuple_u64u64ZZ_None_meth);
4969                 }
4970                 default: abort();
4971         }
4972 }
4973 static inline struct LDKThirtyTwoU16s C2Tuple_Z_get_a(LDKC2Tuple_Z *NONNULL_PTR owner){
4974         return owner->a;
4975 }
4976 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4977         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
4978         int16_tArray ret_arr = (*env)->NewShortArray(env, 32);
4979         (*env)->SetShortArrayRegion(env, ret_arr, 0, 32, C2Tuple_Z_get_a(owner_conv).data);
4980         return ret_arr;
4981 }
4982
4983 static inline struct LDKThirtyTwoU16s C2Tuple_Z_get_b(LDKC2Tuple_Z *NONNULL_PTR owner){
4984         return owner->b;
4985 }
4986 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4987         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
4988         int16_tArray ret_arr = (*env)->NewShortArray(env, 32);
4989         (*env)->SetShortArrayRegion(env, ret_arr, 0, 32, C2Tuple_Z_get_b(owner_conv).data);
4990         return ret_arr;
4991 }
4992
4993 static inline struct LDKThirtyTwoU16s C2Tuple__u1632_u1632Z_get_a(LDKC2Tuple__u1632_u1632Z *NONNULL_PTR owner){
4994         return owner->a;
4995 }
4996 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u1632_1u1632Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4997         LDKC2Tuple__u1632_u1632Z* owner_conv = (LDKC2Tuple__u1632_u1632Z*)untag_ptr(owner);
4998         int16_tArray ret_arr = (*env)->NewShortArray(env, 32);
4999         (*env)->SetShortArrayRegion(env, ret_arr, 0, 32, C2Tuple__u1632_u1632Z_get_a(owner_conv).data);
5000         return ret_arr;
5001 }
5002
5003 static inline struct LDKThirtyTwoU16s C2Tuple__u1632_u1632Z_get_b(LDKC2Tuple__u1632_u1632Z *NONNULL_PTR owner){
5004         return owner->b;
5005 }
5006 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u1632_1u1632Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5007         LDKC2Tuple__u1632_u1632Z* owner_conv = (LDKC2Tuple__u1632_u1632Z*)untag_ptr(owner);
5008         int16_tArray ret_arr = (*env)->NewShortArray(env, 32);
5009         (*env)->SetShortArrayRegion(env, ret_arr, 0, 32, C2Tuple__u1632_u1632Z_get_b(owner_conv).data);
5010         return ret_arr;
5011 }
5012
5013 static jclass LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_class = NULL;
5014 static jmethodID LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_meth = NULL;
5015 static jclass LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_class = NULL;
5016 static jmethodID LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_meth = NULL;
5017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1ThirtyTwoU16sThirtyTwoU16sZZ_init (JNIEnv *env, jclass clz) {
5018         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_class =
5019                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ$Some"));
5020         CHECK(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_class != NULL);
5021         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_class, "<init>", "(J)V");
5022         CHECK(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_meth != NULL);
5023         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_class =
5024                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ$None"));
5025         CHECK(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_class != NULL);
5026         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_class, "<init>", "()V");
5027         CHECK(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_meth != NULL);
5028 }
5029 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1ThirtyTwoU16sThirtyTwoU16sZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5030         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *obj = (LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)untag_ptr(ptr);
5031         switch(obj->tag) {
5032                 case LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some: {
5033                         LDKC2Tuple__u1632_u1632Z* some_conv = &obj->some;
5034                         // WARNING: we really need to clone here, but no clone is available for LDKC2Tuple__u1632_u1632Z
5035                         return (*env)->NewObject(env, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_class, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_meth, tag_ptr(some_conv, false));
5036                 }
5037                 case LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None: {
5038                         return (*env)->NewObject(env, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_class, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_meth);
5039                 }
5040                 default: abort();
5041         }
5042 }
5043 static jclass LDKCOption_f64Z_Some_class = NULL;
5044 static jmethodID LDKCOption_f64Z_Some_meth = NULL;
5045 static jclass LDKCOption_f64Z_None_class = NULL;
5046 static jmethodID LDKCOption_f64Z_None_meth = NULL;
5047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1f64Z_init (JNIEnv *env, jclass clz) {
5048         LDKCOption_f64Z_Some_class =
5049                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_f64Z$Some"));
5050         CHECK(LDKCOption_f64Z_Some_class != NULL);
5051         LDKCOption_f64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_f64Z_Some_class, "<init>", "(D)V");
5052         CHECK(LDKCOption_f64Z_Some_meth != NULL);
5053         LDKCOption_f64Z_None_class =
5054                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_f64Z$None"));
5055         CHECK(LDKCOption_f64Z_None_class != NULL);
5056         LDKCOption_f64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_f64Z_None_class, "<init>", "()V");
5057         CHECK(LDKCOption_f64Z_None_meth != NULL);
5058 }
5059 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1f64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5060         LDKCOption_f64Z *obj = (LDKCOption_f64Z*)untag_ptr(ptr);
5061         switch(obj->tag) {
5062                 case LDKCOption_f64Z_Some: {
5063                         double some_conv = obj->some;
5064                         return (*env)->NewObject(env, LDKCOption_f64Z_Some_class, LDKCOption_f64Z_Some_meth, some_conv);
5065                 }
5066                 case LDKCOption_f64Z_None: {
5067                         return (*env)->NewObject(env, LDKCOption_f64Z_None_class, LDKCOption_f64Z_None_meth);
5068                 }
5069                 default: abort();
5070         }
5071 }
5072 typedef struct LDKLogger_JCalls {
5073         atomic_size_t refcnt;
5074         JavaVM *vm;
5075         jweak o;
5076         jmethodID log_meth;
5077 } LDKLogger_JCalls;
5078 static void LDKLogger_JCalls_free(void* this_arg) {
5079         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
5080         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5081                 JNIEnv *env;
5082                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5083                 if (get_jenv_res == JNI_EDETACHED) {
5084                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5085                 } else {
5086                         DO_ASSERT(get_jenv_res == JNI_OK);
5087                 }
5088                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5089                 if (get_jenv_res == JNI_EDETACHED) {
5090                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5091                 }
5092                 FREE(j_calls);
5093         }
5094 }
5095 void log_LDKLogger_jcall(const void* this_arg, LDKRecord record) {
5096         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
5097         JNIEnv *env;
5098         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5099         if (get_jenv_res == JNI_EDETACHED) {
5100                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5101         } else {
5102                 DO_ASSERT(get_jenv_res == JNI_OK);
5103         }
5104         LDKRecord record_var = record;
5105         int64_t record_ref = 0;
5106         CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
5107         record_ref = tag_ptr(record_var.inner, record_var.is_owned);
5108         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5109         CHECK(obj != NULL);
5110         (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_ref);
5111         if (UNLIKELY((*env)->ExceptionCheck(env))) {
5112                 (*env)->ExceptionDescribe(env);
5113                 (*env)->FatalError(env, "A call to log in LDKLogger from rust threw an exception.");
5114         }
5115         if (get_jenv_res == JNI_EDETACHED) {
5116                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5117         }
5118 }
5119 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
5120         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
5121         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5122 }
5123 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
5124         jclass c = (*env)->GetObjectClass(env, o);
5125         CHECK(c != NULL);
5126         LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
5127         atomic_init(&calls->refcnt, 1);
5128         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5129         calls->o = (*env)->NewWeakGlobalRef(env, o);
5130         calls->log_meth = (*env)->GetMethodID(env, c, "log", "(J)V");
5131         CHECK(calls->log_meth != NULL);
5132
5133         LDKLogger ret = {
5134                 .this_arg = (void*) calls,
5135                 .log = log_LDKLogger_jcall,
5136                 .free = LDKLogger_JCalls_free,
5137         };
5138         return ret;
5139 }
5140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
5141         LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
5142         *res_ptr = LDKLogger_init(env, clz, o);
5143         return tag_ptr(res_ptr, true);
5144 }
5145 static inline struct LDKProbabilisticScorer CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
5146         LDKProbabilisticScorer ret = *owner->contents.result;
5147         ret.is_owned = false;
5148         return ret;
5149 }
5150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5151         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
5152         LDKProbabilisticScorer ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
5153         int64_t ret_ref = 0;
5154         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5155         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5156         return ret_ref;
5157 }
5158
5159 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
5160 CHECK(!owner->result_ok);
5161         return DecodeError_clone(&*owner->contents.err);
5162 }
5163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5164         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
5165         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5166         *ret_copy = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
5167         int64_t ret_ref = tag_ptr(ret_copy, true);
5168         return ret_ref;
5169 }
5170
5171 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
5172         return owner->a;
5173 }
5174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5175         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
5176         int64_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
5177         return ret_conv;
5178 }
5179
5180 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
5181         return owner->b;
5182 }
5183 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5184         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
5185         LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
5186         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
5187         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
5188         return ret_arr;
5189 }
5190
5191 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
5192         LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
5193         for (size_t i = 0; i < ret.datalen; i++) {
5194                 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
5195         }
5196         return ret;
5197 }
5198 static inline struct LDKThirtyTwoBytes C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_a(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
5199         return ThirtyTwoBytes_clone(&owner->a);
5200 }
5201 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesu32COption_1ThirtyTwoBytesZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5202         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(owner);
5203         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5204         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_a(owner_conv).data);
5205         return ret_arr;
5206 }
5207
5208 static inline uint32_t C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_b(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
5209         return owner->b;
5210 }
5211 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesu32COption_1ThirtyTwoBytesZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5212         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(owner);
5213         int32_t ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_b(owner_conv);
5214         return ret_conv;
5215 }
5216
5217 static inline struct LDKCOption_ThirtyTwoBytesZ C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_c(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
5218         return COption_ThirtyTwoBytesZ_clone(&owner->c);
5219 }
5220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesu32COption_1ThirtyTwoBytesZZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
5221         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(owner);
5222         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
5223         *ret_copy = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_c(owner_conv);
5224         int64_t ret_ref = tag_ptr(ret_copy, true);
5225         return ret_ref;
5226 }
5227
5228 static inline LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_clone(const LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ *orig) {
5229         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ) * orig->datalen, "LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ clone bytes"), .datalen = orig->datalen };
5230         for (size_t i = 0; i < ret.datalen; i++) {
5231                 ret.data[i] = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(&orig->data[i]);
5232         }
5233         return ret;
5234 }
5235 static inline enum LDKChannelMonitorUpdateStatus CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR owner){
5236 CHECK(owner->result_ok);
5237         return ChannelMonitorUpdateStatus_clone(&*owner->contents.result);
5238 }
5239 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5240         LDKCResult_ChannelMonitorUpdateStatusNoneZ* owner_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(owner);
5241         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(owner_conv));
5242         return ret_conv;
5243 }
5244
5245 static inline void CResult_ChannelMonitorUpdateStatusNoneZ_get_err(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR owner){
5246 CHECK(!owner->result_ok);
5247         return *owner->contents.err;
5248 }
5249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5250         LDKCResult_ChannelMonitorUpdateStatusNoneZ* owner_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(owner);
5251         CResult_ChannelMonitorUpdateStatusNoneZ_get_err(owner_conv);
5252 }
5253
5254 static jclass LDKMonitorEvent_HTLCEvent_class = NULL;
5255 static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL;
5256 static jclass LDKMonitorEvent_HolderForceClosed_class = NULL;
5257 static jmethodID LDKMonitorEvent_HolderForceClosed_meth = NULL;
5258 static jclass LDKMonitorEvent_Completed_class = NULL;
5259 static jmethodID LDKMonitorEvent_Completed_meth = NULL;
5260 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) {
5261         LDKMonitorEvent_HTLCEvent_class =
5262                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent"));
5263         CHECK(LDKMonitorEvent_HTLCEvent_class != NULL);
5264         LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "<init>", "(J)V");
5265         CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL);
5266         LDKMonitorEvent_HolderForceClosed_class =
5267                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$HolderForceClosed"));
5268         CHECK(LDKMonitorEvent_HolderForceClosed_class != NULL);
5269         LDKMonitorEvent_HolderForceClosed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HolderForceClosed_class, "<init>", "(J)V");
5270         CHECK(LDKMonitorEvent_HolderForceClosed_meth != NULL);
5271         LDKMonitorEvent_Completed_class =
5272                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$Completed"));
5273         CHECK(LDKMonitorEvent_Completed_class != NULL);
5274         LDKMonitorEvent_Completed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_Completed_class, "<init>", "(JJ)V");
5275         CHECK(LDKMonitorEvent_Completed_meth != NULL);
5276 }
5277 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5278         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
5279         switch(obj->tag) {
5280                 case LDKMonitorEvent_HTLCEvent: {
5281                         LDKHTLCUpdate htlc_event_var = obj->htlc_event;
5282                         int64_t htlc_event_ref = 0;
5283                         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
5284                         htlc_event_ref = tag_ptr(htlc_event_var.inner, false);
5285                         return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth, htlc_event_ref);
5286                 }
5287                 case LDKMonitorEvent_HolderForceClosed: {
5288                         LDKOutPoint holder_force_closed_var = obj->holder_force_closed;
5289                         int64_t holder_force_closed_ref = 0;
5290                         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_force_closed_var);
5291                         holder_force_closed_ref = tag_ptr(holder_force_closed_var.inner, false);
5292                         return (*env)->NewObject(env, LDKMonitorEvent_HolderForceClosed_class, LDKMonitorEvent_HolderForceClosed_meth, holder_force_closed_ref);
5293                 }
5294                 case LDKMonitorEvent_Completed: {
5295                         LDKOutPoint funding_txo_var = obj->completed.funding_txo;
5296                         int64_t funding_txo_ref = 0;
5297                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5298                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
5299                         int64_t monitor_update_id_conv = obj->completed.monitor_update_id;
5300                         return (*env)->NewObject(env, LDKMonitorEvent_Completed_class, LDKMonitorEvent_Completed_meth, funding_txo_ref, monitor_update_id_conv);
5301                 }
5302                 default: abort();
5303         }
5304 }
5305 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
5306         LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
5307         for (size_t i = 0; i < ret.datalen; i++) {
5308                 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
5309         }
5310         return ret;
5311 }
5312 static inline struct LDKOutPoint C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
5313         LDKOutPoint ret = owner->a;
5314         ret.is_owned = false;
5315         return ret;
5316 }
5317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5318         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
5319         LDKOutPoint ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(owner_conv);
5320         int64_t ret_ref = 0;
5321         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5322         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5323         return ret_ref;
5324 }
5325
5326 static inline struct LDKCVec_MonitorEventZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
5327         return CVec_MonitorEventZ_clone(&owner->b);
5328 }
5329 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5330         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
5331         LDKCVec_MonitorEventZ ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(owner_conv);
5332         int64_tArray ret_arr = NULL;
5333         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
5334         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
5335         for (size_t o = 0; o < ret_var.datalen; o++) {
5336                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
5337                 *ret_conv_14_copy = ret_var.data[o];
5338                 int64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
5339                 ret_arr_ptr[o] = ret_conv_14_ref;
5340         }
5341         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
5342         FREE(ret_var.data);
5343         return ret_arr;
5344 }
5345
5346 static inline struct LDKPublicKey C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
5347         return owner->c;
5348 }
5349 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
5350         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
5351         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
5352         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(owner_conv).compressed_form);
5353         return ret_arr;
5354 }
5355
5356 static inline LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ *orig) {
5357         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen };
5358         for (size_t i = 0; i < ret.datalen; i++) {
5359                 ret.data[i] = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]);
5360         }
5361         return ret;
5362 }
5363 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
5364         LDKInitFeatures ret = *owner->contents.result;
5365         ret.is_owned = false;
5366         return ret;
5367 }
5368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5369         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
5370         LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
5371         int64_t ret_ref = 0;
5372         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5373         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5374         return ret_ref;
5375 }
5376
5377 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
5378 CHECK(!owner->result_ok);
5379         return DecodeError_clone(&*owner->contents.err);
5380 }
5381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5382         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
5383         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5384         *ret_copy = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
5385         int64_t ret_ref = tag_ptr(ret_copy, true);
5386         return ret_ref;
5387 }
5388
5389 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
5390         LDKChannelFeatures ret = *owner->contents.result;
5391         ret.is_owned = false;
5392         return ret;
5393 }
5394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5395         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
5396         LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
5397         int64_t ret_ref = 0;
5398         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5399         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5400         return ret_ref;
5401 }
5402
5403 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
5404 CHECK(!owner->result_ok);
5405         return DecodeError_clone(&*owner->contents.err);
5406 }
5407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5408         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
5409         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5410         *ret_copy = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
5411         int64_t ret_ref = tag_ptr(ret_copy, true);
5412         return ret_ref;
5413 }
5414
5415 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
5416         LDKNodeFeatures ret = *owner->contents.result;
5417         ret.is_owned = false;
5418         return ret;
5419 }
5420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5421         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
5422         LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
5423         int64_t ret_ref = 0;
5424         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5425         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5426         return ret_ref;
5427 }
5428
5429 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
5430 CHECK(!owner->result_ok);
5431         return DecodeError_clone(&*owner->contents.err);
5432 }
5433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5434         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
5435         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5436         *ret_copy = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
5437         int64_t ret_ref = tag_ptr(ret_copy, true);
5438         return ret_ref;
5439 }
5440
5441 static inline struct LDKBolt11InvoiceFeatures CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
5442         LDKBolt11InvoiceFeatures ret = *owner->contents.result;
5443         ret.is_owned = false;
5444         return ret;
5445 }
5446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5447         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
5448         LDKBolt11InvoiceFeatures ret_var = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
5449         int64_t ret_ref = 0;
5450         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5451         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5452         return ret_ref;
5453 }
5454
5455 static inline struct LDKDecodeError CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
5456 CHECK(!owner->result_ok);
5457         return DecodeError_clone(&*owner->contents.err);
5458 }
5459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5460         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
5461         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5462         *ret_copy = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
5463         int64_t ret_ref = tag_ptr(ret_copy, true);
5464         return ret_ref;
5465 }
5466
5467 static inline struct LDKBolt12InvoiceFeatures CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
5468         LDKBolt12InvoiceFeatures ret = *owner->contents.result;
5469         ret.is_owned = false;
5470         return ret;
5471 }
5472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5473         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
5474         LDKBolt12InvoiceFeatures ret_var = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
5475         int64_t ret_ref = 0;
5476         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5477         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5478         return ret_ref;
5479 }
5480
5481 static inline struct LDKDecodeError CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
5482 CHECK(!owner->result_ok);
5483         return DecodeError_clone(&*owner->contents.err);
5484 }
5485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5486         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
5487         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5488         *ret_copy = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
5489         int64_t ret_ref = tag_ptr(ret_copy, true);
5490         return ret_ref;
5491 }
5492
5493 static inline struct LDKBlindedHopFeatures CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
5494         LDKBlindedHopFeatures ret = *owner->contents.result;
5495         ret.is_owned = false;
5496         return ret;
5497 }
5498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5499         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
5500         LDKBlindedHopFeatures ret_var = CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(owner_conv);
5501         int64_t ret_ref = 0;
5502         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5503         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5504         return ret_ref;
5505 }
5506
5507 static inline struct LDKDecodeError CResult_BlindedHopFeaturesDecodeErrorZ_get_err(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
5508 CHECK(!owner->result_ok);
5509         return DecodeError_clone(&*owner->contents.err);
5510 }
5511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5512         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
5513         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5514         *ret_copy = CResult_BlindedHopFeaturesDecodeErrorZ_get_err(owner_conv);
5515         int64_t ret_ref = tag_ptr(ret_copy, true);
5516         return ret_ref;
5517 }
5518
5519 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
5520         LDKChannelTypeFeatures ret = *owner->contents.result;
5521         ret.is_owned = false;
5522         return ret;
5523 }
5524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5525         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
5526         LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
5527         int64_t ret_ref = 0;
5528         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5529         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5530         return ret_ref;
5531 }
5532
5533 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
5534 CHECK(!owner->result_ok);
5535         return DecodeError_clone(&*owner->contents.err);
5536 }
5537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5538         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
5539         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5540         *ret_copy = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
5541         int64_t ret_ref = tag_ptr(ret_copy, true);
5542         return ret_ref;
5543 }
5544
5545 static inline struct LDKOffer CResult_OfferBolt12ParseErrorZ_get_ok(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
5546         LDKOffer ret = *owner->contents.result;
5547         ret.is_owned = false;
5548         return ret;
5549 }
5550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5551         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
5552         LDKOffer ret_var = CResult_OfferBolt12ParseErrorZ_get_ok(owner_conv);
5553         int64_t ret_ref = 0;
5554         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5555         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5556         return ret_ref;
5557 }
5558
5559 static inline struct LDKBolt12ParseError CResult_OfferBolt12ParseErrorZ_get_err(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
5560         LDKBolt12ParseError ret = *owner->contents.err;
5561         ret.is_owned = false;
5562         return ret;
5563 }
5564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5565         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
5566         LDKBolt12ParseError ret_var = CResult_OfferBolt12ParseErrorZ_get_err(owner_conv);
5567         int64_t ret_ref = 0;
5568         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5569         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5570         return ret_ref;
5571 }
5572
5573 static inline struct LDKPublicKey CResult_PublicKeySecp256k1ErrorZ_get_ok(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR owner){
5574 CHECK(owner->result_ok);
5575         return *owner->contents.result;
5576 }
5577 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5578         LDKCResult_PublicKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(owner);
5579         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
5580         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CResult_PublicKeySecp256k1ErrorZ_get_ok(owner_conv).compressed_form);
5581         return ret_arr;
5582 }
5583
5584 static inline enum LDKSecp256k1Error CResult_PublicKeySecp256k1ErrorZ_get_err(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR owner){
5585 CHECK(!owner->result_ok);
5586         return *owner->contents.err;
5587 }
5588 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5589         LDKCResult_PublicKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(owner);
5590         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PublicKeySecp256k1ErrorZ_get_err(owner_conv));
5591         return ret_conv;
5592 }
5593
5594 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
5595         LDKNodeId ret = *owner->contents.result;
5596         ret.is_owned = false;
5597         return ret;
5598 }
5599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5600         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
5601         LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
5602         int64_t ret_ref = 0;
5603         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5604         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5605         return ret_ref;
5606 }
5607
5608 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
5609 CHECK(!owner->result_ok);
5610         return DecodeError_clone(&*owner->contents.err);
5611 }
5612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5613         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
5614         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5615         *ret_copy = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
5616         int64_t ret_ref = tag_ptr(ret_copy, true);
5617         return ret_ref;
5618 }
5619
5620 static jclass LDKNetworkUpdate_ChannelUpdateMessage_class = NULL;
5621 static jmethodID LDKNetworkUpdate_ChannelUpdateMessage_meth = NULL;
5622 static jclass LDKNetworkUpdate_ChannelFailure_class = NULL;
5623 static jmethodID LDKNetworkUpdate_ChannelFailure_meth = NULL;
5624 static jclass LDKNetworkUpdate_NodeFailure_class = NULL;
5625 static jmethodID LDKNetworkUpdate_NodeFailure_meth = NULL;
5626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetworkUpdate_init (JNIEnv *env, jclass clz) {
5627         LDKNetworkUpdate_ChannelUpdateMessage_class =
5628                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelUpdateMessage"));
5629         CHECK(LDKNetworkUpdate_ChannelUpdateMessage_class != NULL);
5630         LDKNetworkUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
5631         CHECK(LDKNetworkUpdate_ChannelUpdateMessage_meth != NULL);
5632         LDKNetworkUpdate_ChannelFailure_class =
5633                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelFailure"));
5634         CHECK(LDKNetworkUpdate_ChannelFailure_class != NULL);
5635         LDKNetworkUpdate_ChannelFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelFailure_class, "<init>", "(JZ)V");
5636         CHECK(LDKNetworkUpdate_ChannelFailure_meth != NULL);
5637         LDKNetworkUpdate_NodeFailure_class =
5638                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$NodeFailure"));
5639         CHECK(LDKNetworkUpdate_NodeFailure_class != NULL);
5640         LDKNetworkUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_NodeFailure_class, "<init>", "([BZ)V");
5641         CHECK(LDKNetworkUpdate_NodeFailure_meth != NULL);
5642 }
5643 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetworkUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5644         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
5645         switch(obj->tag) {
5646                 case LDKNetworkUpdate_ChannelUpdateMessage: {
5647                         LDKChannelUpdate msg_var = obj->channel_update_message.msg;
5648                         int64_t msg_ref = 0;
5649                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5650                         msg_ref = tag_ptr(msg_var.inner, false);
5651                         return (*env)->NewObject(env, LDKNetworkUpdate_ChannelUpdateMessage_class, LDKNetworkUpdate_ChannelUpdateMessage_meth, msg_ref);
5652                 }
5653                 case LDKNetworkUpdate_ChannelFailure: {
5654                         int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
5655                         jboolean is_permanent_conv = obj->channel_failure.is_permanent;
5656                         return (*env)->NewObject(env, LDKNetworkUpdate_ChannelFailure_class, LDKNetworkUpdate_ChannelFailure_meth, short_channel_id_conv, is_permanent_conv);
5657                 }
5658                 case LDKNetworkUpdate_NodeFailure: {
5659                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5660                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
5661                         jboolean is_permanent_conv = obj->node_failure.is_permanent;
5662                         return (*env)->NewObject(env, LDKNetworkUpdate_NodeFailure_class, LDKNetworkUpdate_NodeFailure_meth, node_id_arr, is_permanent_conv);
5663                 }
5664                 default: abort();
5665         }
5666 }
5667 static jclass LDKCOption_NetworkUpdateZ_Some_class = NULL;
5668 static jmethodID LDKCOption_NetworkUpdateZ_Some_meth = NULL;
5669 static jclass LDKCOption_NetworkUpdateZ_None_class = NULL;
5670 static jmethodID LDKCOption_NetworkUpdateZ_None_meth = NULL;
5671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetworkUpdateZ_init (JNIEnv *env, jclass clz) {
5672         LDKCOption_NetworkUpdateZ_Some_class =
5673                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$Some"));
5674         CHECK(LDKCOption_NetworkUpdateZ_Some_class != NULL);
5675         LDKCOption_NetworkUpdateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_Some_class, "<init>", "(J)V");
5676         CHECK(LDKCOption_NetworkUpdateZ_Some_meth != NULL);
5677         LDKCOption_NetworkUpdateZ_None_class =
5678                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$None"));
5679         CHECK(LDKCOption_NetworkUpdateZ_None_class != NULL);
5680         LDKCOption_NetworkUpdateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_None_class, "<init>", "()V");
5681         CHECK(LDKCOption_NetworkUpdateZ_None_meth != NULL);
5682 }
5683 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetworkUpdateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5684         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
5685         switch(obj->tag) {
5686                 case LDKCOption_NetworkUpdateZ_Some: {
5687                         int64_t some_ref = tag_ptr(&obj->some, false);
5688                         return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_Some_class, LDKCOption_NetworkUpdateZ_Some_meth, some_ref);
5689                 }
5690                 case LDKCOption_NetworkUpdateZ_None: {
5691                         return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_None_class, LDKCOption_NetworkUpdateZ_None_meth);
5692                 }
5693                 default: abort();
5694         }
5695 }
5696 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
5697 CHECK(owner->result_ok);
5698         return COption_NetworkUpdateZ_clone(&*owner->contents.result);
5699 }
5700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5701         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
5702         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
5703         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
5704         int64_t ret_ref = tag_ptr(ret_copy, true);
5705         return ret_ref;
5706 }
5707
5708 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
5709 CHECK(!owner->result_ok);
5710         return DecodeError_clone(&*owner->contents.err);
5711 }
5712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5713         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
5714         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5715         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
5716         int64_t ret_ref = tag_ptr(ret_copy, true);
5717         return ret_ref;
5718 }
5719
5720 static inline struct LDKTxOut CResult_TxOutUtxoLookupErrorZ_get_ok(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
5721 CHECK(owner->result_ok);
5722         return TxOut_clone(&*owner->contents.result);
5723 }
5724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5725         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
5726         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
5727         *ret_ref = CResult_TxOutUtxoLookupErrorZ_get_ok(owner_conv);
5728         return tag_ptr(ret_ref, true);
5729 }
5730
5731 static inline enum LDKUtxoLookupError CResult_TxOutUtxoLookupErrorZ_get_err(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
5732 CHECK(!owner->result_ok);
5733         return UtxoLookupError_clone(&*owner->contents.err);
5734 }
5735 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5736         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
5737         jclass ret_conv = LDKUtxoLookupError_to_java(env, CResult_TxOutUtxoLookupErrorZ_get_err(owner_conv));
5738         return ret_conv;
5739 }
5740
5741 static jclass LDKUtxoResult_Sync_class = NULL;
5742 static jmethodID LDKUtxoResult_Sync_meth = NULL;
5743 static jclass LDKUtxoResult_Async_class = NULL;
5744 static jmethodID LDKUtxoResult_Async_meth = NULL;
5745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKUtxoResult_init (JNIEnv *env, jclass clz) {
5746         LDKUtxoResult_Sync_class =
5747                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUtxoResult$Sync"));
5748         CHECK(LDKUtxoResult_Sync_class != NULL);
5749         LDKUtxoResult_Sync_meth = (*env)->GetMethodID(env, LDKUtxoResult_Sync_class, "<init>", "(J)V");
5750         CHECK(LDKUtxoResult_Sync_meth != NULL);
5751         LDKUtxoResult_Async_class =
5752                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUtxoResult$Async"));
5753         CHECK(LDKUtxoResult_Async_class != NULL);
5754         LDKUtxoResult_Async_meth = (*env)->GetMethodID(env, LDKUtxoResult_Async_class, "<init>", "(J)V");
5755         CHECK(LDKUtxoResult_Async_meth != NULL);
5756 }
5757 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKUtxoResult_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5758         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
5759         switch(obj->tag) {
5760                 case LDKUtxoResult_Sync: {
5761                         LDKCResult_TxOutUtxoLookupErrorZ* sync_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
5762                         *sync_conv = obj->sync;
5763                         *sync_conv = CResult_TxOutUtxoLookupErrorZ_clone(sync_conv);
5764                         return (*env)->NewObject(env, LDKUtxoResult_Sync_class, LDKUtxoResult_Sync_meth, tag_ptr(sync_conv, true));
5765                 }
5766                 case LDKUtxoResult_Async: {
5767                         LDKUtxoFuture async_var = obj->async;
5768                         int64_t async_ref = 0;
5769                         CHECK_INNER_FIELD_ACCESS_OR_NULL(async_var);
5770                         async_ref = tag_ptr(async_var.inner, false);
5771                         return (*env)->NewObject(env, LDKUtxoResult_Async_class, LDKUtxoResult_Async_meth, async_ref);
5772                 }
5773                 default: abort();
5774         }
5775 }
5776 typedef struct LDKUtxoLookup_JCalls {
5777         atomic_size_t refcnt;
5778         JavaVM *vm;
5779         jweak o;
5780         jmethodID get_utxo_meth;
5781 } LDKUtxoLookup_JCalls;
5782 static void LDKUtxoLookup_JCalls_free(void* this_arg) {
5783         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
5784         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5785                 JNIEnv *env;
5786                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5787                 if (get_jenv_res == JNI_EDETACHED) {
5788                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5789                 } else {
5790                         DO_ASSERT(get_jenv_res == JNI_OK);
5791                 }
5792                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5793                 if (get_jenv_res == JNI_EDETACHED) {
5794                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5795                 }
5796                 FREE(j_calls);
5797         }
5798 }
5799 LDKUtxoResult get_utxo_LDKUtxoLookup_jcall(const void* this_arg, const uint8_t (* chain_hash)[32], uint64_t short_channel_id) {
5800         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
5801         JNIEnv *env;
5802         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5803         if (get_jenv_res == JNI_EDETACHED) {
5804                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5805         } else {
5806                 DO_ASSERT(get_jenv_res == JNI_OK);
5807         }
5808         int8_tArray chain_hash_arr = (*env)->NewByteArray(env, 32);
5809         (*env)->SetByteArrayRegion(env, chain_hash_arr, 0, 32, *chain_hash);
5810         int64_t short_channel_id_conv = short_channel_id;
5811         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5812         CHECK(obj != NULL);
5813         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, chain_hash_arr, short_channel_id_conv);
5814         if (UNLIKELY((*env)->ExceptionCheck(env))) {
5815                 (*env)->ExceptionDescribe(env);
5816                 (*env)->FatalError(env, "A call to get_utxo in LDKUtxoLookup from rust threw an exception.");
5817         }
5818         void* ret_ptr = untag_ptr(ret);
5819         CHECK_ACCESS(ret_ptr);
5820         LDKUtxoResult ret_conv = *(LDKUtxoResult*)(ret_ptr);
5821         FREE(untag_ptr(ret));
5822         if (get_jenv_res == JNI_EDETACHED) {
5823                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5824         }
5825         return ret_conv;
5826 }
5827 static void LDKUtxoLookup_JCalls_cloned(LDKUtxoLookup* new_obj) {
5828         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) new_obj->this_arg;
5829         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5830 }
5831 static inline LDKUtxoLookup LDKUtxoLookup_init (JNIEnv *env, jclass clz, jobject o) {
5832         jclass c = (*env)->GetObjectClass(env, o);
5833         CHECK(c != NULL);
5834         LDKUtxoLookup_JCalls *calls = MALLOC(sizeof(LDKUtxoLookup_JCalls), "LDKUtxoLookup_JCalls");
5835         atomic_init(&calls->refcnt, 1);
5836         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5837         calls->o = (*env)->NewWeakGlobalRef(env, o);
5838         calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
5839         CHECK(calls->get_utxo_meth != NULL);
5840
5841         LDKUtxoLookup ret = {
5842                 .this_arg = (void*) calls,
5843                 .get_utxo = get_utxo_LDKUtxoLookup_jcall,
5844                 .free = LDKUtxoLookup_JCalls_free,
5845         };
5846         return ret;
5847 }
5848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKUtxoLookup_1new(JNIEnv *env, jclass clz, jobject o) {
5849         LDKUtxoLookup *res_ptr = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
5850         *res_ptr = LDKUtxoLookup_init(env, clz, o);
5851         return tag_ptr(res_ptr, true);
5852 }
5853 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) {
5854         void* this_arg_ptr = untag_ptr(this_arg);
5855         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5856         LDKUtxoLookup* this_arg_conv = (LDKUtxoLookup*)this_arg_ptr;
5857         uint8_t chain_hash_arr[32];
5858         CHECK((*env)->GetArrayLength(env, chain_hash) == 32);
5859         (*env)->GetByteArrayRegion(env, chain_hash, 0, 32, chain_hash_arr);
5860         uint8_t (*chain_hash_ref)[32] = &chain_hash_arr;
5861         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
5862         *ret_copy = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, chain_hash_ref, short_channel_id);
5863         int64_t ret_ref = tag_ptr(ret_copy, true);
5864         return ret_ref;
5865 }
5866
5867 static jclass LDKCOption_UtxoLookupZ_Some_class = NULL;
5868 static jmethodID LDKCOption_UtxoLookupZ_Some_meth = NULL;
5869 static jclass LDKCOption_UtxoLookupZ_None_class = NULL;
5870 static jmethodID LDKCOption_UtxoLookupZ_None_meth = NULL;
5871 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1UtxoLookupZ_init (JNIEnv *env, jclass clz) {
5872         LDKCOption_UtxoLookupZ_Some_class =
5873                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_UtxoLookupZ$Some"));
5874         CHECK(LDKCOption_UtxoLookupZ_Some_class != NULL);
5875         LDKCOption_UtxoLookupZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_UtxoLookupZ_Some_class, "<init>", "(J)V");
5876         CHECK(LDKCOption_UtxoLookupZ_Some_meth != NULL);
5877         LDKCOption_UtxoLookupZ_None_class =
5878                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_UtxoLookupZ$None"));
5879         CHECK(LDKCOption_UtxoLookupZ_None_class != NULL);
5880         LDKCOption_UtxoLookupZ_None_meth = (*env)->GetMethodID(env, LDKCOption_UtxoLookupZ_None_class, "<init>", "()V");
5881         CHECK(LDKCOption_UtxoLookupZ_None_meth != NULL);
5882 }
5883 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1UtxoLookupZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5884         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
5885         switch(obj->tag) {
5886                 case LDKCOption_UtxoLookupZ_Some: {
5887                         LDKUtxoLookup* some_ret = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
5888                         *some_ret = obj->some;
5889                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
5890                         if ((*some_ret).free == LDKUtxoLookup_JCalls_free) {
5891                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5892                                 LDKUtxoLookup_JCalls_cloned(&(*some_ret));
5893                         }
5894                         return (*env)->NewObject(env, LDKCOption_UtxoLookupZ_Some_class, LDKCOption_UtxoLookupZ_Some_meth, tag_ptr(some_ret, true));
5895                 }
5896                 case LDKCOption_UtxoLookupZ_None: {
5897                         return (*env)->NewObject(env, LDKCOption_UtxoLookupZ_None_class, LDKCOption_UtxoLookupZ_None_meth);
5898                 }
5899                 default: abort();
5900         }
5901 }
5902 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
5903 CHECK(owner->result_ok);
5904         return *owner->contents.result;
5905 }
5906 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5907         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
5908         CResult_NoneLightningErrorZ_get_ok(owner_conv);
5909 }
5910
5911 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
5912         LDKLightningError ret = *owner->contents.err;
5913         ret.is_owned = false;
5914         return ret;
5915 }
5916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5917         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
5918         LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
5919         int64_t ret_ref = 0;
5920         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5921         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5922         return ret_ref;
5923 }
5924
5925 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
5926 CHECK(owner->result_ok);
5927         return *owner->contents.result;
5928 }
5929 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5930         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
5931         jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
5932         return ret_conv;
5933 }
5934
5935 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
5936         LDKLightningError ret = *owner->contents.err;
5937         ret.is_owned = false;
5938         return ret;
5939 }
5940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5941         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
5942         LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
5943         int64_t ret_ref = 0;
5944         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5945         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5946         return ret_ref;
5947 }
5948
5949 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
5950         LDKChannelAnnouncement ret = owner->a;
5951         ret.is_owned = false;
5952         return ret;
5953 }
5954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5955         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
5956         LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
5957         int64_t ret_ref = 0;
5958         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5959         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5960         return ret_ref;
5961 }
5962
5963 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
5964         LDKChannelUpdate ret = owner->b;
5965         ret.is_owned = false;
5966         return ret;
5967 }
5968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5969         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
5970         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
5971         int64_t ret_ref = 0;
5972         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5973         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5974         return ret_ref;
5975 }
5976
5977 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
5978         LDKChannelUpdate ret = owner->c;
5979         ret.is_owned = false;
5980         return ret;
5981 }
5982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
5983         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
5984         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
5985         int64_t ret_ref = 0;
5986         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5987         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5988         return ret_ref;
5989 }
5990
5991 static jclass LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class = NULL;
5992 static jmethodID LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth = NULL;
5993 static jclass LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class = NULL;
5994 static jmethodID LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth = NULL;
5995 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_init (JNIEnv *env, jclass clz) {
5996         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class =
5997                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ$Some"));
5998         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class != NULL);
5999         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class, "<init>", "(J)V");
6000         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth != NULL);
6001         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class =
6002                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ$None"));
6003         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class != NULL);
6004         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class, "<init>", "()V");
6005         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth != NULL);
6006 }
6007 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6008         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
6009         switch(obj->tag) {
6010                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some: {
6011                         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* some_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
6012                         *some_conv = obj->some;
6013                         *some_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(some_conv);
6014                         return (*env)->NewObject(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth, tag_ptr(some_conv, true));
6015                 }
6016                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None: {
6017                         return (*env)->NewObject(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth);
6018                 }
6019                 default: abort();
6020         }
6021 }
6022 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
6023 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
6024 static jclass LDKErrorAction_DisconnectPeerWithWarning_class = NULL;
6025 static jmethodID LDKErrorAction_DisconnectPeerWithWarning_meth = NULL;
6026 static jclass LDKErrorAction_IgnoreError_class = NULL;
6027 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
6028 static jclass LDKErrorAction_IgnoreAndLog_class = NULL;
6029 static jmethodID LDKErrorAction_IgnoreAndLog_meth = NULL;
6030 static jclass LDKErrorAction_IgnoreDuplicateGossip_class = NULL;
6031 static jmethodID LDKErrorAction_IgnoreDuplicateGossip_meth = NULL;
6032 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
6033 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
6034 static jclass LDKErrorAction_SendWarningMessage_class = NULL;
6035 static jmethodID LDKErrorAction_SendWarningMessage_meth = NULL;
6036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
6037         LDKErrorAction_DisconnectPeer_class =
6038                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$DisconnectPeer"));
6039         CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
6040         LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
6041         CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
6042         LDKErrorAction_DisconnectPeerWithWarning_class =
6043                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$DisconnectPeerWithWarning"));
6044         CHECK(LDKErrorAction_DisconnectPeerWithWarning_class != NULL);
6045         LDKErrorAction_DisconnectPeerWithWarning_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeerWithWarning_class, "<init>", "(J)V");
6046         CHECK(LDKErrorAction_DisconnectPeerWithWarning_meth != NULL);
6047         LDKErrorAction_IgnoreError_class =
6048                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreError"));
6049         CHECK(LDKErrorAction_IgnoreError_class != NULL);
6050         LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
6051         CHECK(LDKErrorAction_IgnoreError_meth != NULL);
6052         LDKErrorAction_IgnoreAndLog_class =
6053                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreAndLog"));
6054         CHECK(LDKErrorAction_IgnoreAndLog_class != NULL);
6055         LDKErrorAction_IgnoreAndLog_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreAndLog_class, "<init>", "(Lorg/ldk/enums/Level;)V");
6056         CHECK(LDKErrorAction_IgnoreAndLog_meth != NULL);
6057         LDKErrorAction_IgnoreDuplicateGossip_class =
6058                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreDuplicateGossip"));
6059         CHECK(LDKErrorAction_IgnoreDuplicateGossip_class != NULL);
6060         LDKErrorAction_IgnoreDuplicateGossip_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreDuplicateGossip_class, "<init>", "()V");
6061         CHECK(LDKErrorAction_IgnoreDuplicateGossip_meth != NULL);
6062         LDKErrorAction_SendErrorMessage_class =
6063                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendErrorMessage"));
6064         CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
6065         LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
6066         CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
6067         LDKErrorAction_SendWarningMessage_class =
6068                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendWarningMessage"));
6069         CHECK(LDKErrorAction_SendWarningMessage_class != NULL);
6070         LDKErrorAction_SendWarningMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendWarningMessage_class, "<init>", "(JLorg/ldk/enums/Level;)V");
6071         CHECK(LDKErrorAction_SendWarningMessage_meth != NULL);
6072 }
6073 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6074         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
6075         switch(obj->tag) {
6076                 case LDKErrorAction_DisconnectPeer: {
6077                         LDKErrorMessage msg_var = obj->disconnect_peer.msg;
6078                         int64_t msg_ref = 0;
6079                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6080                         msg_ref = tag_ptr(msg_var.inner, false);
6081                         return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
6082                 }
6083                 case LDKErrorAction_DisconnectPeerWithWarning: {
6084                         LDKWarningMessage msg_var = obj->disconnect_peer_with_warning.msg;
6085                         int64_t msg_ref = 0;
6086                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6087                         msg_ref = tag_ptr(msg_var.inner, false);
6088                         return (*env)->NewObject(env, LDKErrorAction_DisconnectPeerWithWarning_class, LDKErrorAction_DisconnectPeerWithWarning_meth, msg_ref);
6089                 }
6090                 case LDKErrorAction_IgnoreError: {
6091                         return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
6092                 }
6093                 case LDKErrorAction_IgnoreAndLog: {
6094                         jclass ignore_and_log_conv = LDKLevel_to_java(env, obj->ignore_and_log);
6095                         return (*env)->NewObject(env, LDKErrorAction_IgnoreAndLog_class, LDKErrorAction_IgnoreAndLog_meth, ignore_and_log_conv);
6096                 }
6097                 case LDKErrorAction_IgnoreDuplicateGossip: {
6098                         return (*env)->NewObject(env, LDKErrorAction_IgnoreDuplicateGossip_class, LDKErrorAction_IgnoreDuplicateGossip_meth);
6099                 }
6100                 case LDKErrorAction_SendErrorMessage: {
6101                         LDKErrorMessage msg_var = obj->send_error_message.msg;
6102                         int64_t msg_ref = 0;
6103                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6104                         msg_ref = tag_ptr(msg_var.inner, false);
6105                         return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
6106                 }
6107                 case LDKErrorAction_SendWarningMessage: {
6108                         LDKWarningMessage msg_var = obj->send_warning_message.msg;
6109                         int64_t msg_ref = 0;
6110                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6111                         msg_ref = tag_ptr(msg_var.inner, false);
6112                         jclass log_level_conv = LDKLevel_to_java(env, obj->send_warning_message.log_level);
6113                         return (*env)->NewObject(env, LDKErrorAction_SendWarningMessage_class, LDKErrorAction_SendWarningMessage_meth, msg_ref, log_level_conv);
6114                 }
6115                 default: abort();
6116         }
6117 }
6118 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
6119 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
6120 static jclass LDKMessageSendEvent_SendAcceptChannelV2_class = NULL;
6121 static jmethodID LDKMessageSendEvent_SendAcceptChannelV2_meth = NULL;
6122 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
6123 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
6124 static jclass LDKMessageSendEvent_SendOpenChannelV2_class = NULL;
6125 static jmethodID LDKMessageSendEvent_SendOpenChannelV2_meth = NULL;
6126 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
6127 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
6128 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
6129 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
6130 static jclass LDKMessageSendEvent_SendStfu_class = NULL;
6131 static jmethodID LDKMessageSendEvent_SendStfu_meth = NULL;
6132 static jclass LDKMessageSendEvent_SendSplice_class = NULL;
6133 static jmethodID LDKMessageSendEvent_SendSplice_meth = NULL;
6134 static jclass LDKMessageSendEvent_SendSpliceAck_class = NULL;
6135 static jmethodID LDKMessageSendEvent_SendSpliceAck_meth = NULL;
6136 static jclass LDKMessageSendEvent_SendSpliceLocked_class = NULL;
6137 static jmethodID LDKMessageSendEvent_SendSpliceLocked_meth = NULL;
6138 static jclass LDKMessageSendEvent_SendTxAddInput_class = NULL;
6139 static jmethodID LDKMessageSendEvent_SendTxAddInput_meth = NULL;
6140 static jclass LDKMessageSendEvent_SendTxAddOutput_class = NULL;
6141 static jmethodID LDKMessageSendEvent_SendTxAddOutput_meth = NULL;
6142 static jclass LDKMessageSendEvent_SendTxRemoveInput_class = NULL;
6143 static jmethodID LDKMessageSendEvent_SendTxRemoveInput_meth = NULL;
6144 static jclass LDKMessageSendEvent_SendTxRemoveOutput_class = NULL;
6145 static jmethodID LDKMessageSendEvent_SendTxRemoveOutput_meth = NULL;
6146 static jclass LDKMessageSendEvent_SendTxComplete_class = NULL;
6147 static jmethodID LDKMessageSendEvent_SendTxComplete_meth = NULL;
6148 static jclass LDKMessageSendEvent_SendTxSignatures_class = NULL;
6149 static jmethodID LDKMessageSendEvent_SendTxSignatures_meth = NULL;
6150 static jclass LDKMessageSendEvent_SendTxInitRbf_class = NULL;
6151 static jmethodID LDKMessageSendEvent_SendTxInitRbf_meth = NULL;
6152 static jclass LDKMessageSendEvent_SendTxAckRbf_class = NULL;
6153 static jmethodID LDKMessageSendEvent_SendTxAckRbf_meth = NULL;
6154 static jclass LDKMessageSendEvent_SendTxAbort_class = NULL;
6155 static jmethodID LDKMessageSendEvent_SendTxAbort_meth = NULL;
6156 static jclass LDKMessageSendEvent_SendChannelReady_class = NULL;
6157 static jmethodID LDKMessageSendEvent_SendChannelReady_meth = NULL;
6158 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
6159 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
6160 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
6161 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
6162 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
6163 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
6164 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
6165 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
6166 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
6167 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
6168 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
6169 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
6170 static jclass LDKMessageSendEvent_SendChannelAnnouncement_class = NULL;
6171 static jmethodID LDKMessageSendEvent_SendChannelAnnouncement_meth = NULL;
6172 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
6173 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
6174 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
6175 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
6176 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
6177 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
6178 static jclass LDKMessageSendEvent_SendChannelUpdate_class = NULL;
6179 static jmethodID LDKMessageSendEvent_SendChannelUpdate_meth = NULL;
6180 static jclass LDKMessageSendEvent_HandleError_class = NULL;
6181 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
6182 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
6183 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
6184 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
6185 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
6186 static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL;
6187 static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL;
6188 static jclass LDKMessageSendEvent_SendGossipTimestampFilter_class = NULL;
6189 static jmethodID LDKMessageSendEvent_SendGossipTimestampFilter_meth = NULL;
6190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
6191         LDKMessageSendEvent_SendAcceptChannel_class =
6192                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel"));
6193         CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
6194         LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
6195         CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
6196         LDKMessageSendEvent_SendAcceptChannelV2_class =
6197                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannelV2"));
6198         CHECK(LDKMessageSendEvent_SendAcceptChannelV2_class != NULL);
6199         LDKMessageSendEvent_SendAcceptChannelV2_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannelV2_class, "<init>", "([BJ)V");
6200         CHECK(LDKMessageSendEvent_SendAcceptChannelV2_meth != NULL);
6201         LDKMessageSendEvent_SendOpenChannel_class =
6202                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel"));
6203         CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
6204         LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
6205         CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
6206         LDKMessageSendEvent_SendOpenChannelV2_class =
6207                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannelV2"));
6208         CHECK(LDKMessageSendEvent_SendOpenChannelV2_class != NULL);
6209         LDKMessageSendEvent_SendOpenChannelV2_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannelV2_class, "<init>", "([BJ)V");
6210         CHECK(LDKMessageSendEvent_SendOpenChannelV2_meth != NULL);
6211         LDKMessageSendEvent_SendFundingCreated_class =
6212                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated"));
6213         CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
6214         LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
6215         CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
6216         LDKMessageSendEvent_SendFundingSigned_class =
6217                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned"));
6218         CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
6219         LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
6220         CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
6221         LDKMessageSendEvent_SendStfu_class =
6222                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendStfu"));
6223         CHECK(LDKMessageSendEvent_SendStfu_class != NULL);
6224         LDKMessageSendEvent_SendStfu_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendStfu_class, "<init>", "([BJ)V");
6225         CHECK(LDKMessageSendEvent_SendStfu_meth != NULL);
6226         LDKMessageSendEvent_SendSplice_class =
6227                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendSplice"));
6228         CHECK(LDKMessageSendEvent_SendSplice_class != NULL);
6229         LDKMessageSendEvent_SendSplice_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendSplice_class, "<init>", "([BJ)V");
6230         CHECK(LDKMessageSendEvent_SendSplice_meth != NULL);
6231         LDKMessageSendEvent_SendSpliceAck_class =
6232                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendSpliceAck"));
6233         CHECK(LDKMessageSendEvent_SendSpliceAck_class != NULL);
6234         LDKMessageSendEvent_SendSpliceAck_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendSpliceAck_class, "<init>", "([BJ)V");
6235         CHECK(LDKMessageSendEvent_SendSpliceAck_meth != NULL);
6236         LDKMessageSendEvent_SendSpliceLocked_class =
6237                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendSpliceLocked"));
6238         CHECK(LDKMessageSendEvent_SendSpliceLocked_class != NULL);
6239         LDKMessageSendEvent_SendSpliceLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendSpliceLocked_class, "<init>", "([BJ)V");
6240         CHECK(LDKMessageSendEvent_SendSpliceLocked_meth != NULL);
6241         LDKMessageSendEvent_SendTxAddInput_class =
6242                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxAddInput"));
6243         CHECK(LDKMessageSendEvent_SendTxAddInput_class != NULL);
6244         LDKMessageSendEvent_SendTxAddInput_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxAddInput_class, "<init>", "([BJ)V");
6245         CHECK(LDKMessageSendEvent_SendTxAddInput_meth != NULL);
6246         LDKMessageSendEvent_SendTxAddOutput_class =
6247                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxAddOutput"));
6248         CHECK(LDKMessageSendEvent_SendTxAddOutput_class != NULL);
6249         LDKMessageSendEvent_SendTxAddOutput_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxAddOutput_class, "<init>", "([BJ)V");
6250         CHECK(LDKMessageSendEvent_SendTxAddOutput_meth != NULL);
6251         LDKMessageSendEvent_SendTxRemoveInput_class =
6252                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxRemoveInput"));
6253         CHECK(LDKMessageSendEvent_SendTxRemoveInput_class != NULL);
6254         LDKMessageSendEvent_SendTxRemoveInput_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxRemoveInput_class, "<init>", "([BJ)V");
6255         CHECK(LDKMessageSendEvent_SendTxRemoveInput_meth != NULL);
6256         LDKMessageSendEvent_SendTxRemoveOutput_class =
6257                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxRemoveOutput"));
6258         CHECK(LDKMessageSendEvent_SendTxRemoveOutput_class != NULL);
6259         LDKMessageSendEvent_SendTxRemoveOutput_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxRemoveOutput_class, "<init>", "([BJ)V");
6260         CHECK(LDKMessageSendEvent_SendTxRemoveOutput_meth != NULL);
6261         LDKMessageSendEvent_SendTxComplete_class =
6262                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxComplete"));
6263         CHECK(LDKMessageSendEvent_SendTxComplete_class != NULL);
6264         LDKMessageSendEvent_SendTxComplete_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxComplete_class, "<init>", "([BJ)V");
6265         CHECK(LDKMessageSendEvent_SendTxComplete_meth != NULL);
6266         LDKMessageSendEvent_SendTxSignatures_class =
6267                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxSignatures"));
6268         CHECK(LDKMessageSendEvent_SendTxSignatures_class != NULL);
6269         LDKMessageSendEvent_SendTxSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxSignatures_class, "<init>", "([BJ)V");
6270         CHECK(LDKMessageSendEvent_SendTxSignatures_meth != NULL);
6271         LDKMessageSendEvent_SendTxInitRbf_class =
6272                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxInitRbf"));
6273         CHECK(LDKMessageSendEvent_SendTxInitRbf_class != NULL);
6274         LDKMessageSendEvent_SendTxInitRbf_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxInitRbf_class, "<init>", "([BJ)V");
6275         CHECK(LDKMessageSendEvent_SendTxInitRbf_meth != NULL);
6276         LDKMessageSendEvent_SendTxAckRbf_class =
6277                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxAckRbf"));
6278         CHECK(LDKMessageSendEvent_SendTxAckRbf_class != NULL);
6279         LDKMessageSendEvent_SendTxAckRbf_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxAckRbf_class, "<init>", "([BJ)V");
6280         CHECK(LDKMessageSendEvent_SendTxAckRbf_meth != NULL);
6281         LDKMessageSendEvent_SendTxAbort_class =
6282                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxAbort"));
6283         CHECK(LDKMessageSendEvent_SendTxAbort_class != NULL);
6284         LDKMessageSendEvent_SendTxAbort_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxAbort_class, "<init>", "([BJ)V");
6285         CHECK(LDKMessageSendEvent_SendTxAbort_meth != NULL);
6286         LDKMessageSendEvent_SendChannelReady_class =
6287                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReady"));
6288         CHECK(LDKMessageSendEvent_SendChannelReady_class != NULL);
6289         LDKMessageSendEvent_SendChannelReady_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReady_class, "<init>", "([BJ)V");
6290         CHECK(LDKMessageSendEvent_SendChannelReady_meth != NULL);
6291         LDKMessageSendEvent_SendAnnouncementSignatures_class =
6292                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures"));
6293         CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
6294         LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
6295         CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
6296         LDKMessageSendEvent_UpdateHTLCs_class =
6297                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs"));
6298         CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
6299         LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
6300         CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
6301         LDKMessageSendEvent_SendRevokeAndACK_class =
6302                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK"));
6303         CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
6304         LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
6305         CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
6306         LDKMessageSendEvent_SendClosingSigned_class =
6307                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned"));
6308         CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
6309         LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
6310         CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
6311         LDKMessageSendEvent_SendShutdown_class =
6312                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown"));
6313         CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
6314         LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
6315         CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
6316         LDKMessageSendEvent_SendChannelReestablish_class =
6317                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish"));
6318         CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
6319         LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
6320         CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
6321         LDKMessageSendEvent_SendChannelAnnouncement_class =
6322                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelAnnouncement"));
6323         CHECK(LDKMessageSendEvent_SendChannelAnnouncement_class != NULL);
6324         LDKMessageSendEvent_SendChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelAnnouncement_class, "<init>", "([BJJ)V");
6325         CHECK(LDKMessageSendEvent_SendChannelAnnouncement_meth != NULL);
6326         LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
6327                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement"));
6328         CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
6329         LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
6330         CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
6331         LDKMessageSendEvent_BroadcastChannelUpdate_class =
6332                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate"));
6333         CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
6334         LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
6335         CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
6336         LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
6337                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement"));
6338         CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
6339         LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
6340         CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
6341         LDKMessageSendEvent_SendChannelUpdate_class =
6342                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelUpdate"));
6343         CHECK(LDKMessageSendEvent_SendChannelUpdate_class != NULL);
6344         LDKMessageSendEvent_SendChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelUpdate_class, "<init>", "([BJ)V");
6345         CHECK(LDKMessageSendEvent_SendChannelUpdate_meth != NULL);
6346         LDKMessageSendEvent_HandleError_class =
6347                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$HandleError"));
6348         CHECK(LDKMessageSendEvent_HandleError_class != NULL);
6349         LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
6350         CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
6351         LDKMessageSendEvent_SendChannelRangeQuery_class =
6352                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery"));
6353         CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
6354         LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
6355         CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
6356         LDKMessageSendEvent_SendShortIdsQuery_class =
6357                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery"));
6358         CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
6359         LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
6360         CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
6361         LDKMessageSendEvent_SendReplyChannelRange_class =
6362                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange"));
6363         CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL);
6364         LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "<init>", "([BJ)V");
6365         CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL);
6366         LDKMessageSendEvent_SendGossipTimestampFilter_class =
6367                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendGossipTimestampFilter"));
6368         CHECK(LDKMessageSendEvent_SendGossipTimestampFilter_class != NULL);
6369         LDKMessageSendEvent_SendGossipTimestampFilter_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendGossipTimestampFilter_class, "<init>", "([BJ)V");
6370         CHECK(LDKMessageSendEvent_SendGossipTimestampFilter_meth != NULL);
6371 }
6372 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6373         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
6374         switch(obj->tag) {
6375                 case LDKMessageSendEvent_SendAcceptChannel: {
6376                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6377                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
6378                         LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
6379                         int64_t msg_ref = 0;
6380                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6381                         msg_ref = tag_ptr(msg_var.inner, false);
6382                         return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
6383                 }
6384                 case LDKMessageSendEvent_SendAcceptChannelV2: {
6385                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6386                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel_v2.node_id.compressed_form);
6387                         LDKAcceptChannelV2 msg_var = obj->send_accept_channel_v2.msg;
6388                         int64_t msg_ref = 0;
6389                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6390                         msg_ref = tag_ptr(msg_var.inner, false);
6391                         return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannelV2_class, LDKMessageSendEvent_SendAcceptChannelV2_meth, node_id_arr, msg_ref);
6392                 }
6393                 case LDKMessageSendEvent_SendOpenChannel: {
6394                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6395                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
6396                         LDKOpenChannel msg_var = obj->send_open_channel.msg;
6397                         int64_t msg_ref = 0;
6398                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6399                         msg_ref = tag_ptr(msg_var.inner, false);
6400                         return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
6401                 }
6402                 case LDKMessageSendEvent_SendOpenChannelV2: {
6403                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6404                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel_v2.node_id.compressed_form);
6405                         LDKOpenChannelV2 msg_var = obj->send_open_channel_v2.msg;
6406                         int64_t msg_ref = 0;
6407                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6408                         msg_ref = tag_ptr(msg_var.inner, false);
6409                         return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannelV2_class, LDKMessageSendEvent_SendOpenChannelV2_meth, node_id_arr, msg_ref);
6410                 }
6411                 case LDKMessageSendEvent_SendFundingCreated: {
6412                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6413                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
6414                         LDKFundingCreated msg_var = obj->send_funding_created.msg;
6415                         int64_t msg_ref = 0;
6416                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6417                         msg_ref = tag_ptr(msg_var.inner, false);
6418                         return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
6419                 }
6420                 case LDKMessageSendEvent_SendFundingSigned: {
6421                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6422                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
6423                         LDKFundingSigned msg_var = obj->send_funding_signed.msg;
6424                         int64_t msg_ref = 0;
6425                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6426                         msg_ref = tag_ptr(msg_var.inner, false);
6427                         return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
6428                 }
6429                 case LDKMessageSendEvent_SendStfu: {
6430                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6431                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_stfu.node_id.compressed_form);
6432                         LDKStfu msg_var = obj->send_stfu.msg;
6433                         int64_t msg_ref = 0;
6434                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6435                         msg_ref = tag_ptr(msg_var.inner, false);
6436                         return (*env)->NewObject(env, LDKMessageSendEvent_SendStfu_class, LDKMessageSendEvent_SendStfu_meth, node_id_arr, msg_ref);
6437                 }
6438                 case LDKMessageSendEvent_SendSplice: {
6439                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6440                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_splice.node_id.compressed_form);
6441                         LDKSplice msg_var = obj->send_splice.msg;
6442                         int64_t msg_ref = 0;
6443                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6444                         msg_ref = tag_ptr(msg_var.inner, false);
6445                         return (*env)->NewObject(env, LDKMessageSendEvent_SendSplice_class, LDKMessageSendEvent_SendSplice_meth, node_id_arr, msg_ref);
6446                 }
6447                 case LDKMessageSendEvent_SendSpliceAck: {
6448                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6449                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_splice_ack.node_id.compressed_form);
6450                         LDKSpliceAck msg_var = obj->send_splice_ack.msg;
6451                         int64_t msg_ref = 0;
6452                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6453                         msg_ref = tag_ptr(msg_var.inner, false);
6454                         return (*env)->NewObject(env, LDKMessageSendEvent_SendSpliceAck_class, LDKMessageSendEvent_SendSpliceAck_meth, node_id_arr, msg_ref);
6455                 }
6456                 case LDKMessageSendEvent_SendSpliceLocked: {
6457                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6458                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_splice_locked.node_id.compressed_form);
6459                         LDKSpliceLocked msg_var = obj->send_splice_locked.msg;
6460                         int64_t msg_ref = 0;
6461                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6462                         msg_ref = tag_ptr(msg_var.inner, false);
6463                         return (*env)->NewObject(env, LDKMessageSendEvent_SendSpliceLocked_class, LDKMessageSendEvent_SendSpliceLocked_meth, node_id_arr, msg_ref);
6464                 }
6465                 case LDKMessageSendEvent_SendTxAddInput: {
6466                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6467                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_add_input.node_id.compressed_form);
6468                         LDKTxAddInput msg_var = obj->send_tx_add_input.msg;
6469                         int64_t msg_ref = 0;
6470                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6471                         msg_ref = tag_ptr(msg_var.inner, false);
6472                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxAddInput_class, LDKMessageSendEvent_SendTxAddInput_meth, node_id_arr, msg_ref);
6473                 }
6474                 case LDKMessageSendEvent_SendTxAddOutput: {
6475                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6476                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_add_output.node_id.compressed_form);
6477                         LDKTxAddOutput msg_var = obj->send_tx_add_output.msg;
6478                         int64_t msg_ref = 0;
6479                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6480                         msg_ref = tag_ptr(msg_var.inner, false);
6481                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxAddOutput_class, LDKMessageSendEvent_SendTxAddOutput_meth, node_id_arr, msg_ref);
6482                 }
6483                 case LDKMessageSendEvent_SendTxRemoveInput: {
6484                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6485                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_remove_input.node_id.compressed_form);
6486                         LDKTxRemoveInput msg_var = obj->send_tx_remove_input.msg;
6487                         int64_t msg_ref = 0;
6488                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6489                         msg_ref = tag_ptr(msg_var.inner, false);
6490                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxRemoveInput_class, LDKMessageSendEvent_SendTxRemoveInput_meth, node_id_arr, msg_ref);
6491                 }
6492                 case LDKMessageSendEvent_SendTxRemoveOutput: {
6493                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6494                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_remove_output.node_id.compressed_form);
6495                         LDKTxRemoveOutput msg_var = obj->send_tx_remove_output.msg;
6496                         int64_t msg_ref = 0;
6497                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6498                         msg_ref = tag_ptr(msg_var.inner, false);
6499                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxRemoveOutput_class, LDKMessageSendEvent_SendTxRemoveOutput_meth, node_id_arr, msg_ref);
6500                 }
6501                 case LDKMessageSendEvent_SendTxComplete: {
6502                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6503                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_complete.node_id.compressed_form);
6504                         LDKTxComplete msg_var = obj->send_tx_complete.msg;
6505                         int64_t msg_ref = 0;
6506                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6507                         msg_ref = tag_ptr(msg_var.inner, false);
6508                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxComplete_class, LDKMessageSendEvent_SendTxComplete_meth, node_id_arr, msg_ref);
6509                 }
6510                 case LDKMessageSendEvent_SendTxSignatures: {
6511                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6512                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_signatures.node_id.compressed_form);
6513                         LDKTxSignatures msg_var = obj->send_tx_signatures.msg;
6514                         int64_t msg_ref = 0;
6515                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6516                         msg_ref = tag_ptr(msg_var.inner, false);
6517                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxSignatures_class, LDKMessageSendEvent_SendTxSignatures_meth, node_id_arr, msg_ref);
6518                 }
6519                 case LDKMessageSendEvent_SendTxInitRbf: {
6520                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6521                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_init_rbf.node_id.compressed_form);
6522                         LDKTxInitRbf msg_var = obj->send_tx_init_rbf.msg;
6523                         int64_t msg_ref = 0;
6524                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6525                         msg_ref = tag_ptr(msg_var.inner, false);
6526                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxInitRbf_class, LDKMessageSendEvent_SendTxInitRbf_meth, node_id_arr, msg_ref);
6527                 }
6528                 case LDKMessageSendEvent_SendTxAckRbf: {
6529                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6530                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_ack_rbf.node_id.compressed_form);
6531                         LDKTxAckRbf msg_var = obj->send_tx_ack_rbf.msg;
6532                         int64_t msg_ref = 0;
6533                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6534                         msg_ref = tag_ptr(msg_var.inner, false);
6535                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxAckRbf_class, LDKMessageSendEvent_SendTxAckRbf_meth, node_id_arr, msg_ref);
6536                 }
6537                 case LDKMessageSendEvent_SendTxAbort: {
6538                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6539                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_abort.node_id.compressed_form);
6540                         LDKTxAbort msg_var = obj->send_tx_abort.msg;
6541                         int64_t msg_ref = 0;
6542                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6543                         msg_ref = tag_ptr(msg_var.inner, false);
6544                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxAbort_class, LDKMessageSendEvent_SendTxAbort_meth, node_id_arr, msg_ref);
6545                 }
6546                 case LDKMessageSendEvent_SendChannelReady: {
6547                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6548                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_ready.node_id.compressed_form);
6549                         LDKChannelReady msg_var = obj->send_channel_ready.msg;
6550                         int64_t msg_ref = 0;
6551                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6552                         msg_ref = tag_ptr(msg_var.inner, false);
6553                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReady_class, LDKMessageSendEvent_SendChannelReady_meth, node_id_arr, msg_ref);
6554                 }
6555                 case LDKMessageSendEvent_SendAnnouncementSignatures: {
6556                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6557                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
6558                         LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
6559                         int64_t msg_ref = 0;
6560                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6561                         msg_ref = tag_ptr(msg_var.inner, false);
6562                         return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
6563                 }
6564                 case LDKMessageSendEvent_UpdateHTLCs: {
6565                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6566                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
6567                         LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
6568                         int64_t updates_ref = 0;
6569                         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
6570                         updates_ref = tag_ptr(updates_var.inner, false);
6571                         return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
6572                 }
6573                 case LDKMessageSendEvent_SendRevokeAndACK: {
6574                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6575                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
6576                         LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
6577                         int64_t msg_ref = 0;
6578                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6579                         msg_ref = tag_ptr(msg_var.inner, false);
6580                         return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
6581                 }
6582                 case LDKMessageSendEvent_SendClosingSigned: {
6583                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6584                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
6585                         LDKClosingSigned msg_var = obj->send_closing_signed.msg;
6586                         int64_t msg_ref = 0;
6587                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6588                         msg_ref = tag_ptr(msg_var.inner, false);
6589                         return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
6590                 }
6591                 case LDKMessageSendEvent_SendShutdown: {
6592                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6593                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
6594                         LDKShutdown msg_var = obj->send_shutdown.msg;
6595                         int64_t msg_ref = 0;
6596                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6597                         msg_ref = tag_ptr(msg_var.inner, false);
6598                         return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
6599                 }
6600                 case LDKMessageSendEvent_SendChannelReestablish: {
6601                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6602                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
6603                         LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
6604                         int64_t msg_ref = 0;
6605                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6606                         msg_ref = tag_ptr(msg_var.inner, false);
6607                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
6608                 }
6609                 case LDKMessageSendEvent_SendChannelAnnouncement: {
6610                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6611                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_announcement.node_id.compressed_form);
6612                         LDKChannelAnnouncement msg_var = obj->send_channel_announcement.msg;
6613                         int64_t msg_ref = 0;
6614                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6615                         msg_ref = tag_ptr(msg_var.inner, false);
6616                         LDKChannelUpdate update_msg_var = obj->send_channel_announcement.update_msg;
6617                         int64_t update_msg_ref = 0;
6618                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
6619                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
6620                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelAnnouncement_class, LDKMessageSendEvent_SendChannelAnnouncement_meth, node_id_arr, msg_ref, update_msg_ref);
6621                 }
6622                 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
6623                         LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
6624                         int64_t msg_ref = 0;
6625                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6626                         msg_ref = tag_ptr(msg_var.inner, false);
6627                         LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
6628                         int64_t update_msg_ref = 0;
6629                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
6630                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
6631                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
6632                 }
6633                 case LDKMessageSendEvent_BroadcastChannelUpdate: {
6634                         LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
6635                         int64_t msg_ref = 0;
6636                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6637                         msg_ref = tag_ptr(msg_var.inner, false);
6638                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
6639                 }
6640                 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
6641                         LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
6642                         int64_t msg_ref = 0;
6643                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6644                         msg_ref = tag_ptr(msg_var.inner, false);
6645                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
6646                 }
6647                 case LDKMessageSendEvent_SendChannelUpdate: {
6648                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6649                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_update.node_id.compressed_form);
6650                         LDKChannelUpdate msg_var = obj->send_channel_update.msg;
6651                         int64_t msg_ref = 0;
6652                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6653                         msg_ref = tag_ptr(msg_var.inner, false);
6654                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelUpdate_class, LDKMessageSendEvent_SendChannelUpdate_meth, node_id_arr, msg_ref);
6655                 }
6656                 case LDKMessageSendEvent_HandleError: {
6657                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6658                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
6659                         int64_t action_ref = tag_ptr(&obj->handle_error.action, false);
6660                         return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
6661                 }
6662                 case LDKMessageSendEvent_SendChannelRangeQuery: {
6663                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6664                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
6665                         LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
6666                         int64_t msg_ref = 0;
6667                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6668                         msg_ref = tag_ptr(msg_var.inner, false);
6669                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
6670                 }
6671                 case LDKMessageSendEvent_SendShortIdsQuery: {
6672                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6673                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
6674                         LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
6675                         int64_t msg_ref = 0;
6676                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6677                         msg_ref = tag_ptr(msg_var.inner, false);
6678                         return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
6679                 }
6680                 case LDKMessageSendEvent_SendReplyChannelRange: {
6681                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6682                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_reply_channel_range.node_id.compressed_form);
6683                         LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
6684                         int64_t msg_ref = 0;
6685                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6686                         msg_ref = tag_ptr(msg_var.inner, false);
6687                         return (*env)->NewObject(env, LDKMessageSendEvent_SendReplyChannelRange_class, LDKMessageSendEvent_SendReplyChannelRange_meth, node_id_arr, msg_ref);
6688                 }
6689                 case LDKMessageSendEvent_SendGossipTimestampFilter: {
6690                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6691                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_gossip_timestamp_filter.node_id.compressed_form);
6692                         LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
6693                         int64_t msg_ref = 0;
6694                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6695                         msg_ref = tag_ptr(msg_var.inner, false);
6696                         return (*env)->NewObject(env, LDKMessageSendEvent_SendGossipTimestampFilter_class, LDKMessageSendEvent_SendGossipTimestampFilter_meth, node_id_arr, msg_ref);
6697                 }
6698                 default: abort();
6699         }
6700 }
6701 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
6702         LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
6703         for (size_t i = 0; i < ret.datalen; i++) {
6704                 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
6705         }
6706         return ret;
6707 }
6708 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
6709         LDKChannelUpdateInfo ret = *owner->contents.result;
6710         ret.is_owned = false;
6711         return ret;
6712 }
6713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6714         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
6715         LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
6716         int64_t ret_ref = 0;
6717         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6718         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6719         return ret_ref;
6720 }
6721
6722 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
6723 CHECK(!owner->result_ok);
6724         return DecodeError_clone(&*owner->contents.err);
6725 }
6726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6727         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
6728         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6729         *ret_copy = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
6730         int64_t ret_ref = tag_ptr(ret_copy, true);
6731         return ret_ref;
6732 }
6733
6734 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
6735         LDKChannelInfo ret = *owner->contents.result;
6736         ret.is_owned = false;
6737         return ret;
6738 }
6739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6740         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
6741         LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
6742         int64_t ret_ref = 0;
6743         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6744         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6745         return ret_ref;
6746 }
6747
6748 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
6749 CHECK(!owner->result_ok);
6750         return DecodeError_clone(&*owner->contents.err);
6751 }
6752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6753         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
6754         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6755         *ret_copy = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
6756         int64_t ret_ref = tag_ptr(ret_copy, true);
6757         return ret_ref;
6758 }
6759
6760 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
6761         LDKRoutingFees ret = *owner->contents.result;
6762         ret.is_owned = false;
6763         return ret;
6764 }
6765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6766         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
6767         LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
6768         int64_t ret_ref = 0;
6769         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6770         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6771         return ret_ref;
6772 }
6773
6774 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
6775 CHECK(!owner->result_ok);
6776         return DecodeError_clone(&*owner->contents.err);
6777 }
6778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6779         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
6780         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6781         *ret_copy = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
6782         int64_t ret_ref = tag_ptr(ret_copy, true);
6783         return ret_ref;
6784 }
6785
6786 static jclass LDKSocketAddress_TcpIpV4_class = NULL;
6787 static jmethodID LDKSocketAddress_TcpIpV4_meth = NULL;
6788 static jclass LDKSocketAddress_TcpIpV6_class = NULL;
6789 static jmethodID LDKSocketAddress_TcpIpV6_meth = NULL;
6790 static jclass LDKSocketAddress_OnionV2_class = NULL;
6791 static jmethodID LDKSocketAddress_OnionV2_meth = NULL;
6792 static jclass LDKSocketAddress_OnionV3_class = NULL;
6793 static jmethodID LDKSocketAddress_OnionV3_meth = NULL;
6794 static jclass LDKSocketAddress_Hostname_class = NULL;
6795 static jmethodID LDKSocketAddress_Hostname_meth = NULL;
6796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSocketAddress_init (JNIEnv *env, jclass clz) {
6797         LDKSocketAddress_TcpIpV4_class =
6798                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSocketAddress$TcpIpV4"));
6799         CHECK(LDKSocketAddress_TcpIpV4_class != NULL);
6800         LDKSocketAddress_TcpIpV4_meth = (*env)->GetMethodID(env, LDKSocketAddress_TcpIpV4_class, "<init>", "([BS)V");
6801         CHECK(LDKSocketAddress_TcpIpV4_meth != NULL);
6802         LDKSocketAddress_TcpIpV6_class =
6803                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSocketAddress$TcpIpV6"));
6804         CHECK(LDKSocketAddress_TcpIpV6_class != NULL);
6805         LDKSocketAddress_TcpIpV6_meth = (*env)->GetMethodID(env, LDKSocketAddress_TcpIpV6_class, "<init>", "([BS)V");
6806         CHECK(LDKSocketAddress_TcpIpV6_meth != NULL);
6807         LDKSocketAddress_OnionV2_class =
6808                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSocketAddress$OnionV2"));
6809         CHECK(LDKSocketAddress_OnionV2_class != NULL);
6810         LDKSocketAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKSocketAddress_OnionV2_class, "<init>", "([B)V");
6811         CHECK(LDKSocketAddress_OnionV2_meth != NULL);
6812         LDKSocketAddress_OnionV3_class =
6813                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSocketAddress$OnionV3"));
6814         CHECK(LDKSocketAddress_OnionV3_class != NULL);
6815         LDKSocketAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKSocketAddress_OnionV3_class, "<init>", "([BSBS)V");
6816         CHECK(LDKSocketAddress_OnionV3_meth != NULL);
6817         LDKSocketAddress_Hostname_class =
6818                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSocketAddress$Hostname"));
6819         CHECK(LDKSocketAddress_Hostname_class != NULL);
6820         LDKSocketAddress_Hostname_meth = (*env)->GetMethodID(env, LDKSocketAddress_Hostname_class, "<init>", "(JS)V");
6821         CHECK(LDKSocketAddress_Hostname_meth != NULL);
6822 }
6823 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSocketAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6824         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
6825         switch(obj->tag) {
6826                 case LDKSocketAddress_TcpIpV4: {
6827                         int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
6828                         (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->tcp_ip_v4.addr.data);
6829                         int16_t port_conv = obj->tcp_ip_v4.port;
6830                         return (*env)->NewObject(env, LDKSocketAddress_TcpIpV4_class, LDKSocketAddress_TcpIpV4_meth, addr_arr, port_conv);
6831                 }
6832                 case LDKSocketAddress_TcpIpV6: {
6833                         int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
6834                         (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->tcp_ip_v6.addr.data);
6835                         int16_t port_conv = obj->tcp_ip_v6.port;
6836                         return (*env)->NewObject(env, LDKSocketAddress_TcpIpV6_class, LDKSocketAddress_TcpIpV6_meth, addr_arr, port_conv);
6837                 }
6838                 case LDKSocketAddress_OnionV2: {
6839                         int8_tArray onion_v2_arr = (*env)->NewByteArray(env, 12);
6840                         (*env)->SetByteArrayRegion(env, onion_v2_arr, 0, 12, obj->onion_v2.data);
6841                         return (*env)->NewObject(env, LDKSocketAddress_OnionV2_class, LDKSocketAddress_OnionV2_meth, onion_v2_arr);
6842                 }
6843                 case LDKSocketAddress_OnionV3: {
6844                         int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
6845                         (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
6846                         int16_t checksum_conv = obj->onion_v3.checksum;
6847                         int8_t version_conv = obj->onion_v3.version;
6848                         int16_t port_conv = obj->onion_v3.port;
6849                         return (*env)->NewObject(env, LDKSocketAddress_OnionV3_class, LDKSocketAddress_OnionV3_meth, ed25519_pubkey_arr, checksum_conv, version_conv, port_conv);
6850                 }
6851                 case LDKSocketAddress_Hostname: {
6852                         LDKHostname hostname_var = obj->hostname.hostname;
6853                         int64_t hostname_ref = 0;
6854                         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var);
6855                         hostname_ref = tag_ptr(hostname_var.inner, false);
6856                         int16_t port_conv = obj->hostname.port;
6857                         return (*env)->NewObject(env, LDKSocketAddress_Hostname_class, LDKSocketAddress_Hostname_meth, hostname_ref, port_conv);
6858                 }
6859                 default: abort();
6860         }
6861 }
6862 static inline LDKCVec_SocketAddressZ CVec_SocketAddressZ_clone(const LDKCVec_SocketAddressZ *orig) {
6863         LDKCVec_SocketAddressZ ret = { .data = MALLOC(sizeof(LDKSocketAddress) * orig->datalen, "LDKCVec_SocketAddressZ clone bytes"), .datalen = orig->datalen };
6864         for (size_t i = 0; i < ret.datalen; i++) {
6865                 ret.data[i] = SocketAddress_clone(&orig->data[i]);
6866         }
6867         return ret;
6868 }
6869 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
6870         LDKNodeAnnouncementInfo ret = *owner->contents.result;
6871         ret.is_owned = false;
6872         return ret;
6873 }
6874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6875         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
6876         LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
6877         int64_t ret_ref = 0;
6878         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6879         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6880         return ret_ref;
6881 }
6882
6883 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
6884 CHECK(!owner->result_ok);
6885         return DecodeError_clone(&*owner->contents.err);
6886 }
6887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6888         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
6889         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6890         *ret_copy = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
6891         int64_t ret_ref = tag_ptr(ret_copy, true);
6892         return ret_ref;
6893 }
6894
6895 static inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
6896         LDKNodeAlias ret = *owner->contents.result;
6897         ret.is_owned = false;
6898         return ret;
6899 }
6900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6901         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
6902         LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
6903         int64_t ret_ref = 0;
6904         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6905         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6906         return ret_ref;
6907 }
6908
6909 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
6910 CHECK(!owner->result_ok);
6911         return DecodeError_clone(&*owner->contents.err);
6912 }
6913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6914         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
6915         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6916         *ret_copy = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
6917         int64_t ret_ref = tag_ptr(ret_copy, true);
6918         return ret_ref;
6919 }
6920
6921 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
6922         LDKNodeInfo ret = *owner->contents.result;
6923         ret.is_owned = false;
6924         return ret;
6925 }
6926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6927         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
6928         LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
6929         int64_t ret_ref = 0;
6930         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6931         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6932         return ret_ref;
6933 }
6934
6935 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
6936 CHECK(!owner->result_ok);
6937         return DecodeError_clone(&*owner->contents.err);
6938 }
6939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6940         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
6941         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6942         *ret_copy = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
6943         int64_t ret_ref = tag_ptr(ret_copy, true);
6944         return ret_ref;
6945 }
6946
6947 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
6948         LDKNetworkGraph ret = *owner->contents.result;
6949         ret.is_owned = false;
6950         return ret;
6951 }
6952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6953         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
6954         LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
6955         int64_t ret_ref = 0;
6956         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6957         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6958         return ret_ref;
6959 }
6960
6961 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
6962 CHECK(!owner->result_ok);
6963         return DecodeError_clone(&*owner->contents.err);
6964 }
6965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6966         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
6967         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6968         *ret_copy = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
6969         int64_t ret_ref = tag_ptr(ret_copy, true);
6970         return ret_ref;
6971 }
6972
6973 static jclass LDKCOption_CVec_SocketAddressZZ_Some_class = NULL;
6974 static jmethodID LDKCOption_CVec_SocketAddressZZ_Some_meth = NULL;
6975 static jclass LDKCOption_CVec_SocketAddressZZ_None_class = NULL;
6976 static jmethodID LDKCOption_CVec_SocketAddressZZ_None_meth = NULL;
6977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1SocketAddressZZ_init (JNIEnv *env, jclass clz) {
6978         LDKCOption_CVec_SocketAddressZZ_Some_class =
6979                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_SocketAddressZZ$Some"));
6980         CHECK(LDKCOption_CVec_SocketAddressZZ_Some_class != NULL);
6981         LDKCOption_CVec_SocketAddressZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_SocketAddressZZ_Some_class, "<init>", "([J)V");
6982         CHECK(LDKCOption_CVec_SocketAddressZZ_Some_meth != NULL);
6983         LDKCOption_CVec_SocketAddressZZ_None_class =
6984                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_SocketAddressZZ$None"));
6985         CHECK(LDKCOption_CVec_SocketAddressZZ_None_class != NULL);
6986         LDKCOption_CVec_SocketAddressZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_SocketAddressZZ_None_class, "<init>", "()V");
6987         CHECK(LDKCOption_CVec_SocketAddressZZ_None_meth != NULL);
6988 }
6989 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1SocketAddressZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6990         LDKCOption_CVec_SocketAddressZZ *obj = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(ptr);
6991         switch(obj->tag) {
6992                 case LDKCOption_CVec_SocketAddressZZ_Some: {
6993                         LDKCVec_SocketAddressZ some_var = obj->some;
6994                         int64_tArray some_arr = NULL;
6995                         some_arr = (*env)->NewLongArray(env, some_var.datalen);
6996                         int64_t *some_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, some_arr, NULL);
6997                         for (size_t p = 0; p < some_var.datalen; p++) {
6998                                 int64_t some_conv_15_ref = tag_ptr(&some_var.data[p], false);
6999                                 some_arr_ptr[p] = some_conv_15_ref;
7000                         }
7001                         (*env)->ReleasePrimitiveArrayCritical(env, some_arr, some_arr_ptr, 0);
7002                         return (*env)->NewObject(env, LDKCOption_CVec_SocketAddressZZ_Some_class, LDKCOption_CVec_SocketAddressZZ_Some_meth, some_arr);
7003                 }
7004                 case LDKCOption_CVec_SocketAddressZZ_None: {
7005                         return (*env)->NewObject(env, LDKCOption_CVec_SocketAddressZZ_None_class, LDKCOption_CVec_SocketAddressZZ_None_meth);
7006                 }
7007                 default: abort();
7008         }
7009 }
7010 static inline struct LDKPendingHTLCInfo CResult_PendingHTLCInfoInboundHTLCErrZ_get_ok(LDKCResult_PendingHTLCInfoInboundHTLCErrZ *NONNULL_PTR owner){
7011         LDKPendingHTLCInfo ret = *owner->contents.result;
7012         ret.is_owned = false;
7013         return ret;
7014 }
7015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoInboundHTLCErrZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7016         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* owner_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(owner);
7017         LDKPendingHTLCInfo ret_var = CResult_PendingHTLCInfoInboundHTLCErrZ_get_ok(owner_conv);
7018         int64_t ret_ref = 0;
7019         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7020         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7021         return ret_ref;
7022 }
7023
7024 static inline struct LDKInboundHTLCErr CResult_PendingHTLCInfoInboundHTLCErrZ_get_err(LDKCResult_PendingHTLCInfoInboundHTLCErrZ *NONNULL_PTR owner){
7025         LDKInboundHTLCErr ret = *owner->contents.err;
7026         ret.is_owned = false;
7027         return ret;
7028 }
7029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoInboundHTLCErrZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7030         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* owner_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(owner);
7031         LDKInboundHTLCErr ret_var = CResult_PendingHTLCInfoInboundHTLCErrZ_get_err(owner_conv);
7032         int64_t ret_ref = 0;
7033         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7034         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7035         return ret_ref;
7036 }
7037
7038 static inline LDKCVec_HTLCOutputInCommitmentZ CVec_HTLCOutputInCommitmentZ_clone(const LDKCVec_HTLCOutputInCommitmentZ *orig) {
7039         LDKCVec_HTLCOutputInCommitmentZ ret = { .data = MALLOC(sizeof(LDKHTLCOutputInCommitment) * orig->datalen, "LDKCVec_HTLCOutputInCommitmentZ clone bytes"), .datalen = orig->datalen };
7040         for (size_t i = 0; i < ret.datalen; i++) {
7041                 ret.data[i] = HTLCOutputInCommitment_clone(&orig->data[i]);
7042         }
7043         return ret;
7044 }
7045 static inline LDKCVec_HTLCDescriptorZ CVec_HTLCDescriptorZ_clone(const LDKCVec_HTLCDescriptorZ *orig) {
7046         LDKCVec_HTLCDescriptorZ ret = { .data = MALLOC(sizeof(LDKHTLCDescriptor) * orig->datalen, "LDKCVec_HTLCDescriptorZ clone bytes"), .datalen = orig->datalen };
7047         for (size_t i = 0; i < ret.datalen; i++) {
7048                 ret.data[i] = HTLCDescriptor_clone(&orig->data[i]);
7049         }
7050         return ret;
7051 }
7052 static inline LDKCVec_UtxoZ CVec_UtxoZ_clone(const LDKCVec_UtxoZ *orig) {
7053         LDKCVec_UtxoZ ret = { .data = MALLOC(sizeof(LDKUtxo) * orig->datalen, "LDKCVec_UtxoZ clone bytes"), .datalen = orig->datalen };
7054         for (size_t i = 0; i < ret.datalen; i++) {
7055                 ret.data[i] = Utxo_clone(&orig->data[i]);
7056         }
7057         return ret;
7058 }
7059 static jclass LDKCOption_TxOutZ_Some_class = NULL;
7060 static jmethodID LDKCOption_TxOutZ_Some_meth = NULL;
7061 static jclass LDKCOption_TxOutZ_None_class = NULL;
7062 static jmethodID LDKCOption_TxOutZ_None_meth = NULL;
7063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TxOutZ_init (JNIEnv *env, jclass clz) {
7064         LDKCOption_TxOutZ_Some_class =
7065                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TxOutZ$Some"));
7066         CHECK(LDKCOption_TxOutZ_Some_class != NULL);
7067         LDKCOption_TxOutZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TxOutZ_Some_class, "<init>", "(J)V");
7068         CHECK(LDKCOption_TxOutZ_Some_meth != NULL);
7069         LDKCOption_TxOutZ_None_class =
7070                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TxOutZ$None"));
7071         CHECK(LDKCOption_TxOutZ_None_class != NULL);
7072         LDKCOption_TxOutZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TxOutZ_None_class, "<init>", "()V");
7073         CHECK(LDKCOption_TxOutZ_None_meth != NULL);
7074 }
7075 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TxOutZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7076         LDKCOption_TxOutZ *obj = (LDKCOption_TxOutZ*)untag_ptr(ptr);
7077         switch(obj->tag) {
7078                 case LDKCOption_TxOutZ_Some: {
7079                         LDKTxOut* some_ref = &obj->some;
7080                         return (*env)->NewObject(env, LDKCOption_TxOutZ_Some_class, LDKCOption_TxOutZ_Some_meth, tag_ptr(some_ref, false));
7081                 }
7082                 case LDKCOption_TxOutZ_None: {
7083                         return (*env)->NewObject(env, LDKCOption_TxOutZ_None_class, LDKCOption_TxOutZ_None_meth);
7084                 }
7085                 default: abort();
7086         }
7087 }
7088 static inline LDKCVec_InputZ CVec_InputZ_clone(const LDKCVec_InputZ *orig) {
7089         LDKCVec_InputZ ret = { .data = MALLOC(sizeof(LDKInput) * orig->datalen, "LDKCVec_InputZ clone bytes"), .datalen = orig->datalen };
7090         for (size_t i = 0; i < ret.datalen; i++) {
7091                 ret.data[i] = Input_clone(&orig->data[i]);
7092         }
7093         return ret;
7094 }
7095 static inline struct LDKCoinSelection CResult_CoinSelectionNoneZ_get_ok(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
7096         LDKCoinSelection ret = *owner->contents.result;
7097         ret.is_owned = false;
7098         return ret;
7099 }
7100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7101         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
7102         LDKCoinSelection ret_var = CResult_CoinSelectionNoneZ_get_ok(owner_conv);
7103         int64_t ret_ref = 0;
7104         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7105         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7106         return ret_ref;
7107 }
7108
7109 static inline void CResult_CoinSelectionNoneZ_get_err(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
7110 CHECK(!owner->result_ok);
7111         return *owner->contents.err;
7112 }
7113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7114         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
7115         CResult_CoinSelectionNoneZ_get_err(owner_conv);
7116 }
7117
7118 static inline struct LDKCVec_UtxoZ CResult_CVec_UtxoZNoneZ_get_ok(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
7119 CHECK(owner->result_ok);
7120         return CVec_UtxoZ_clone(&*owner->contents.result);
7121 }
7122 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7123         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
7124         LDKCVec_UtxoZ ret_var = CResult_CVec_UtxoZNoneZ_get_ok(owner_conv);
7125         int64_tArray ret_arr = NULL;
7126         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
7127         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
7128         for (size_t g = 0; g < ret_var.datalen; g++) {
7129                 LDKUtxo ret_conv_6_var = ret_var.data[g];
7130                 int64_t ret_conv_6_ref = 0;
7131                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
7132                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
7133                 ret_arr_ptr[g] = ret_conv_6_ref;
7134         }
7135         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
7136         FREE(ret_var.data);
7137         return ret_arr;
7138 }
7139
7140 static inline void CResult_CVec_UtxoZNoneZ_get_err(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
7141 CHECK(!owner->result_ok);
7142         return *owner->contents.err;
7143 }
7144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7145         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
7146         CResult_CVec_UtxoZNoneZ_get_err(owner_conv);
7147 }
7148
7149 static inline uint64_t C2Tuple_u64u16Z_get_a(LDKC2Tuple_u64u16Z *NONNULL_PTR owner){
7150         return owner->a;
7151 }
7152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7153         LDKC2Tuple_u64u16Z* owner_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(owner);
7154         int64_t ret_conv = C2Tuple_u64u16Z_get_a(owner_conv);
7155         return ret_conv;
7156 }
7157
7158 static inline uint16_t C2Tuple_u64u16Z_get_b(LDKC2Tuple_u64u16Z *NONNULL_PTR owner){
7159         return owner->b;
7160 }
7161 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7162         LDKC2Tuple_u64u16Z* owner_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(owner);
7163         int16_t ret_conv = C2Tuple_u64u16Z_get_b(owner_conv);
7164         return ret_conv;
7165 }
7166
7167 static jclass LDKCOption_C2Tuple_u64u16ZZ_Some_class = NULL;
7168 static jmethodID LDKCOption_C2Tuple_u64u16ZZ_Some_meth = NULL;
7169 static jclass LDKCOption_C2Tuple_u64u16ZZ_None_class = NULL;
7170 static jmethodID LDKCOption_C2Tuple_u64u16ZZ_None_meth = NULL;
7171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1u64u16ZZ_init (JNIEnv *env, jclass clz) {
7172         LDKCOption_C2Tuple_u64u16ZZ_Some_class =
7173                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u16ZZ$Some"));
7174         CHECK(LDKCOption_C2Tuple_u64u16ZZ_Some_class != NULL);
7175         LDKCOption_C2Tuple_u64u16ZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u16ZZ_Some_class, "<init>", "(J)V");
7176         CHECK(LDKCOption_C2Tuple_u64u16ZZ_Some_meth != NULL);
7177         LDKCOption_C2Tuple_u64u16ZZ_None_class =
7178                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u16ZZ$None"));
7179         CHECK(LDKCOption_C2Tuple_u64u16ZZ_None_class != NULL);
7180         LDKCOption_C2Tuple_u64u16ZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u16ZZ_None_class, "<init>", "()V");
7181         CHECK(LDKCOption_C2Tuple_u64u16ZZ_None_meth != NULL);
7182 }
7183 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1u64u16ZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7184         LDKCOption_C2Tuple_u64u16ZZ *obj = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(ptr);
7185         switch(obj->tag) {
7186                 case LDKCOption_C2Tuple_u64u16ZZ_Some: {
7187                         LDKC2Tuple_u64u16Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
7188                         *some_conv = obj->some;
7189                         *some_conv = C2Tuple_u64u16Z_clone(some_conv);
7190                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u16ZZ_Some_class, LDKCOption_C2Tuple_u64u16ZZ_Some_meth, tag_ptr(some_conv, true));
7191                 }
7192                 case LDKCOption_C2Tuple_u64u16ZZ_None: {
7193                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u16ZZ_None_class, LDKCOption_C2Tuple_u64u16ZZ_None_meth);
7194                 }
7195                 default: abort();
7196         }
7197 }
7198 static jclass LDKCOption_ChannelShutdownStateZ_Some_class = NULL;
7199 static jmethodID LDKCOption_ChannelShutdownStateZ_Some_meth = NULL;
7200 static jclass LDKCOption_ChannelShutdownStateZ_None_class = NULL;
7201 static jmethodID LDKCOption_ChannelShutdownStateZ_None_meth = NULL;
7202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ChannelShutdownStateZ_init (JNIEnv *env, jclass clz) {
7203         LDKCOption_ChannelShutdownStateZ_Some_class =
7204                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ChannelShutdownStateZ$Some"));
7205         CHECK(LDKCOption_ChannelShutdownStateZ_Some_class != NULL);
7206         LDKCOption_ChannelShutdownStateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ChannelShutdownStateZ_Some_class, "<init>", "(Lorg/ldk/enums/ChannelShutdownState;)V");
7207         CHECK(LDKCOption_ChannelShutdownStateZ_Some_meth != NULL);
7208         LDKCOption_ChannelShutdownStateZ_None_class =
7209                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ChannelShutdownStateZ$None"));
7210         CHECK(LDKCOption_ChannelShutdownStateZ_None_class != NULL);
7211         LDKCOption_ChannelShutdownStateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ChannelShutdownStateZ_None_class, "<init>", "()V");
7212         CHECK(LDKCOption_ChannelShutdownStateZ_None_meth != NULL);
7213 }
7214 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ChannelShutdownStateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7215         LDKCOption_ChannelShutdownStateZ *obj = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(ptr);
7216         switch(obj->tag) {
7217                 case LDKCOption_ChannelShutdownStateZ_Some: {
7218                         jclass some_conv = LDKChannelShutdownState_to_java(env, obj->some);
7219                         return (*env)->NewObject(env, LDKCOption_ChannelShutdownStateZ_Some_class, LDKCOption_ChannelShutdownStateZ_Some_meth, some_conv);
7220                 }
7221                 case LDKCOption_ChannelShutdownStateZ_None: {
7222                         return (*env)->NewObject(env, LDKCOption_ChannelShutdownStateZ_None_class, LDKCOption_ChannelShutdownStateZ_None_meth);
7223                 }
7224                 default: abort();
7225         }
7226 }
7227 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesAPIErrorZ_get_ok(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR owner){
7228 CHECK(owner->result_ok);
7229         return ThirtyTwoBytes_clone(&*owner->contents.result);
7230 }
7231 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7232         LDKCResult_ThirtyTwoBytesAPIErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(owner);
7233         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7234         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_ThirtyTwoBytesAPIErrorZ_get_ok(owner_conv).data);
7235         return ret_arr;
7236 }
7237
7238 static inline struct LDKAPIError CResult_ThirtyTwoBytesAPIErrorZ_get_err(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR owner){
7239 CHECK(!owner->result_ok);
7240         return APIError_clone(&*owner->contents.err);
7241 }
7242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7243         LDKCResult_ThirtyTwoBytesAPIErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(owner);
7244         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
7245         *ret_copy = CResult_ThirtyTwoBytesAPIErrorZ_get_err(owner_conv);
7246         int64_t ret_ref = tag_ptr(ret_copy, true);
7247         return ret_ref;
7248 }
7249
7250 static jclass LDKRecentPaymentDetails_AwaitingInvoice_class = NULL;
7251 static jmethodID LDKRecentPaymentDetails_AwaitingInvoice_meth = NULL;
7252 static jclass LDKRecentPaymentDetails_Pending_class = NULL;
7253 static jmethodID LDKRecentPaymentDetails_Pending_meth = NULL;
7254 static jclass LDKRecentPaymentDetails_Fulfilled_class = NULL;
7255 static jmethodID LDKRecentPaymentDetails_Fulfilled_meth = NULL;
7256 static jclass LDKRecentPaymentDetails_Abandoned_class = NULL;
7257 static jmethodID LDKRecentPaymentDetails_Abandoned_meth = NULL;
7258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKRecentPaymentDetails_init (JNIEnv *env, jclass clz) {
7259         LDKRecentPaymentDetails_AwaitingInvoice_class =
7260                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$AwaitingInvoice"));
7261         CHECK(LDKRecentPaymentDetails_AwaitingInvoice_class != NULL);
7262         LDKRecentPaymentDetails_AwaitingInvoice_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_AwaitingInvoice_class, "<init>", "([B)V");
7263         CHECK(LDKRecentPaymentDetails_AwaitingInvoice_meth != NULL);
7264         LDKRecentPaymentDetails_Pending_class =
7265                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$Pending"));
7266         CHECK(LDKRecentPaymentDetails_Pending_class != NULL);
7267         LDKRecentPaymentDetails_Pending_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_Pending_class, "<init>", "([B[BJ)V");
7268         CHECK(LDKRecentPaymentDetails_Pending_meth != NULL);
7269         LDKRecentPaymentDetails_Fulfilled_class =
7270                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$Fulfilled"));
7271         CHECK(LDKRecentPaymentDetails_Fulfilled_class != NULL);
7272         LDKRecentPaymentDetails_Fulfilled_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_Fulfilled_class, "<init>", "([BJ)V");
7273         CHECK(LDKRecentPaymentDetails_Fulfilled_meth != NULL);
7274         LDKRecentPaymentDetails_Abandoned_class =
7275                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$Abandoned"));
7276         CHECK(LDKRecentPaymentDetails_Abandoned_class != NULL);
7277         LDKRecentPaymentDetails_Abandoned_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_Abandoned_class, "<init>", "([B[B)V");
7278         CHECK(LDKRecentPaymentDetails_Abandoned_meth != NULL);
7279 }
7280 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRecentPaymentDetails_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7281         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
7282         switch(obj->tag) {
7283                 case LDKRecentPaymentDetails_AwaitingInvoice: {
7284                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
7285                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->awaiting_invoice.payment_id.data);
7286                         return (*env)->NewObject(env, LDKRecentPaymentDetails_AwaitingInvoice_class, LDKRecentPaymentDetails_AwaitingInvoice_meth, payment_id_arr);
7287                 }
7288                 case LDKRecentPaymentDetails_Pending: {
7289                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
7290                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->pending.payment_id.data);
7291                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
7292                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->pending.payment_hash.data);
7293                         int64_t total_msat_conv = obj->pending.total_msat;
7294                         return (*env)->NewObject(env, LDKRecentPaymentDetails_Pending_class, LDKRecentPaymentDetails_Pending_meth, payment_id_arr, payment_hash_arr, total_msat_conv);
7295                 }
7296                 case LDKRecentPaymentDetails_Fulfilled: {
7297                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
7298                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->fulfilled.payment_id.data);
7299                         int64_t payment_hash_ref = tag_ptr(&obj->fulfilled.payment_hash, false);
7300                         return (*env)->NewObject(env, LDKRecentPaymentDetails_Fulfilled_class, LDKRecentPaymentDetails_Fulfilled_meth, payment_id_arr, payment_hash_ref);
7301                 }
7302                 case LDKRecentPaymentDetails_Abandoned: {
7303                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
7304                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->abandoned.payment_id.data);
7305                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
7306                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->abandoned.payment_hash.data);
7307                         return (*env)->NewObject(env, LDKRecentPaymentDetails_Abandoned_class, LDKRecentPaymentDetails_Abandoned_meth, payment_id_arr, payment_hash_arr);
7308                 }
7309                 default: abort();
7310         }
7311 }
7312 static inline LDKCVec_RecentPaymentDetailsZ CVec_RecentPaymentDetailsZ_clone(const LDKCVec_RecentPaymentDetailsZ *orig) {
7313         LDKCVec_RecentPaymentDetailsZ ret = { .data = MALLOC(sizeof(LDKRecentPaymentDetails) * orig->datalen, "LDKCVec_RecentPaymentDetailsZ clone bytes"), .datalen = orig->datalen };
7314         for (size_t i = 0; i < ret.datalen; i++) {
7315                 ret.data[i] = RecentPaymentDetails_clone(&orig->data[i]);
7316         }
7317         return ret;
7318 }
7319 static jclass LDKPaymentSendFailure_ParameterError_class = NULL;
7320 static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL;
7321 static jclass LDKPaymentSendFailure_PathParameterError_class = NULL;
7322 static jmethodID LDKPaymentSendFailure_PathParameterError_meth = NULL;
7323 static jclass LDKPaymentSendFailure_AllFailedResendSafe_class = NULL;
7324 static jmethodID LDKPaymentSendFailure_AllFailedResendSafe_meth = NULL;
7325 static jclass LDKPaymentSendFailure_DuplicatePayment_class = NULL;
7326 static jmethodID LDKPaymentSendFailure_DuplicatePayment_meth = NULL;
7327 static jclass LDKPaymentSendFailure_PartialFailure_class = NULL;
7328 static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL;
7329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) {
7330         LDKPaymentSendFailure_ParameterError_class =
7331                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError"));
7332         CHECK(LDKPaymentSendFailure_ParameterError_class != NULL);
7333         LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "<init>", "(J)V");
7334         CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL);
7335         LDKPaymentSendFailure_PathParameterError_class =
7336                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError"));
7337         CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL);
7338         LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "<init>", "([J)V");
7339         CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL);
7340         LDKPaymentSendFailure_AllFailedResendSafe_class =
7341                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedResendSafe"));
7342         CHECK(LDKPaymentSendFailure_AllFailedResendSafe_class != NULL);
7343         LDKPaymentSendFailure_AllFailedResendSafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedResendSafe_class, "<init>", "([J)V");
7344         CHECK(LDKPaymentSendFailure_AllFailedResendSafe_meth != NULL);
7345         LDKPaymentSendFailure_DuplicatePayment_class =
7346                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$DuplicatePayment"));
7347         CHECK(LDKPaymentSendFailure_DuplicatePayment_class != NULL);
7348         LDKPaymentSendFailure_DuplicatePayment_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_DuplicatePayment_class, "<init>", "()V");
7349         CHECK(LDKPaymentSendFailure_DuplicatePayment_meth != NULL);
7350         LDKPaymentSendFailure_PartialFailure_class =
7351                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure"));
7352         CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL);
7353         LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "<init>", "([JJ[B)V");
7354         CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL);
7355 }
7356 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7357         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
7358         switch(obj->tag) {
7359                 case LDKPaymentSendFailure_ParameterError: {
7360                         int64_t parameter_error_ref = tag_ptr(&obj->parameter_error, false);
7361                         return (*env)->NewObject(env, LDKPaymentSendFailure_ParameterError_class, LDKPaymentSendFailure_ParameterError_meth, parameter_error_ref);
7362                 }
7363                 case LDKPaymentSendFailure_PathParameterError: {
7364                         LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
7365                         int64_tArray path_parameter_error_arr = NULL;
7366                         path_parameter_error_arr = (*env)->NewLongArray(env, path_parameter_error_var.datalen);
7367                         int64_t *path_parameter_error_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_parameter_error_arr, NULL);
7368                         for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
7369                                 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
7370                                 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
7371                                 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
7372                                 path_parameter_error_arr_ptr[w] = tag_ptr(path_parameter_error_conv_22_conv, true);
7373                         }
7374                         (*env)->ReleasePrimitiveArrayCritical(env, path_parameter_error_arr, path_parameter_error_arr_ptr, 0);
7375                         return (*env)->NewObject(env, LDKPaymentSendFailure_PathParameterError_class, LDKPaymentSendFailure_PathParameterError_meth, path_parameter_error_arr);
7376                 }
7377                 case LDKPaymentSendFailure_AllFailedResendSafe: {
7378                         LDKCVec_APIErrorZ all_failed_resend_safe_var = obj->all_failed_resend_safe;
7379                         int64_tArray all_failed_resend_safe_arr = NULL;
7380                         all_failed_resend_safe_arr = (*env)->NewLongArray(env, all_failed_resend_safe_var.datalen);
7381                         int64_t *all_failed_resend_safe_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, all_failed_resend_safe_arr, NULL);
7382                         for (size_t k = 0; k < all_failed_resend_safe_var.datalen; k++) {
7383                                 int64_t all_failed_resend_safe_conv_10_ref = tag_ptr(&all_failed_resend_safe_var.data[k], false);
7384                                 all_failed_resend_safe_arr_ptr[k] = all_failed_resend_safe_conv_10_ref;
7385                         }
7386                         (*env)->ReleasePrimitiveArrayCritical(env, all_failed_resend_safe_arr, all_failed_resend_safe_arr_ptr, 0);
7387                         return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedResendSafe_class, LDKPaymentSendFailure_AllFailedResendSafe_meth, all_failed_resend_safe_arr);
7388                 }
7389                 case LDKPaymentSendFailure_DuplicatePayment: {
7390                         return (*env)->NewObject(env, LDKPaymentSendFailure_DuplicatePayment_class, LDKPaymentSendFailure_DuplicatePayment_meth);
7391                 }
7392                 case LDKPaymentSendFailure_PartialFailure: {
7393                         LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
7394                         int64_tArray results_arr = NULL;
7395                         results_arr = (*env)->NewLongArray(env, results_var.datalen);
7396                         int64_t *results_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, results_arr, NULL);
7397                         for (size_t w = 0; w < results_var.datalen; w++) {
7398                                 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
7399                                 *results_conv_22_conv = results_var.data[w];
7400                                 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
7401                                 results_arr_ptr[w] = tag_ptr(results_conv_22_conv, true);
7402                         }
7403                         (*env)->ReleasePrimitiveArrayCritical(env, results_arr, results_arr_ptr, 0);
7404                         LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
7405                         int64_t failed_paths_retry_ref = 0;
7406                         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
7407                         failed_paths_retry_ref = tag_ptr(failed_paths_retry_var.inner, false);
7408                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
7409                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->partial_failure.payment_id.data);
7410                         return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth, results_arr, failed_paths_retry_ref, payment_id_arr);
7411                 }
7412                 default: abort();
7413         }
7414 }
7415 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
7416 CHECK(owner->result_ok);
7417         return *owner->contents.result;
7418 }
7419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7420         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
7421         CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
7422 }
7423
7424 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
7425 CHECK(!owner->result_ok);
7426         return PaymentSendFailure_clone(&*owner->contents.err);
7427 }
7428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7429         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
7430         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
7431         *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
7432         int64_t ret_ref = tag_ptr(ret_copy, true);
7433         return ret_ref;
7434 }
7435
7436 static inline void CResult_NoneRetryableSendFailureZ_get_ok(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
7437 CHECK(owner->result_ok);
7438         return *owner->contents.result;
7439 }
7440 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7441         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
7442         CResult_NoneRetryableSendFailureZ_get_ok(owner_conv);
7443 }
7444
7445 static inline enum LDKRetryableSendFailure CResult_NoneRetryableSendFailureZ_get_err(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
7446 CHECK(!owner->result_ok);
7447         return RetryableSendFailure_clone(&*owner->contents.err);
7448 }
7449 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7450         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
7451         jclass ret_conv = LDKRetryableSendFailure_to_java(env, CResult_NoneRetryableSendFailureZ_get_err(owner_conv));
7452         return ret_conv;
7453 }
7454
7455 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR owner){
7456 CHECK(owner->result_ok);
7457         return ThirtyTwoBytes_clone(&*owner->contents.result);
7458 }
7459 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7460         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(owner);
7461         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7462         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(owner_conv).data);
7463         return ret_arr;
7464 }
7465
7466 static inline struct LDKPaymentSendFailure CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR owner){
7467 CHECK(!owner->result_ok);
7468         return PaymentSendFailure_clone(&*owner->contents.err);
7469 }
7470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7471         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(owner);
7472         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
7473         *ret_copy = CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(owner_conv);
7474         int64_t ret_ref = tag_ptr(ret_copy, true);
7475         return ret_ref;
7476 }
7477
7478 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR owner){
7479 CHECK(owner->result_ok);
7480         return ThirtyTwoBytes_clone(&*owner->contents.result);
7481 }
7482 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7483         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(owner);
7484         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7485         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(owner_conv).data);
7486         return ret_arr;
7487 }
7488
7489 static inline enum LDKRetryableSendFailure CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR owner){
7490 CHECK(!owner->result_ok);
7491         return RetryableSendFailure_clone(&*owner->contents.err);
7492 }
7493 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7494         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(owner);
7495         jclass ret_conv = LDKRetryableSendFailure_to_java(env, CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(owner_conv));
7496         return ret_conv;
7497 }
7498
7499 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR owner){
7500         return ThirtyTwoBytes_clone(&owner->a);
7501 }
7502 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7503         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(owner);
7504         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7505         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(owner_conv).data);
7506         return ret_arr;
7507 }
7508
7509 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR owner){
7510         return ThirtyTwoBytes_clone(&owner->b);
7511 }
7512 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7513         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(owner);
7514         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7515         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(owner_conv).data);
7516         return ret_arr;
7517 }
7518
7519 static inline struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR owner){
7520 CHECK(owner->result_ok);
7521         return C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&*owner->contents.result);
7522 }
7523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7524         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(owner);
7525         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
7526         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(owner_conv);
7527         return tag_ptr(ret_conv, true);
7528 }
7529
7530 static inline struct LDKPaymentSendFailure CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR owner){
7531 CHECK(!owner->result_ok);
7532         return PaymentSendFailure_clone(&*owner->contents.err);
7533 }
7534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7535         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(owner);
7536         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
7537         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(owner_conv);
7538         int64_t ret_ref = tag_ptr(ret_copy, true);
7539         return ret_ref;
7540 }
7541
7542 static inline LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ *orig) {
7543         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ clone bytes"), .datalen = orig->datalen };
7544         for (size_t i = 0; i < ret.datalen; i++) {
7545                 ret.data[i] = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&orig->data[i]);
7546         }
7547         return ret;
7548 }
7549 static jclass LDKProbeSendFailure_RouteNotFound_class = NULL;
7550 static jmethodID LDKProbeSendFailure_RouteNotFound_meth = NULL;
7551 static jclass LDKProbeSendFailure_SendingFailed_class = NULL;
7552 static jmethodID LDKProbeSendFailure_SendingFailed_meth = NULL;
7553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKProbeSendFailure_init (JNIEnv *env, jclass clz) {
7554         LDKProbeSendFailure_RouteNotFound_class =
7555                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKProbeSendFailure$RouteNotFound"));
7556         CHECK(LDKProbeSendFailure_RouteNotFound_class != NULL);
7557         LDKProbeSendFailure_RouteNotFound_meth = (*env)->GetMethodID(env, LDKProbeSendFailure_RouteNotFound_class, "<init>", "()V");
7558         CHECK(LDKProbeSendFailure_RouteNotFound_meth != NULL);
7559         LDKProbeSendFailure_SendingFailed_class =
7560                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKProbeSendFailure$SendingFailed"));
7561         CHECK(LDKProbeSendFailure_SendingFailed_class != NULL);
7562         LDKProbeSendFailure_SendingFailed_meth = (*env)->GetMethodID(env, LDKProbeSendFailure_SendingFailed_class, "<init>", "(J)V");
7563         CHECK(LDKProbeSendFailure_SendingFailed_meth != NULL);
7564 }
7565 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKProbeSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7566         LDKProbeSendFailure *obj = (LDKProbeSendFailure*)untag_ptr(ptr);
7567         switch(obj->tag) {
7568                 case LDKProbeSendFailure_RouteNotFound: {
7569                         return (*env)->NewObject(env, LDKProbeSendFailure_RouteNotFound_class, LDKProbeSendFailure_RouteNotFound_meth);
7570                 }
7571                 case LDKProbeSendFailure_SendingFailed: {
7572                         int64_t sending_failed_ref = tag_ptr(&obj->sending_failed, false);
7573                         return (*env)->NewObject(env, LDKProbeSendFailure_SendingFailed_class, LDKProbeSendFailure_SendingFailed_meth, sending_failed_ref);
7574                 }
7575                 default: abort();
7576         }
7577 }
7578 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR owner){
7579 CHECK(owner->result_ok);
7580         return CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(&*owner->contents.result);
7581 }
7582 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7583         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(owner);
7584         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(owner_conv);
7585         int64_tArray ret_arr = NULL;
7586         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
7587         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
7588         for (size_t o = 0; o < ret_var.datalen; o++) {
7589                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
7590                 *ret_conv_40_conv = ret_var.data[o];
7591                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
7592         }
7593         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
7594         FREE(ret_var.data);
7595         return ret_arr;
7596 }
7597
7598 static inline struct LDKProbeSendFailure CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR owner){
7599 CHECK(!owner->result_ok);
7600         return ProbeSendFailure_clone(&*owner->contents.err);
7601 }
7602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7603         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(owner);
7604         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
7605         *ret_copy = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(owner_conv);
7606         int64_t ret_ref = tag_ptr(ret_copy, true);
7607         return ret_ref;
7608 }
7609
7610 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesPublicKeyZ_get_a(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *NONNULL_PTR owner){
7611         return ThirtyTwoBytes_clone(&owner->a);
7612 }
7613 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesPublicKeyZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7614         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(owner);
7615         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7616         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesPublicKeyZ_get_a(owner_conv).data);
7617         return ret_arr;
7618 }
7619
7620 static inline struct LDKPublicKey C2Tuple_ThirtyTwoBytesPublicKeyZ_get_b(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *NONNULL_PTR owner){
7621         return owner->b;
7622 }
7623 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesPublicKeyZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7624         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(owner);
7625         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
7626         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_ThirtyTwoBytesPublicKeyZ_get_b(owner_conv).compressed_form);
7627         return ret_arr;
7628 }
7629
7630 static inline LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ *orig) {
7631         LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ clone bytes"), .datalen = orig->datalen };
7632         for (size_t i = 0; i < ret.datalen; i++) {
7633                 ret.data[i] = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(&orig->data[i]);
7634         }
7635         return ret;
7636 }
7637 static jclass LDKCOption_StrZ_Some_class = NULL;
7638 static jmethodID LDKCOption_StrZ_Some_meth = NULL;
7639 static jclass LDKCOption_StrZ_None_class = NULL;
7640 static jmethodID LDKCOption_StrZ_None_meth = NULL;
7641 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1StrZ_init (JNIEnv *env, jclass clz) {
7642         LDKCOption_StrZ_Some_class =
7643                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_StrZ$Some"));
7644         CHECK(LDKCOption_StrZ_Some_class != NULL);
7645         LDKCOption_StrZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_StrZ_Some_class, "<init>", "(Ljava/lang/String;)V");
7646         CHECK(LDKCOption_StrZ_Some_meth != NULL);
7647         LDKCOption_StrZ_None_class =
7648                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_StrZ$None"));
7649         CHECK(LDKCOption_StrZ_None_class != NULL);
7650         LDKCOption_StrZ_None_meth = (*env)->GetMethodID(env, LDKCOption_StrZ_None_class, "<init>", "()V");
7651         CHECK(LDKCOption_StrZ_None_meth != NULL);
7652 }
7653 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1StrZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7654         LDKCOption_StrZ *obj = (LDKCOption_StrZ*)untag_ptr(ptr);
7655         switch(obj->tag) {
7656                 case LDKCOption_StrZ_Some: {
7657                         LDKStr some_str = obj->some;
7658                         jstring some_conv = str_ref_to_java(env, some_str.chars, some_str.len);
7659                         return (*env)->NewObject(env, LDKCOption_StrZ_Some_class, LDKCOption_StrZ_Some_meth, some_conv);
7660                 }
7661                 case LDKCOption_StrZ_None: {
7662                         return (*env)->NewObject(env, LDKCOption_StrZ_None_class, LDKCOption_StrZ_None_meth);
7663                 }
7664                 default: abort();
7665         }
7666 }
7667 static inline void CResult_NoneBolt12SemanticErrorZ_get_ok(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR owner){
7668 CHECK(owner->result_ok);
7669         return *owner->contents.result;
7670 }
7671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7672         LDKCResult_NoneBolt12SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(owner);
7673         CResult_NoneBolt12SemanticErrorZ_get_ok(owner_conv);
7674 }
7675
7676 static inline enum LDKBolt12SemanticError CResult_NoneBolt12SemanticErrorZ_get_err(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR owner){
7677 CHECK(!owner->result_ok);
7678         return Bolt12SemanticError_clone(&*owner->contents.err);
7679 }
7680 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7681         LDKCResult_NoneBolt12SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(owner);
7682         jclass ret_conv = LDKBolt12SemanticError_to_java(env, CResult_NoneBolt12SemanticErrorZ_get_err(owner_conv));
7683         return ret_conv;
7684 }
7685
7686 static inline struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner){
7687 CHECK(owner->result_ok);
7688         return C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&*owner->contents.result);
7689 }
7690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7691         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(owner);
7692         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
7693         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(owner_conv);
7694         return tag_ptr(ret_conv, true);
7695 }
7696
7697 static inline void CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner){
7698 CHECK(!owner->result_ok);
7699         return *owner->contents.err;
7700 }
7701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7702         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(owner);
7703         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(owner_conv);
7704 }
7705
7706 static jclass LDKOffersMessage_InvoiceRequest_class = NULL;
7707 static jmethodID LDKOffersMessage_InvoiceRequest_meth = NULL;
7708 static jclass LDKOffersMessage_Invoice_class = NULL;
7709 static jmethodID LDKOffersMessage_Invoice_meth = NULL;
7710 static jclass LDKOffersMessage_InvoiceError_class = NULL;
7711 static jmethodID LDKOffersMessage_InvoiceError_meth = NULL;
7712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKOffersMessage_init (JNIEnv *env, jclass clz) {
7713         LDKOffersMessage_InvoiceRequest_class =
7714                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOffersMessage$InvoiceRequest"));
7715         CHECK(LDKOffersMessage_InvoiceRequest_class != NULL);
7716         LDKOffersMessage_InvoiceRequest_meth = (*env)->GetMethodID(env, LDKOffersMessage_InvoiceRequest_class, "<init>", "(J)V");
7717         CHECK(LDKOffersMessage_InvoiceRequest_meth != NULL);
7718         LDKOffersMessage_Invoice_class =
7719                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOffersMessage$Invoice"));
7720         CHECK(LDKOffersMessage_Invoice_class != NULL);
7721         LDKOffersMessage_Invoice_meth = (*env)->GetMethodID(env, LDKOffersMessage_Invoice_class, "<init>", "(J)V");
7722         CHECK(LDKOffersMessage_Invoice_meth != NULL);
7723         LDKOffersMessage_InvoiceError_class =
7724                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOffersMessage$InvoiceError"));
7725         CHECK(LDKOffersMessage_InvoiceError_class != NULL);
7726         LDKOffersMessage_InvoiceError_meth = (*env)->GetMethodID(env, LDKOffersMessage_InvoiceError_class, "<init>", "(J)V");
7727         CHECK(LDKOffersMessage_InvoiceError_meth != NULL);
7728 }
7729 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKOffersMessage_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7730         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
7731         switch(obj->tag) {
7732                 case LDKOffersMessage_InvoiceRequest: {
7733                         LDKInvoiceRequest invoice_request_var = obj->invoice_request;
7734                         int64_t invoice_request_ref = 0;
7735                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
7736                         invoice_request_ref = tag_ptr(invoice_request_var.inner, false);
7737                         return (*env)->NewObject(env, LDKOffersMessage_InvoiceRequest_class, LDKOffersMessage_InvoiceRequest_meth, invoice_request_ref);
7738                 }
7739                 case LDKOffersMessage_Invoice: {
7740                         LDKBolt12Invoice invoice_var = obj->invoice;
7741                         int64_t invoice_ref = 0;
7742                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
7743                         invoice_ref = tag_ptr(invoice_var.inner, false);
7744                         return (*env)->NewObject(env, LDKOffersMessage_Invoice_class, LDKOffersMessage_Invoice_meth, invoice_ref);
7745                 }
7746                 case LDKOffersMessage_InvoiceError: {
7747                         LDKInvoiceError invoice_error_var = obj->invoice_error;
7748                         int64_t invoice_error_ref = 0;
7749                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_error_var);
7750                         invoice_error_ref = tag_ptr(invoice_error_var.inner, false);
7751                         return (*env)->NewObject(env, LDKOffersMessage_InvoiceError_class, LDKOffersMessage_InvoiceError_meth, invoice_error_ref);
7752                 }
7753                 default: abort();
7754         }
7755 }
7756 static jclass LDKCOption_OffersMessageZ_Some_class = NULL;
7757 static jmethodID LDKCOption_OffersMessageZ_Some_meth = NULL;
7758 static jclass LDKCOption_OffersMessageZ_None_class = NULL;
7759 static jmethodID LDKCOption_OffersMessageZ_None_meth = NULL;
7760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1OffersMessageZ_init (JNIEnv *env, jclass clz) {
7761         LDKCOption_OffersMessageZ_Some_class =
7762                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_OffersMessageZ$Some"));
7763         CHECK(LDKCOption_OffersMessageZ_Some_class != NULL);
7764         LDKCOption_OffersMessageZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_OffersMessageZ_Some_class, "<init>", "(J)V");
7765         CHECK(LDKCOption_OffersMessageZ_Some_meth != NULL);
7766         LDKCOption_OffersMessageZ_None_class =
7767                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_OffersMessageZ$None"));
7768         CHECK(LDKCOption_OffersMessageZ_None_class != NULL);
7769         LDKCOption_OffersMessageZ_None_meth = (*env)->GetMethodID(env, LDKCOption_OffersMessageZ_None_class, "<init>", "()V");
7770         CHECK(LDKCOption_OffersMessageZ_None_meth != NULL);
7771 }
7772 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1OffersMessageZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7773         LDKCOption_OffersMessageZ *obj = (LDKCOption_OffersMessageZ*)untag_ptr(ptr);
7774         switch(obj->tag) {
7775                 case LDKCOption_OffersMessageZ_Some: {
7776                         int64_t some_ref = tag_ptr(&obj->some, false);
7777                         return (*env)->NewObject(env, LDKCOption_OffersMessageZ_Some_class, LDKCOption_OffersMessageZ_Some_meth, some_ref);
7778                 }
7779                 case LDKCOption_OffersMessageZ_None: {
7780                         return (*env)->NewObject(env, LDKCOption_OffersMessageZ_None_class, LDKCOption_OffersMessageZ_None_meth);
7781                 }
7782                 default: abort();
7783         }
7784 }
7785 static jclass LDKDestination_Node_class = NULL;
7786 static jmethodID LDKDestination_Node_meth = NULL;
7787 static jclass LDKDestination_BlindedPath_class = NULL;
7788 static jmethodID LDKDestination_BlindedPath_meth = NULL;
7789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKDestination_init (JNIEnv *env, jclass clz) {
7790         LDKDestination_Node_class =
7791                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDestination$Node"));
7792         CHECK(LDKDestination_Node_class != NULL);
7793         LDKDestination_Node_meth = (*env)->GetMethodID(env, LDKDestination_Node_class, "<init>", "([B)V");
7794         CHECK(LDKDestination_Node_meth != NULL);
7795         LDKDestination_BlindedPath_class =
7796                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDestination$BlindedPath"));
7797         CHECK(LDKDestination_BlindedPath_class != NULL);
7798         LDKDestination_BlindedPath_meth = (*env)->GetMethodID(env, LDKDestination_BlindedPath_class, "<init>", "(J)V");
7799         CHECK(LDKDestination_BlindedPath_meth != NULL);
7800 }
7801 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKDestination_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7802         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
7803         switch(obj->tag) {
7804                 case LDKDestination_Node: {
7805                         int8_tArray node_arr = (*env)->NewByteArray(env, 33);
7806                         (*env)->SetByteArrayRegion(env, node_arr, 0, 33, obj->node.compressed_form);
7807                         return (*env)->NewObject(env, LDKDestination_Node_class, LDKDestination_Node_meth, node_arr);
7808                 }
7809                 case LDKDestination_BlindedPath: {
7810                         LDKBlindedPath blinded_path_var = obj->blinded_path;
7811                         int64_t blinded_path_ref = 0;
7812                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_path_var);
7813                         blinded_path_ref = tag_ptr(blinded_path_var.inner, false);
7814                         return (*env)->NewObject(env, LDKDestination_BlindedPath_class, LDKDestination_BlindedPath_meth, blinded_path_ref);
7815                 }
7816                 default: abort();
7817         }
7818 }
7819 static inline struct LDKOffersMessage C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
7820         return OffersMessage_clone(&owner->a);
7821 }
7822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7823         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
7824         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
7825         *ret_copy = C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(owner_conv);
7826         int64_t ret_ref = tag_ptr(ret_copy, true);
7827         return ret_ref;
7828 }
7829
7830 static inline struct LDKDestination C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
7831         return Destination_clone(&owner->b);
7832 }
7833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7834         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
7835         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
7836         *ret_copy = C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(owner_conv);
7837         int64_t ret_ref = tag_ptr(ret_copy, true);
7838         return ret_ref;
7839 }
7840
7841 static inline struct LDKBlindedPath C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
7842         LDKBlindedPath ret = owner->c;
7843         ret.is_owned = false;
7844         return ret;
7845 }
7846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
7847         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
7848         LDKBlindedPath ret_var = C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(owner_conv);
7849         int64_t ret_ref = 0;
7850         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7851         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7852         return ret_ref;
7853 }
7854
7855 static inline LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_clone(const LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ *orig) {
7856         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ) * orig->datalen, "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ clone bytes"), .datalen = orig->datalen };
7857         for (size_t i = 0; i < ret.datalen; i++) {
7858                 ret.data[i] = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(&orig->data[i]);
7859         }
7860         return ret;
7861 }
7862 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
7863         LDKCounterpartyForwardingInfo ret = *owner->contents.result;
7864         ret.is_owned = false;
7865         return ret;
7866 }
7867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7868         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
7869         LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
7870         int64_t ret_ref = 0;
7871         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7872         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7873         return ret_ref;
7874 }
7875
7876 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
7877 CHECK(!owner->result_ok);
7878         return DecodeError_clone(&*owner->contents.err);
7879 }
7880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7881         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
7882         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7883         *ret_copy = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
7884         int64_t ret_ref = tag_ptr(ret_copy, true);
7885         return ret_ref;
7886 }
7887
7888 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
7889         LDKChannelCounterparty ret = *owner->contents.result;
7890         ret.is_owned = false;
7891         return ret;
7892 }
7893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7894         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
7895         LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
7896         int64_t ret_ref = 0;
7897         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7898         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7899         return ret_ref;
7900 }
7901
7902 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
7903 CHECK(!owner->result_ok);
7904         return DecodeError_clone(&*owner->contents.err);
7905 }
7906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7907         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
7908         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7909         *ret_copy = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
7910         int64_t ret_ref = tag_ptr(ret_copy, true);
7911         return ret_ref;
7912 }
7913
7914 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
7915         LDKChannelDetails ret = *owner->contents.result;
7916         ret.is_owned = false;
7917         return ret;
7918 }
7919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7920         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
7921         LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
7922         int64_t ret_ref = 0;
7923         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7924         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7925         return ret_ref;
7926 }
7927
7928 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
7929 CHECK(!owner->result_ok);
7930         return DecodeError_clone(&*owner->contents.err);
7931 }
7932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7933         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
7934         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7935         *ret_copy = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
7936         int64_t ret_ref = tag_ptr(ret_copy, true);
7937         return ret_ref;
7938 }
7939
7940 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
7941         LDKPhantomRouteHints ret = *owner->contents.result;
7942         ret.is_owned = false;
7943         return ret;
7944 }
7945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7946         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
7947         LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
7948         int64_t ret_ref = 0;
7949         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7950         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7951         return ret_ref;
7952 }
7953
7954 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
7955 CHECK(!owner->result_ok);
7956         return DecodeError_clone(&*owner->contents.err);
7957 }
7958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7959         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
7960         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7961         *ret_copy = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
7962         int64_t ret_ref = tag_ptr(ret_copy, true);
7963         return ret_ref;
7964 }
7965
7966 static inline struct LDKBlindedForward CResult_BlindedForwardDecodeErrorZ_get_ok(LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR owner){
7967         LDKBlindedForward ret = *owner->contents.result;
7968         ret.is_owned = false;
7969         return ret;
7970 }
7971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedForwardDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7972         LDKCResult_BlindedForwardDecodeErrorZ* owner_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(owner);
7973         LDKBlindedForward ret_var = CResult_BlindedForwardDecodeErrorZ_get_ok(owner_conv);
7974         int64_t ret_ref = 0;
7975         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7976         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7977         return ret_ref;
7978 }
7979
7980 static inline struct LDKDecodeError CResult_BlindedForwardDecodeErrorZ_get_err(LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR owner){
7981 CHECK(!owner->result_ok);
7982         return DecodeError_clone(&*owner->contents.err);
7983 }
7984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedForwardDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7985         LDKCResult_BlindedForwardDecodeErrorZ* owner_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(owner);
7986         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7987         *ret_copy = CResult_BlindedForwardDecodeErrorZ_get_err(owner_conv);
7988         int64_t ret_ref = tag_ptr(ret_copy, true);
7989         return ret_ref;
7990 }
7991
7992 static jclass LDKPendingHTLCRouting_Forward_class = NULL;
7993 static jmethodID LDKPendingHTLCRouting_Forward_meth = NULL;
7994 static jclass LDKPendingHTLCRouting_Receive_class = NULL;
7995 static jmethodID LDKPendingHTLCRouting_Receive_meth = NULL;
7996 static jclass LDKPendingHTLCRouting_ReceiveKeysend_class = NULL;
7997 static jmethodID LDKPendingHTLCRouting_ReceiveKeysend_meth = NULL;
7998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPendingHTLCRouting_init (JNIEnv *env, jclass clz) {
7999         LDKPendingHTLCRouting_Forward_class =
8000                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPendingHTLCRouting$Forward"));
8001         CHECK(LDKPendingHTLCRouting_Forward_class != NULL);
8002         LDKPendingHTLCRouting_Forward_meth = (*env)->GetMethodID(env, LDKPendingHTLCRouting_Forward_class, "<init>", "(JJJ)V");
8003         CHECK(LDKPendingHTLCRouting_Forward_meth != NULL);
8004         LDKPendingHTLCRouting_Receive_class =
8005                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPendingHTLCRouting$Receive"));
8006         CHECK(LDKPendingHTLCRouting_Receive_class != NULL);
8007         LDKPendingHTLCRouting_Receive_meth = (*env)->GetMethodID(env, LDKPendingHTLCRouting_Receive_class, "<init>", "(JJI[B[JZ)V");
8008         CHECK(LDKPendingHTLCRouting_Receive_meth != NULL);
8009         LDKPendingHTLCRouting_ReceiveKeysend_class =
8010                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPendingHTLCRouting$ReceiveKeysend"));
8011         CHECK(LDKPendingHTLCRouting_ReceiveKeysend_class != NULL);
8012         LDKPendingHTLCRouting_ReceiveKeysend_meth = (*env)->GetMethodID(env, LDKPendingHTLCRouting_ReceiveKeysend_class, "<init>", "(J[BJI[J)V");
8013         CHECK(LDKPendingHTLCRouting_ReceiveKeysend_meth != NULL);
8014 }
8015 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPendingHTLCRouting_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8016         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
8017         switch(obj->tag) {
8018                 case LDKPendingHTLCRouting_Forward: {
8019                         LDKOnionPacket onion_packet_var = obj->forward.onion_packet;
8020                         int64_t onion_packet_ref = 0;
8021                         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_packet_var);
8022                         onion_packet_ref = tag_ptr(onion_packet_var.inner, false);
8023                         int64_t short_channel_id_conv = obj->forward.short_channel_id;
8024                         LDKBlindedForward blinded_var = obj->forward.blinded;
8025                         int64_t blinded_ref = 0;
8026                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_var);
8027                         blinded_ref = tag_ptr(blinded_var.inner, false);
8028                         return (*env)->NewObject(env, LDKPendingHTLCRouting_Forward_class, LDKPendingHTLCRouting_Forward_meth, onion_packet_ref, short_channel_id_conv, blinded_ref);
8029                 }
8030                 case LDKPendingHTLCRouting_Receive: {
8031                         LDKFinalOnionHopData payment_data_var = obj->receive.payment_data;
8032                         int64_t payment_data_ref = 0;
8033                         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_var);
8034                         payment_data_ref = tag_ptr(payment_data_var.inner, false);
8035                         int64_t payment_metadata_ref = tag_ptr(&obj->receive.payment_metadata, false);
8036                         int32_t incoming_cltv_expiry_conv = obj->receive.incoming_cltv_expiry;
8037                         int8_tArray phantom_shared_secret_arr = (*env)->NewByteArray(env, 32);
8038                         (*env)->SetByteArrayRegion(env, phantom_shared_secret_arr, 0, 32, obj->receive.phantom_shared_secret.data);
8039                         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_var = obj->receive.custom_tlvs;
8040                         int64_tArray custom_tlvs_arr = NULL;
8041                         custom_tlvs_arr = (*env)->NewLongArray(env, custom_tlvs_var.datalen);
8042                         int64_t *custom_tlvs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, custom_tlvs_arr, NULL);
8043                         for (size_t x = 0; x < custom_tlvs_var.datalen; x++) {
8044                                 LDKC2Tuple_u64CVec_u8ZZ* custom_tlvs_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
8045                                 *custom_tlvs_conv_23_conv = custom_tlvs_var.data[x];
8046                                 *custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone(custom_tlvs_conv_23_conv);
8047                                 custom_tlvs_arr_ptr[x] = tag_ptr(custom_tlvs_conv_23_conv, true);
8048                         }
8049                         (*env)->ReleasePrimitiveArrayCritical(env, custom_tlvs_arr, custom_tlvs_arr_ptr, 0);
8050                         jboolean requires_blinded_error_conv = obj->receive.requires_blinded_error;
8051                         return (*env)->NewObject(env, LDKPendingHTLCRouting_Receive_class, LDKPendingHTLCRouting_Receive_meth, payment_data_ref, payment_metadata_ref, incoming_cltv_expiry_conv, phantom_shared_secret_arr, custom_tlvs_arr, requires_blinded_error_conv);
8052                 }
8053                 case LDKPendingHTLCRouting_ReceiveKeysend: {
8054                         LDKFinalOnionHopData payment_data_var = obj->receive_keysend.payment_data;
8055                         int64_t payment_data_ref = 0;
8056                         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_var);
8057                         payment_data_ref = tag_ptr(payment_data_var.inner, false);
8058                         int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
8059                         (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->receive_keysend.payment_preimage.data);
8060                         int64_t payment_metadata_ref = tag_ptr(&obj->receive_keysend.payment_metadata, false);
8061                         int32_t incoming_cltv_expiry_conv = obj->receive_keysend.incoming_cltv_expiry;
8062                         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_var = obj->receive_keysend.custom_tlvs;
8063                         int64_tArray custom_tlvs_arr = NULL;
8064                         custom_tlvs_arr = (*env)->NewLongArray(env, custom_tlvs_var.datalen);
8065                         int64_t *custom_tlvs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, custom_tlvs_arr, NULL);
8066                         for (size_t x = 0; x < custom_tlvs_var.datalen; x++) {
8067                                 LDKC2Tuple_u64CVec_u8ZZ* custom_tlvs_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
8068                                 *custom_tlvs_conv_23_conv = custom_tlvs_var.data[x];
8069                                 *custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone(custom_tlvs_conv_23_conv);
8070                                 custom_tlvs_arr_ptr[x] = tag_ptr(custom_tlvs_conv_23_conv, true);
8071                         }
8072                         (*env)->ReleasePrimitiveArrayCritical(env, custom_tlvs_arr, custom_tlvs_arr_ptr, 0);
8073                         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);
8074                 }
8075                 default: abort();
8076         }
8077 }
8078 static inline struct LDKPendingHTLCRouting CResult_PendingHTLCRoutingDecodeErrorZ_get_ok(LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR owner){
8079 CHECK(owner->result_ok);
8080         return PendingHTLCRouting_clone(&*owner->contents.result);
8081 }
8082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCRoutingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8083         LDKCResult_PendingHTLCRoutingDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(owner);
8084         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
8085         *ret_copy = CResult_PendingHTLCRoutingDecodeErrorZ_get_ok(owner_conv);
8086         int64_t ret_ref = tag_ptr(ret_copy, true);
8087         return ret_ref;
8088 }
8089
8090 static inline struct LDKDecodeError CResult_PendingHTLCRoutingDecodeErrorZ_get_err(LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR owner){
8091 CHECK(!owner->result_ok);
8092         return DecodeError_clone(&*owner->contents.err);
8093 }
8094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCRoutingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8095         LDKCResult_PendingHTLCRoutingDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(owner);
8096         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8097         *ret_copy = CResult_PendingHTLCRoutingDecodeErrorZ_get_err(owner_conv);
8098         int64_t ret_ref = tag_ptr(ret_copy, true);
8099         return ret_ref;
8100 }
8101
8102 static inline struct LDKPendingHTLCInfo CResult_PendingHTLCInfoDecodeErrorZ_get_ok(LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR owner){
8103         LDKPendingHTLCInfo ret = *owner->contents.result;
8104         ret.is_owned = false;
8105         return ret;
8106 }
8107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8108         LDKCResult_PendingHTLCInfoDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(owner);
8109         LDKPendingHTLCInfo ret_var = CResult_PendingHTLCInfoDecodeErrorZ_get_ok(owner_conv);
8110         int64_t ret_ref = 0;
8111         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8112         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8113         return ret_ref;
8114 }
8115
8116 static inline struct LDKDecodeError CResult_PendingHTLCInfoDecodeErrorZ_get_err(LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR owner){
8117 CHECK(!owner->result_ok);
8118         return DecodeError_clone(&*owner->contents.err);
8119 }
8120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8121         LDKCResult_PendingHTLCInfoDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(owner);
8122         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8123         *ret_copy = CResult_PendingHTLCInfoDecodeErrorZ_get_err(owner_conv);
8124         int64_t ret_ref = tag_ptr(ret_copy, true);
8125         return ret_ref;
8126 }
8127
8128 static inline enum LDKBlindedFailure CResult_BlindedFailureDecodeErrorZ_get_ok(LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR owner){
8129 CHECK(owner->result_ok);
8130         return BlindedFailure_clone(&*owner->contents.result);
8131 }
8132 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedFailureDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8133         LDKCResult_BlindedFailureDecodeErrorZ* owner_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(owner);
8134         jclass ret_conv = LDKBlindedFailure_to_java(env, CResult_BlindedFailureDecodeErrorZ_get_ok(owner_conv));
8135         return ret_conv;
8136 }
8137
8138 static inline struct LDKDecodeError CResult_BlindedFailureDecodeErrorZ_get_err(LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR owner){
8139 CHECK(!owner->result_ok);
8140         return DecodeError_clone(&*owner->contents.err);
8141 }
8142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedFailureDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8143         LDKCResult_BlindedFailureDecodeErrorZ* owner_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(owner);
8144         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8145         *ret_copy = CResult_BlindedFailureDecodeErrorZ_get_err(owner_conv);
8146         int64_t ret_ref = tag_ptr(ret_copy, true);
8147         return ret_ref;
8148 }
8149
8150 static inline enum LDKChannelShutdownState CResult_ChannelShutdownStateDecodeErrorZ_get_ok(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
8151 CHECK(owner->result_ok);
8152         return ChannelShutdownState_clone(&*owner->contents.result);
8153 }
8154 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8155         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
8156         jclass ret_conv = LDKChannelShutdownState_to_java(env, CResult_ChannelShutdownStateDecodeErrorZ_get_ok(owner_conv));
8157         return ret_conv;
8158 }
8159
8160 static inline struct LDKDecodeError CResult_ChannelShutdownStateDecodeErrorZ_get_err(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
8161 CHECK(!owner->result_ok);
8162         return DecodeError_clone(&*owner->contents.err);
8163 }
8164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8165         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
8166         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8167         *ret_copy = CResult_ChannelShutdownStateDecodeErrorZ_get_err(owner_conv);
8168         int64_t ret_ref = tag_ptr(ret_copy, true);
8169         return ret_ref;
8170 }
8171
8172 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
8173         LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
8174         for (size_t i = 0; i < ret.datalen; i++) {
8175                 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
8176         }
8177         return ret;
8178 }
8179 typedef struct LDKWatch_JCalls {
8180         atomic_size_t refcnt;
8181         JavaVM *vm;
8182         jweak o;
8183         jmethodID watch_channel_meth;
8184         jmethodID update_channel_meth;
8185         jmethodID release_pending_monitor_events_meth;
8186 } LDKWatch_JCalls;
8187 static void LDKWatch_JCalls_free(void* this_arg) {
8188         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
8189         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8190                 JNIEnv *env;
8191                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8192                 if (get_jenv_res == JNI_EDETACHED) {
8193                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8194                 } else {
8195                         DO_ASSERT(get_jenv_res == JNI_OK);
8196                 }
8197                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8198                 if (get_jenv_res == JNI_EDETACHED) {
8199                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8200                 }
8201                 FREE(j_calls);
8202         }
8203 }
8204 LDKCResult_ChannelMonitorUpdateStatusNoneZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
8205         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
8206         JNIEnv *env;
8207         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8208         if (get_jenv_res == JNI_EDETACHED) {
8209                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8210         } else {
8211                 DO_ASSERT(get_jenv_res == JNI_OK);
8212         }
8213         LDKOutPoint funding_txo_var = funding_txo;
8214         int64_t funding_txo_ref = 0;
8215         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
8216         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
8217         LDKChannelMonitor monitor_var = monitor;
8218         int64_t monitor_ref = 0;
8219         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
8220         monitor_ref = tag_ptr(monitor_var.inner, monitor_var.is_owned);
8221         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8222         CHECK(obj != NULL);
8223         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
8224         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8225                 (*env)->ExceptionDescribe(env);
8226                 (*env)->FatalError(env, "A call to watch_channel in LDKWatch from rust threw an exception.");
8227         }
8228         void* ret_ptr = untag_ptr(ret);
8229         CHECK_ACCESS(ret_ptr);
8230         LDKCResult_ChannelMonitorUpdateStatusNoneZ ret_conv = *(LDKCResult_ChannelMonitorUpdateStatusNoneZ*)(ret_ptr);
8231         FREE(untag_ptr(ret));
8232         if (get_jenv_res == JNI_EDETACHED) {
8233                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8234         }
8235         return ret_conv;
8236 }
8237 LDKChannelMonitorUpdateStatus update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, const LDKChannelMonitorUpdate * update) {
8238         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
8239         JNIEnv *env;
8240         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8241         if (get_jenv_res == JNI_EDETACHED) {
8242                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8243         } else {
8244                 DO_ASSERT(get_jenv_res == JNI_OK);
8245         }
8246         LDKOutPoint funding_txo_var = funding_txo;
8247         int64_t funding_txo_ref = 0;
8248         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
8249         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
8250         LDKChannelMonitorUpdate update_var = *update;
8251         int64_t update_ref = 0;
8252         update_var = ChannelMonitorUpdate_clone(&update_var);
8253         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
8254         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
8255         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8256         CHECK(obj != NULL);
8257         jclass ret = (*env)->CallObjectMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
8258         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8259                 (*env)->ExceptionDescribe(env);
8260                 (*env)->FatalError(env, "A call to update_channel in LDKWatch from rust threw an exception.");
8261         }
8262         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_java(env, ret);
8263         if (get_jenv_res == JNI_EDETACHED) {
8264                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8265         }
8266         return ret_conv;
8267 }
8268 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
8269         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
8270         JNIEnv *env;
8271         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8272         if (get_jenv_res == JNI_EDETACHED) {
8273                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8274         } else {
8275                 DO_ASSERT(get_jenv_res == JNI_OK);
8276         }
8277         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8278         CHECK(obj != NULL);
8279         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
8280         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8281                 (*env)->ExceptionDescribe(env);
8282                 (*env)->FatalError(env, "A call to release_pending_monitor_events in LDKWatch from rust threw an exception.");
8283         }
8284         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_constr;
8285         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
8286         if (ret_constr.datalen > 0)
8287                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
8288         else
8289                 ret_constr.data = NULL;
8290         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
8291         for (size_t x = 0; x < ret_constr.datalen; x++) {
8292                 int64_t ret_conv_49 = ret_vals[x];
8293                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
8294                 CHECK_ACCESS(ret_conv_49_ptr);
8295                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ ret_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(ret_conv_49_ptr);
8296                 FREE(untag_ptr(ret_conv_49));
8297                 ret_constr.data[x] = ret_conv_49_conv;
8298         }
8299         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
8300         if (get_jenv_res == JNI_EDETACHED) {
8301                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8302         }
8303         return ret_constr;
8304 }
8305 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
8306         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
8307         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8308 }
8309 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
8310         jclass c = (*env)->GetObjectClass(env, o);
8311         CHECK(c != NULL);
8312         LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
8313         atomic_init(&calls->refcnt, 1);
8314         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8315         calls->o = (*env)->NewWeakGlobalRef(env, o);
8316         calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
8317         CHECK(calls->watch_channel_meth != NULL);
8318         calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
8319         CHECK(calls->update_channel_meth != NULL);
8320         calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
8321         CHECK(calls->release_pending_monitor_events_meth != NULL);
8322
8323         LDKWatch ret = {
8324                 .this_arg = (void*) calls,
8325                 .watch_channel = watch_channel_LDKWatch_jcall,
8326                 .update_channel = update_channel_LDKWatch_jcall,
8327                 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
8328                 .free = LDKWatch_JCalls_free,
8329         };
8330         return ret;
8331 }
8332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
8333         LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
8334         *res_ptr = LDKWatch_init(env, clz, o);
8335         return tag_ptr(res_ptr, true);
8336 }
8337 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) {
8338         void* this_arg_ptr = untag_ptr(this_arg);
8339         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8340         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
8341         LDKOutPoint funding_txo_conv;
8342         funding_txo_conv.inner = untag_ptr(funding_txo);
8343         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
8344         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
8345         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
8346         LDKChannelMonitor monitor_conv;
8347         monitor_conv.inner = untag_ptr(monitor);
8348         monitor_conv.is_owned = ptr_is_owned(monitor);
8349         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
8350         monitor_conv = ChannelMonitor_clone(&monitor_conv);
8351         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
8352         *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
8353         return tag_ptr(ret_conv, true);
8354 }
8355
8356 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) {
8357         void* this_arg_ptr = untag_ptr(this_arg);
8358         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8359         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
8360         LDKOutPoint funding_txo_conv;
8361         funding_txo_conv.inner = untag_ptr(funding_txo);
8362         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
8363         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
8364         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
8365         LDKChannelMonitorUpdate update_conv;
8366         update_conv.inner = untag_ptr(update);
8367         update_conv.is_owned = ptr_is_owned(update);
8368         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
8369         update_conv.is_owned = false;
8370         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, &update_conv));
8371         return ret_conv;
8372 }
8373
8374 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
8375         void* this_arg_ptr = untag_ptr(this_arg);
8376         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8377         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
8378         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
8379         int64_tArray ret_arr = NULL;
8380         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8381         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8382         for (size_t x = 0; x < ret_var.datalen; x++) {
8383                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
8384                 *ret_conv_49_conv = ret_var.data[x];
8385                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
8386         }
8387         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8388         FREE(ret_var.data);
8389         return ret_arr;
8390 }
8391
8392 typedef struct LDKBroadcasterInterface_JCalls {
8393         atomic_size_t refcnt;
8394         JavaVM *vm;
8395         jweak o;
8396         jmethodID broadcast_transactions_meth;
8397 } LDKBroadcasterInterface_JCalls;
8398 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
8399         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
8400         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8401                 JNIEnv *env;
8402                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8403                 if (get_jenv_res == JNI_EDETACHED) {
8404                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8405                 } else {
8406                         DO_ASSERT(get_jenv_res == JNI_OK);
8407                 }
8408                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8409                 if (get_jenv_res == JNI_EDETACHED) {
8410                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8411                 }
8412                 FREE(j_calls);
8413         }
8414 }
8415 void broadcast_transactions_LDKBroadcasterInterface_jcall(const void* this_arg, LDKCVec_TransactionZ txs) {
8416         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
8417         JNIEnv *env;
8418         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8419         if (get_jenv_res == JNI_EDETACHED) {
8420                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8421         } else {
8422                 DO_ASSERT(get_jenv_res == JNI_OK);
8423         }
8424         LDKCVec_TransactionZ txs_var = txs;
8425         jobjectArray txs_arr = NULL;
8426         txs_arr = (*env)->NewObjectArray(env, txs_var.datalen, arr_of_B_clz, NULL);
8427         ;
8428         for (size_t i = 0; i < txs_var.datalen; i++) {
8429                 LDKTransaction txs_conv_8_var = txs_var.data[i];
8430                 int8_tArray txs_conv_8_arr = (*env)->NewByteArray(env, txs_conv_8_var.datalen);
8431                 (*env)->SetByteArrayRegion(env, txs_conv_8_arr, 0, txs_conv_8_var.datalen, txs_conv_8_var.data);
8432                 Transaction_free(txs_conv_8_var);
8433                 (*env)->SetObjectArrayElement(env, txs_arr, i, txs_conv_8_arr);
8434         }
8435         
8436         FREE(txs_var.data);
8437         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8438         CHECK(obj != NULL);
8439         (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transactions_meth, txs_arr);
8440         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8441                 (*env)->ExceptionDescribe(env);
8442                 (*env)->FatalError(env, "A call to broadcast_transactions in LDKBroadcasterInterface from rust threw an exception.");
8443         }
8444         if (get_jenv_res == JNI_EDETACHED) {
8445                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8446         }
8447 }
8448 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
8449         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
8450         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8451 }
8452 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
8453         jclass c = (*env)->GetObjectClass(env, o);
8454         CHECK(c != NULL);
8455         LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
8456         atomic_init(&calls->refcnt, 1);
8457         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8458         calls->o = (*env)->NewWeakGlobalRef(env, o);
8459         calls->broadcast_transactions_meth = (*env)->GetMethodID(env, c, "broadcast_transactions", "([[B)V");
8460         CHECK(calls->broadcast_transactions_meth != NULL);
8461
8462         LDKBroadcasterInterface ret = {
8463                 .this_arg = (void*) calls,
8464                 .broadcast_transactions = broadcast_transactions_LDKBroadcasterInterface_jcall,
8465                 .free = LDKBroadcasterInterface_JCalls_free,
8466         };
8467         return ret;
8468 }
8469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
8470         LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
8471         *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
8472         return tag_ptr(res_ptr, true);
8473 }
8474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transactions(JNIEnv *env, jclass clz, int64_t this_arg, jobjectArray txs) {
8475         void* this_arg_ptr = untag_ptr(this_arg);
8476         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8477         LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
8478         LDKCVec_TransactionZ txs_constr;
8479         txs_constr.datalen = (*env)->GetArrayLength(env, txs);
8480         if (txs_constr.datalen > 0)
8481                 txs_constr.data = MALLOC(txs_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
8482         else
8483                 txs_constr.data = NULL;
8484         for (size_t i = 0; i < txs_constr.datalen; i++) {
8485                 int8_tArray txs_conv_8 = (*env)->GetObjectArrayElement(env, txs, i);
8486                 LDKTransaction txs_conv_8_ref;
8487                 txs_conv_8_ref.datalen = (*env)->GetArrayLength(env, txs_conv_8);
8488                 txs_conv_8_ref.data = MALLOC(txs_conv_8_ref.datalen, "LDKTransaction Bytes");
8489                 (*env)->GetByteArrayRegion(env, txs_conv_8, 0, txs_conv_8_ref.datalen, txs_conv_8_ref.data);
8490                 txs_conv_8_ref.data_is_owned = true;
8491                 txs_constr.data[i] = txs_conv_8_ref;
8492         }
8493         (this_arg_conv->broadcast_transactions)(this_arg_conv->this_arg, txs_constr);
8494 }
8495
8496 typedef struct LDKEntropySource_JCalls {
8497         atomic_size_t refcnt;
8498         JavaVM *vm;
8499         jweak o;
8500         jmethodID get_secure_random_bytes_meth;
8501 } LDKEntropySource_JCalls;
8502 static void LDKEntropySource_JCalls_free(void* this_arg) {
8503         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
8504         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8505                 JNIEnv *env;
8506                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8507                 if (get_jenv_res == JNI_EDETACHED) {
8508                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8509                 } else {
8510                         DO_ASSERT(get_jenv_res == JNI_OK);
8511                 }
8512                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8513                 if (get_jenv_res == JNI_EDETACHED) {
8514                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8515                 }
8516                 FREE(j_calls);
8517         }
8518 }
8519 LDKThirtyTwoBytes get_secure_random_bytes_LDKEntropySource_jcall(const void* this_arg) {
8520         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
8521         JNIEnv *env;
8522         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8523         if (get_jenv_res == JNI_EDETACHED) {
8524                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8525         } else {
8526                 DO_ASSERT(get_jenv_res == JNI_OK);
8527         }
8528         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8529         CHECK(obj != NULL);
8530         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
8531         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8532                 (*env)->ExceptionDescribe(env);
8533                 (*env)->FatalError(env, "A call to get_secure_random_bytes in LDKEntropySource from rust threw an exception.");
8534         }
8535         LDKThirtyTwoBytes ret_ref;
8536         CHECK((*env)->GetArrayLength(env, ret) == 32);
8537         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
8538         if (get_jenv_res == JNI_EDETACHED) {
8539                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8540         }
8541         return ret_ref;
8542 }
8543 static void LDKEntropySource_JCalls_cloned(LDKEntropySource* new_obj) {
8544         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) new_obj->this_arg;
8545         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8546 }
8547 static inline LDKEntropySource LDKEntropySource_init (JNIEnv *env, jclass clz, jobject o) {
8548         jclass c = (*env)->GetObjectClass(env, o);
8549         CHECK(c != NULL);
8550         LDKEntropySource_JCalls *calls = MALLOC(sizeof(LDKEntropySource_JCalls), "LDKEntropySource_JCalls");
8551         atomic_init(&calls->refcnt, 1);
8552         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8553         calls->o = (*env)->NewWeakGlobalRef(env, o);
8554         calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
8555         CHECK(calls->get_secure_random_bytes_meth != NULL);
8556
8557         LDKEntropySource ret = {
8558                 .this_arg = (void*) calls,
8559                 .get_secure_random_bytes = get_secure_random_bytes_LDKEntropySource_jcall,
8560                 .free = LDKEntropySource_JCalls_free,
8561         };
8562         return ret;
8563 }
8564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEntropySource_1new(JNIEnv *env, jclass clz, jobject o) {
8565         LDKEntropySource *res_ptr = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
8566         *res_ptr = LDKEntropySource_init(env, clz, o);
8567         return tag_ptr(res_ptr, true);
8568 }
8569 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_EntropySource_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
8570         void* this_arg_ptr = untag_ptr(this_arg);
8571         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8572         LDKEntropySource* this_arg_conv = (LDKEntropySource*)this_arg_ptr;
8573         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8574         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
8575         return ret_arr;
8576 }
8577
8578 static jclass LDKUnsignedGossipMessage_ChannelAnnouncement_class = NULL;
8579 static jmethodID LDKUnsignedGossipMessage_ChannelAnnouncement_meth = NULL;
8580 static jclass LDKUnsignedGossipMessage_ChannelUpdate_class = NULL;
8581 static jmethodID LDKUnsignedGossipMessage_ChannelUpdate_meth = NULL;
8582 static jclass LDKUnsignedGossipMessage_NodeAnnouncement_class = NULL;
8583 static jmethodID LDKUnsignedGossipMessage_NodeAnnouncement_meth = NULL;
8584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKUnsignedGossipMessage_init (JNIEnv *env, jclass clz) {
8585         LDKUnsignedGossipMessage_ChannelAnnouncement_class =
8586                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUnsignedGossipMessage$ChannelAnnouncement"));
8587         CHECK(LDKUnsignedGossipMessage_ChannelAnnouncement_class != NULL);
8588         LDKUnsignedGossipMessage_ChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKUnsignedGossipMessage_ChannelAnnouncement_class, "<init>", "(J)V");
8589         CHECK(LDKUnsignedGossipMessage_ChannelAnnouncement_meth != NULL);
8590         LDKUnsignedGossipMessage_ChannelUpdate_class =
8591                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUnsignedGossipMessage$ChannelUpdate"));
8592         CHECK(LDKUnsignedGossipMessage_ChannelUpdate_class != NULL);
8593         LDKUnsignedGossipMessage_ChannelUpdate_meth = (*env)->GetMethodID(env, LDKUnsignedGossipMessage_ChannelUpdate_class, "<init>", "(J)V");
8594         CHECK(LDKUnsignedGossipMessage_ChannelUpdate_meth != NULL);
8595         LDKUnsignedGossipMessage_NodeAnnouncement_class =
8596                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUnsignedGossipMessage$NodeAnnouncement"));
8597         CHECK(LDKUnsignedGossipMessage_NodeAnnouncement_class != NULL);
8598         LDKUnsignedGossipMessage_NodeAnnouncement_meth = (*env)->GetMethodID(env, LDKUnsignedGossipMessage_NodeAnnouncement_class, "<init>", "(J)V");
8599         CHECK(LDKUnsignedGossipMessage_NodeAnnouncement_meth != NULL);
8600 }
8601 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKUnsignedGossipMessage_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8602         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
8603         switch(obj->tag) {
8604                 case LDKUnsignedGossipMessage_ChannelAnnouncement: {
8605                         LDKUnsignedChannelAnnouncement channel_announcement_var = obj->channel_announcement;
8606                         int64_t channel_announcement_ref = 0;
8607                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_announcement_var);
8608                         channel_announcement_ref = tag_ptr(channel_announcement_var.inner, false);
8609                         return (*env)->NewObject(env, LDKUnsignedGossipMessage_ChannelAnnouncement_class, LDKUnsignedGossipMessage_ChannelAnnouncement_meth, channel_announcement_ref);
8610                 }
8611                 case LDKUnsignedGossipMessage_ChannelUpdate: {
8612                         LDKUnsignedChannelUpdate channel_update_var = obj->channel_update;
8613                         int64_t channel_update_ref = 0;
8614                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_update_var);
8615                         channel_update_ref = tag_ptr(channel_update_var.inner, false);
8616                         return (*env)->NewObject(env, LDKUnsignedGossipMessage_ChannelUpdate_class, LDKUnsignedGossipMessage_ChannelUpdate_meth, channel_update_ref);
8617                 }
8618                 case LDKUnsignedGossipMessage_NodeAnnouncement: {
8619                         LDKUnsignedNodeAnnouncement node_announcement_var = obj->node_announcement;
8620                         int64_t node_announcement_ref = 0;
8621                         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_announcement_var);
8622                         node_announcement_ref = tag_ptr(node_announcement_var.inner, false);
8623                         return (*env)->NewObject(env, LDKUnsignedGossipMessage_NodeAnnouncement_class, LDKUnsignedGossipMessage_NodeAnnouncement_meth, node_announcement_ref);
8624                 }
8625                 default: abort();
8626         }
8627 }
8628 typedef struct LDKNodeSigner_JCalls {
8629         atomic_size_t refcnt;
8630         JavaVM *vm;
8631         jweak o;
8632         jmethodID get_inbound_payment_key_material_meth;
8633         jmethodID get_node_id_meth;
8634         jmethodID ecdh_meth;
8635         jmethodID sign_invoice_meth;
8636         jmethodID sign_bolt12_invoice_request_meth;
8637         jmethodID sign_bolt12_invoice_meth;
8638         jmethodID sign_gossip_message_meth;
8639 } LDKNodeSigner_JCalls;
8640 static void LDKNodeSigner_JCalls_free(void* this_arg) {
8641         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
8642         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8643                 JNIEnv *env;
8644                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8645                 if (get_jenv_res == JNI_EDETACHED) {
8646                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8647                 } else {
8648                         DO_ASSERT(get_jenv_res == JNI_OK);
8649                 }
8650                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8651                 if (get_jenv_res == JNI_EDETACHED) {
8652                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8653                 }
8654                 FREE(j_calls);
8655         }
8656 }
8657 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKNodeSigner_jcall(const void* this_arg) {
8658         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
8659         JNIEnv *env;
8660         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8661         if (get_jenv_res == JNI_EDETACHED) {
8662                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8663         } else {
8664                 DO_ASSERT(get_jenv_res == JNI_OK);
8665         }
8666         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8667         CHECK(obj != NULL);
8668         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_inbound_payment_key_material_meth);
8669         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8670                 (*env)->ExceptionDescribe(env);
8671                 (*env)->FatalError(env, "A call to get_inbound_payment_key_material in LDKNodeSigner from rust threw an exception.");
8672         }
8673         LDKThirtyTwoBytes ret_ref;
8674         CHECK((*env)->GetArrayLength(env, ret) == 32);
8675         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
8676         if (get_jenv_res == JNI_EDETACHED) {
8677                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8678         }
8679         return ret_ref;
8680 }
8681 LDKCResult_PublicKeyNoneZ get_node_id_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient) {
8682         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
8683         JNIEnv *env;
8684         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8685         if (get_jenv_res == JNI_EDETACHED) {
8686                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8687         } else {
8688                 DO_ASSERT(get_jenv_res == JNI_OK);
8689         }
8690         jclass recipient_conv = LDKRecipient_to_java(env, recipient);
8691         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8692         CHECK(obj != NULL);
8693         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_node_id_meth, recipient_conv);
8694         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8695                 (*env)->ExceptionDescribe(env);
8696                 (*env)->FatalError(env, "A call to get_node_id in LDKNodeSigner from rust threw an exception.");
8697         }
8698         void* ret_ptr = untag_ptr(ret);
8699         CHECK_ACCESS(ret_ptr);
8700         LDKCResult_PublicKeyNoneZ ret_conv = *(LDKCResult_PublicKeyNoneZ*)(ret_ptr);
8701         FREE(untag_ptr(ret));
8702         if (get_jenv_res == JNI_EDETACHED) {
8703                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8704         }
8705         return ret_conv;
8706 }
8707 LDKCResult_ThirtyTwoBytesNoneZ ecdh_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient, LDKPublicKey other_key, LDKCOption_BigEndianScalarZ tweak) {
8708         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
8709         JNIEnv *env;
8710         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8711         if (get_jenv_res == JNI_EDETACHED) {
8712                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8713         } else {
8714                 DO_ASSERT(get_jenv_res == JNI_OK);
8715         }
8716         jclass recipient_conv = LDKRecipient_to_java(env, recipient);
8717         int8_tArray other_key_arr = (*env)->NewByteArray(env, 33);
8718         (*env)->SetByteArrayRegion(env, other_key_arr, 0, 33, other_key.compressed_form);
8719         LDKCOption_BigEndianScalarZ *tweak_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
8720         *tweak_copy = tweak;
8721         int64_t tweak_ref = tag_ptr(tweak_copy, true);
8722         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8723         CHECK(obj != NULL);
8724         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->ecdh_meth, recipient_conv, other_key_arr, tweak_ref);
8725         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8726                 (*env)->ExceptionDescribe(env);
8727                 (*env)->FatalError(env, "A call to ecdh in LDKNodeSigner from rust threw an exception.");
8728         }
8729         void* ret_ptr = untag_ptr(ret);
8730         CHECK_ACCESS(ret_ptr);
8731         LDKCResult_ThirtyTwoBytesNoneZ ret_conv = *(LDKCResult_ThirtyTwoBytesNoneZ*)(ret_ptr);
8732         FREE(untag_ptr(ret));
8733         if (get_jenv_res == JNI_EDETACHED) {
8734                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8735         }
8736         return ret_conv;
8737 }
8738 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKNodeSigner_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_U5Z invoice_data, LDKRecipient recipient) {
8739         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
8740         JNIEnv *env;
8741         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8742         if (get_jenv_res == JNI_EDETACHED) {
8743                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8744         } else {
8745                 DO_ASSERT(get_jenv_res == JNI_OK);
8746         }
8747         LDKu8slice hrp_bytes_var = hrp_bytes;
8748         int8_tArray hrp_bytes_arr = (*env)->NewByteArray(env, hrp_bytes_var.datalen);
8749         (*env)->SetByteArrayRegion(env, hrp_bytes_arr, 0, hrp_bytes_var.datalen, hrp_bytes_var.data);
8750         LDKCVec_U5Z invoice_data_var = invoice_data;
8751         jobjectArray invoice_data_arr = NULL;
8752         invoice_data_arr = (*env)->NewByteArray(env, invoice_data_var.datalen);
8753         int8_t *invoice_data_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, invoice_data_arr, NULL);
8754         for (size_t h = 0; h < invoice_data_var.datalen; h++) {
8755                 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
8756                 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
8757         }
8758         (*env)->ReleasePrimitiveArrayCritical(env, invoice_data_arr, invoice_data_arr_ptr, 0);
8759         FREE(invoice_data_var.data);
8760         jclass recipient_conv = LDKRecipient_to_java(env, recipient);
8761         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8762         CHECK(obj != NULL);
8763         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, hrp_bytes_arr, invoice_data_arr, recipient_conv);
8764         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8765                 (*env)->ExceptionDescribe(env);
8766                 (*env)->FatalError(env, "A call to sign_invoice in LDKNodeSigner from rust threw an exception.");
8767         }
8768         void* ret_ptr = untag_ptr(ret);
8769         CHECK_ACCESS(ret_ptr);
8770         LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
8771         FREE(untag_ptr(ret));
8772         if (get_jenv_res == JNI_EDETACHED) {
8773                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8774         }
8775         return ret_conv;
8776 }
8777 LDKCResult_SchnorrSignatureNoneZ sign_bolt12_invoice_request_LDKNodeSigner_jcall(const void* this_arg, const LDKUnsignedInvoiceRequest * invoice_request) {
8778         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
8779         JNIEnv *env;
8780         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8781         if (get_jenv_res == JNI_EDETACHED) {
8782                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8783         } else {
8784                 DO_ASSERT(get_jenv_res == JNI_OK);
8785         }
8786         LDKUnsignedInvoiceRequest invoice_request_var = *invoice_request;
8787         int64_t invoice_request_ref = 0;
8788         // WARNING: we may need a move here but no clone is available for LDKUnsignedInvoiceRequest
8789         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
8790         invoice_request_ref = tag_ptr(invoice_request_var.inner, invoice_request_var.is_owned);
8791         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8792         CHECK(obj != NULL);
8793         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_bolt12_invoice_request_meth, invoice_request_ref);
8794         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8795                 (*env)->ExceptionDescribe(env);
8796                 (*env)->FatalError(env, "A call to sign_bolt12_invoice_request in LDKNodeSigner from rust threw an exception.");
8797         }
8798         void* ret_ptr = untag_ptr(ret);
8799         CHECK_ACCESS(ret_ptr);
8800         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
8801         FREE(untag_ptr(ret));
8802         if (get_jenv_res == JNI_EDETACHED) {
8803                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8804         }
8805         return ret_conv;
8806 }
8807 LDKCResult_SchnorrSignatureNoneZ sign_bolt12_invoice_LDKNodeSigner_jcall(const void* this_arg, const LDKUnsignedBolt12Invoice * invoice) {
8808         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
8809         JNIEnv *env;
8810         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8811         if (get_jenv_res == JNI_EDETACHED) {
8812                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8813         } else {
8814                 DO_ASSERT(get_jenv_res == JNI_OK);
8815         }
8816         LDKUnsignedBolt12Invoice invoice_var = *invoice;
8817         int64_t invoice_ref = 0;
8818         // WARNING: we may need a move here but no clone is available for LDKUnsignedBolt12Invoice
8819         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
8820         invoice_ref = tag_ptr(invoice_var.inner, invoice_var.is_owned);
8821         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8822         CHECK(obj != NULL);
8823         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_bolt12_invoice_meth, invoice_ref);
8824         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8825                 (*env)->ExceptionDescribe(env);
8826                 (*env)->FatalError(env, "A call to sign_bolt12_invoice in LDKNodeSigner from rust threw an exception.");
8827         }
8828         void* ret_ptr = untag_ptr(ret);
8829         CHECK_ACCESS(ret_ptr);
8830         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
8831         FREE(untag_ptr(ret));
8832         if (get_jenv_res == JNI_EDETACHED) {
8833                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8834         }
8835         return ret_conv;
8836 }
8837 LDKCResult_ECDSASignatureNoneZ sign_gossip_message_LDKNodeSigner_jcall(const void* this_arg, LDKUnsignedGossipMessage msg) {
8838         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
8839         JNIEnv *env;
8840         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8841         if (get_jenv_res == JNI_EDETACHED) {
8842                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8843         } else {
8844                 DO_ASSERT(get_jenv_res == JNI_OK);
8845         }
8846         LDKUnsignedGossipMessage *msg_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
8847         *msg_copy = msg;
8848         int64_t msg_ref = tag_ptr(msg_copy, true);
8849         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8850         CHECK(obj != NULL);
8851         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_gossip_message_meth, msg_ref);
8852         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8853                 (*env)->ExceptionDescribe(env);
8854                 (*env)->FatalError(env, "A call to sign_gossip_message in LDKNodeSigner from rust threw an exception.");
8855         }
8856         void* ret_ptr = untag_ptr(ret);
8857         CHECK_ACCESS(ret_ptr);
8858         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
8859         FREE(untag_ptr(ret));
8860         if (get_jenv_res == JNI_EDETACHED) {
8861                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8862         }
8863         return ret_conv;
8864 }
8865 static void LDKNodeSigner_JCalls_cloned(LDKNodeSigner* new_obj) {
8866         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) new_obj->this_arg;
8867         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8868 }
8869 static inline LDKNodeSigner LDKNodeSigner_init (JNIEnv *env, jclass clz, jobject o) {
8870         jclass c = (*env)->GetObjectClass(env, o);
8871         CHECK(c != NULL);
8872         LDKNodeSigner_JCalls *calls = MALLOC(sizeof(LDKNodeSigner_JCalls), "LDKNodeSigner_JCalls");
8873         atomic_init(&calls->refcnt, 1);
8874         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8875         calls->o = (*env)->NewWeakGlobalRef(env, o);
8876         calls->get_inbound_payment_key_material_meth = (*env)->GetMethodID(env, c, "get_inbound_payment_key_material", "()[B");
8877         CHECK(calls->get_inbound_payment_key_material_meth != NULL);
8878         calls->get_node_id_meth = (*env)->GetMethodID(env, c, "get_node_id", "(Lorg/ldk/enums/Recipient;)J");
8879         CHECK(calls->get_node_id_meth != NULL);
8880         calls->ecdh_meth = (*env)->GetMethodID(env, c, "ecdh", "(Lorg/ldk/enums/Recipient;[BJ)J");
8881         CHECK(calls->ecdh_meth != NULL);
8882         calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B[BLorg/ldk/enums/Recipient;)J");
8883         CHECK(calls->sign_invoice_meth != NULL);
8884         calls->sign_bolt12_invoice_request_meth = (*env)->GetMethodID(env, c, "sign_bolt12_invoice_request", "(J)J");
8885         CHECK(calls->sign_bolt12_invoice_request_meth != NULL);
8886         calls->sign_bolt12_invoice_meth = (*env)->GetMethodID(env, c, "sign_bolt12_invoice", "(J)J");
8887         CHECK(calls->sign_bolt12_invoice_meth != NULL);
8888         calls->sign_gossip_message_meth = (*env)->GetMethodID(env, c, "sign_gossip_message", "(J)J");
8889         CHECK(calls->sign_gossip_message_meth != NULL);
8890
8891         LDKNodeSigner ret = {
8892                 .this_arg = (void*) calls,
8893                 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKNodeSigner_jcall,
8894                 .get_node_id = get_node_id_LDKNodeSigner_jcall,
8895                 .ecdh = ecdh_LDKNodeSigner_jcall,
8896                 .sign_invoice = sign_invoice_LDKNodeSigner_jcall,
8897                 .sign_bolt12_invoice_request = sign_bolt12_invoice_request_LDKNodeSigner_jcall,
8898                 .sign_bolt12_invoice = sign_bolt12_invoice_LDKNodeSigner_jcall,
8899                 .sign_gossip_message = sign_gossip_message_LDKNodeSigner_jcall,
8900                 .free = LDKNodeSigner_JCalls_free,
8901         };
8902         return ret;
8903 }
8904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKNodeSigner_1new(JNIEnv *env, jclass clz, jobject o) {
8905         LDKNodeSigner *res_ptr = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
8906         *res_ptr = LDKNodeSigner_init(env, clz, o);
8907         return tag_ptr(res_ptr, true);
8908 }
8909 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeSigner_1get_1inbound_1payment_1key_1material(JNIEnv *env, jclass clz, int64_t this_arg) {
8910         void* this_arg_ptr = untag_ptr(this_arg);
8911         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8912         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
8913         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8914         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data);
8915         return ret_arr;
8916 }
8917
8918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg, jclass recipient) {
8919         void* this_arg_ptr = untag_ptr(this_arg);
8920         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8921         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
8922         LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
8923         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
8924         *ret_conv = (this_arg_conv->get_node_id)(this_arg_conv->this_arg, recipient_conv);
8925         return tag_ptr(ret_conv, true);
8926 }
8927
8928 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) {
8929         void* this_arg_ptr = untag_ptr(this_arg);
8930         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8931         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
8932         LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
8933         LDKPublicKey other_key_ref;
8934         CHECK((*env)->GetArrayLength(env, other_key) == 33);
8935         (*env)->GetByteArrayRegion(env, other_key, 0, 33, other_key_ref.compressed_form);
8936         void* tweak_ptr = untag_ptr(tweak);
8937         CHECK_ACCESS(tweak_ptr);
8938         LDKCOption_BigEndianScalarZ tweak_conv = *(LDKCOption_BigEndianScalarZ*)(tweak_ptr);
8939         tweak_conv = COption_BigEndianScalarZ_clone((LDKCOption_BigEndianScalarZ*)untag_ptr(tweak));
8940         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
8941         *ret_conv = (this_arg_conv->ecdh)(this_arg_conv->this_arg, recipient_conv, other_key_ref, tweak_conv);
8942         return tag_ptr(ret_conv, true);
8943 }
8944
8945 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) {
8946         void* this_arg_ptr = untag_ptr(this_arg);
8947         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8948         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
8949         LDKu8slice hrp_bytes_ref;
8950         hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
8951         hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
8952         LDKCVec_U5Z invoice_data_constr;
8953         invoice_data_constr.datalen = (*env)->GetArrayLength(env, invoice_data);
8954         if (invoice_data_constr.datalen > 0)
8955                 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
8956         else
8957                 invoice_data_constr.data = NULL;
8958         int8_t* invoice_data_vals = (*env)->GetByteArrayElements (env, invoice_data, NULL);
8959         for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
8960                 int8_t invoice_data_conv_7 = invoice_data_vals[h];
8961                 
8962                 invoice_data_constr.data[h] = (LDKU5){ ._0 = invoice_data_conv_7 };
8963         }
8964         (*env)->ReleaseByteArrayElements(env, invoice_data, invoice_data_vals, 0);
8965         LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
8966         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
8967         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, recipient_conv);
8968         (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
8969         return tag_ptr(ret_conv, true);
8970 }
8971
8972 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) {
8973         void* this_arg_ptr = untag_ptr(this_arg);
8974         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8975         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
8976         LDKUnsignedInvoiceRequest invoice_request_conv;
8977         invoice_request_conv.inner = untag_ptr(invoice_request);
8978         invoice_request_conv.is_owned = ptr_is_owned(invoice_request);
8979         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_conv);
8980         invoice_request_conv.is_owned = false;
8981         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
8982         *ret_conv = (this_arg_conv->sign_bolt12_invoice_request)(this_arg_conv->this_arg, &invoice_request_conv);
8983         return tag_ptr(ret_conv, true);
8984 }
8985
8986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1sign_1bolt12_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int64_t invoice) {
8987         void* this_arg_ptr = untag_ptr(this_arg);
8988         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8989         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
8990         LDKUnsignedBolt12Invoice invoice_conv;
8991         invoice_conv.inner = untag_ptr(invoice);
8992         invoice_conv.is_owned = ptr_is_owned(invoice);
8993         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
8994         invoice_conv.is_owned = false;
8995         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
8996         *ret_conv = (this_arg_conv->sign_bolt12_invoice)(this_arg_conv->this_arg, &invoice_conv);
8997         return tag_ptr(ret_conv, true);
8998 }
8999
9000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1sign_1gossip_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
9001         void* this_arg_ptr = untag_ptr(this_arg);
9002         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9003         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
9004         void* msg_ptr = untag_ptr(msg);
9005         CHECK_ACCESS(msg_ptr);
9006         LDKUnsignedGossipMessage msg_conv = *(LDKUnsignedGossipMessage*)(msg_ptr);
9007         msg_conv = UnsignedGossipMessage_clone((LDKUnsignedGossipMessage*)untag_ptr(msg));
9008         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
9009         *ret_conv = (this_arg_conv->sign_gossip_message)(this_arg_conv->this_arg, msg_conv);
9010         return tag_ptr(ret_conv, true);
9011 }
9012
9013 typedef struct LDKSignerProvider_JCalls {
9014         atomic_size_t refcnt;
9015         JavaVM *vm;
9016         jweak o;
9017         jmethodID generate_channel_keys_id_meth;
9018         jmethodID derive_channel_signer_meth;
9019         jmethodID read_chan_signer_meth;
9020         jmethodID get_destination_script_meth;
9021         jmethodID get_shutdown_scriptpubkey_meth;
9022 } LDKSignerProvider_JCalls;
9023 static void LDKSignerProvider_JCalls_free(void* this_arg) {
9024         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
9025         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9026                 JNIEnv *env;
9027                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9028                 if (get_jenv_res == JNI_EDETACHED) {
9029                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9030                 } else {
9031                         DO_ASSERT(get_jenv_res == JNI_OK);
9032                 }
9033                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9034                 if (get_jenv_res == JNI_EDETACHED) {
9035                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9036                 }
9037                 FREE(j_calls);
9038         }
9039 }
9040 LDKThirtyTwoBytes generate_channel_keys_id_LDKSignerProvider_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis, LDKU128 user_channel_id) {
9041         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
9042         JNIEnv *env;
9043         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9044         if (get_jenv_res == JNI_EDETACHED) {
9045                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9046         } else {
9047                 DO_ASSERT(get_jenv_res == JNI_OK);
9048         }
9049         jboolean inbound_conv = inbound;
9050         int64_t channel_value_satoshis_conv = channel_value_satoshis;
9051         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
9052         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, user_channel_id.le_bytes);
9053         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9054         CHECK(obj != NULL);
9055         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->generate_channel_keys_id_meth, inbound_conv, channel_value_satoshis_conv, user_channel_id_arr);
9056         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9057                 (*env)->ExceptionDescribe(env);
9058                 (*env)->FatalError(env, "A call to generate_channel_keys_id in LDKSignerProvider from rust threw an exception.");
9059         }
9060         LDKThirtyTwoBytes ret_ref;
9061         CHECK((*env)->GetArrayLength(env, ret) == 32);
9062         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
9063         if (get_jenv_res == JNI_EDETACHED) {
9064                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9065         }
9066         return ret_ref;
9067 }
9068 LDKWriteableEcdsaChannelSigner derive_channel_signer_LDKSignerProvider_jcall(const void* this_arg, uint64_t channel_value_satoshis, LDKThirtyTwoBytes channel_keys_id) {
9069         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
9070         JNIEnv *env;
9071         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9072         if (get_jenv_res == JNI_EDETACHED) {
9073                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9074         } else {
9075                 DO_ASSERT(get_jenv_res == JNI_OK);
9076         }
9077         int64_t channel_value_satoshis_conv = channel_value_satoshis;
9078         int8_tArray channel_keys_id_arr = (*env)->NewByteArray(env, 32);
9079         (*env)->SetByteArrayRegion(env, channel_keys_id_arr, 0, 32, channel_keys_id.data);
9080         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9081         CHECK(obj != NULL);
9082         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->derive_channel_signer_meth, channel_value_satoshis_conv, channel_keys_id_arr);
9083         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9084                 (*env)->ExceptionDescribe(env);
9085                 (*env)->FatalError(env, "A call to derive_channel_signer in LDKSignerProvider from rust threw an exception.");
9086         }
9087         void* ret_ptr = untag_ptr(ret);
9088         CHECK_ACCESS(ret_ptr);
9089         LDKWriteableEcdsaChannelSigner ret_conv = *(LDKWriteableEcdsaChannelSigner*)(ret_ptr);
9090         FREE(untag_ptr(ret));
9091         if (get_jenv_res == JNI_EDETACHED) {
9092                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9093         }
9094         return ret_conv;
9095 }
9096 LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ read_chan_signer_LDKSignerProvider_jcall(const void* this_arg, LDKu8slice reader) {
9097         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
9098         JNIEnv *env;
9099         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9100         if (get_jenv_res == JNI_EDETACHED) {
9101                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9102         } else {
9103                 DO_ASSERT(get_jenv_res == JNI_OK);
9104         }
9105         LDKu8slice reader_var = reader;
9106         int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
9107         (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
9108         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9109         CHECK(obj != NULL);
9110         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
9111         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9112                 (*env)->ExceptionDescribe(env);
9113                 (*env)->FatalError(env, "A call to read_chan_signer in LDKSignerProvider from rust threw an exception.");
9114         }
9115         void* ret_ptr = untag_ptr(ret);
9116         CHECK_ACCESS(ret_ptr);
9117         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ ret_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(ret_ptr);
9118         FREE(untag_ptr(ret));
9119         if (get_jenv_res == JNI_EDETACHED) {
9120                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9121         }
9122         return ret_conv;
9123 }
9124 LDKCResult_CVec_u8ZNoneZ get_destination_script_LDKSignerProvider_jcall(const void* this_arg, LDKThirtyTwoBytes channel_keys_id) {
9125         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
9126         JNIEnv *env;
9127         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9128         if (get_jenv_res == JNI_EDETACHED) {
9129                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9130         } else {
9131                 DO_ASSERT(get_jenv_res == JNI_OK);
9132         }
9133         int8_tArray channel_keys_id_arr = (*env)->NewByteArray(env, 32);
9134         (*env)->SetByteArrayRegion(env, channel_keys_id_arr, 0, 32, channel_keys_id.data);
9135         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9136         CHECK(obj != NULL);
9137         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_destination_script_meth, channel_keys_id_arr);
9138         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9139                 (*env)->ExceptionDescribe(env);
9140                 (*env)->FatalError(env, "A call to get_destination_script in LDKSignerProvider from rust threw an exception.");
9141         }
9142         void* ret_ptr = untag_ptr(ret);
9143         CHECK_ACCESS(ret_ptr);
9144         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
9145         FREE(untag_ptr(ret));
9146         if (get_jenv_res == JNI_EDETACHED) {
9147                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9148         }
9149         return ret_conv;
9150 }
9151 LDKCResult_ShutdownScriptNoneZ get_shutdown_scriptpubkey_LDKSignerProvider_jcall(const void* this_arg) {
9152         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
9153         JNIEnv *env;
9154         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9155         if (get_jenv_res == JNI_EDETACHED) {
9156                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9157         } else {
9158                 DO_ASSERT(get_jenv_res == JNI_OK);
9159         }
9160         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9161         CHECK(obj != NULL);
9162         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_shutdown_scriptpubkey_meth);
9163         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9164                 (*env)->ExceptionDescribe(env);
9165                 (*env)->FatalError(env, "A call to get_shutdown_scriptpubkey in LDKSignerProvider from rust threw an exception.");
9166         }
9167         void* ret_ptr = untag_ptr(ret);
9168         CHECK_ACCESS(ret_ptr);
9169         LDKCResult_ShutdownScriptNoneZ ret_conv = *(LDKCResult_ShutdownScriptNoneZ*)(ret_ptr);
9170         FREE(untag_ptr(ret));
9171         if (get_jenv_res == JNI_EDETACHED) {
9172                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9173         }
9174         return ret_conv;
9175 }
9176 static void LDKSignerProvider_JCalls_cloned(LDKSignerProvider* new_obj) {
9177         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) new_obj->this_arg;
9178         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9179 }
9180 static inline LDKSignerProvider LDKSignerProvider_init (JNIEnv *env, jclass clz, jobject o) {
9181         jclass c = (*env)->GetObjectClass(env, o);
9182         CHECK(c != NULL);
9183         LDKSignerProvider_JCalls *calls = MALLOC(sizeof(LDKSignerProvider_JCalls), "LDKSignerProvider_JCalls");
9184         atomic_init(&calls->refcnt, 1);
9185         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9186         calls->o = (*env)->NewWeakGlobalRef(env, o);
9187         calls->generate_channel_keys_id_meth = (*env)->GetMethodID(env, c, "generate_channel_keys_id", "(ZJ[B)[B");
9188         CHECK(calls->generate_channel_keys_id_meth != NULL);
9189         calls->derive_channel_signer_meth = (*env)->GetMethodID(env, c, "derive_channel_signer", "(J[B)J");
9190         CHECK(calls->derive_channel_signer_meth != NULL);
9191         calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
9192         CHECK(calls->read_chan_signer_meth != NULL);
9193         calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "([B)J");
9194         CHECK(calls->get_destination_script_meth != NULL);
9195         calls->get_shutdown_scriptpubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_scriptpubkey", "()J");
9196         CHECK(calls->get_shutdown_scriptpubkey_meth != NULL);
9197
9198         LDKSignerProvider ret = {
9199                 .this_arg = (void*) calls,
9200                 .generate_channel_keys_id = generate_channel_keys_id_LDKSignerProvider_jcall,
9201                 .derive_channel_signer = derive_channel_signer_LDKSignerProvider_jcall,
9202                 .read_chan_signer = read_chan_signer_LDKSignerProvider_jcall,
9203                 .get_destination_script = get_destination_script_LDKSignerProvider_jcall,
9204                 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKSignerProvider_jcall,
9205                 .free = LDKSignerProvider_JCalls_free,
9206         };
9207         return ret;
9208 }
9209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSignerProvider_1new(JNIEnv *env, jclass clz, jobject o) {
9210         LDKSignerProvider *res_ptr = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
9211         *res_ptr = LDKSignerProvider_init(env, clz, o);
9212         return tag_ptr(res_ptr, true);
9213 }
9214 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) {
9215         void* this_arg_ptr = untag_ptr(this_arg);
9216         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9217         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
9218         LDKU128 user_channel_id_ref;
9219         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
9220         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
9221         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
9222         (*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);
9223         return ret_arr;
9224 }
9225
9226 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) {
9227         void* this_arg_ptr = untag_ptr(this_arg);
9228         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9229         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
9230         LDKThirtyTwoBytes channel_keys_id_ref;
9231         CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
9232         (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
9233         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
9234         *ret_ret = (this_arg_conv->derive_channel_signer)(this_arg_conv->this_arg, channel_value_satoshis, channel_keys_id_ref);
9235         return tag_ptr(ret_ret, true);
9236 }
9237
9238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignerProvider_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
9239         void* this_arg_ptr = untag_ptr(this_arg);
9240         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9241         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
9242         LDKu8slice reader_ref;
9243         reader_ref.datalen = (*env)->GetArrayLength(env, reader);
9244         reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
9245         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
9246         *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
9247         (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
9248         return tag_ptr(ret_conv, true);
9249 }
9250
9251 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) {
9252         void* this_arg_ptr = untag_ptr(this_arg);
9253         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9254         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
9255         LDKThirtyTwoBytes channel_keys_id_ref;
9256         CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
9257         (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
9258         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
9259         *ret_conv = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg, channel_keys_id_ref);
9260         return tag_ptr(ret_conv, true);
9261 }
9262
9263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignerProvider_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
9264         void* this_arg_ptr = untag_ptr(this_arg);
9265         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9266         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
9267         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
9268         *ret_conv = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
9269         return tag_ptr(ret_conv, true);
9270 }
9271
9272 typedef struct LDKFeeEstimator_JCalls {
9273         atomic_size_t refcnt;
9274         JavaVM *vm;
9275         jweak o;
9276         jmethodID get_est_sat_per_1000_weight_meth;
9277 } LDKFeeEstimator_JCalls;
9278 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
9279         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
9280         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9281                 JNIEnv *env;
9282                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9283                 if (get_jenv_res == JNI_EDETACHED) {
9284                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9285                 } else {
9286                         DO_ASSERT(get_jenv_res == JNI_OK);
9287                 }
9288                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9289                 if (get_jenv_res == JNI_EDETACHED) {
9290                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9291                 }
9292                 FREE(j_calls);
9293         }
9294 }
9295 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
9296         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
9297         JNIEnv *env;
9298         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9299         if (get_jenv_res == JNI_EDETACHED) {
9300                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9301         } else {
9302                 DO_ASSERT(get_jenv_res == JNI_OK);
9303         }
9304         jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
9305         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9306         CHECK(obj != NULL);
9307         int32_t ret = (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
9308         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9309                 (*env)->ExceptionDescribe(env);
9310                 (*env)->FatalError(env, "A call to get_est_sat_per_1000_weight in LDKFeeEstimator from rust threw an exception.");
9311         }
9312         if (get_jenv_res == JNI_EDETACHED) {
9313                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9314         }
9315         return ret;
9316 }
9317 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
9318         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
9319         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9320 }
9321 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
9322         jclass c = (*env)->GetObjectClass(env, o);
9323         CHECK(c != NULL);
9324         LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
9325         atomic_init(&calls->refcnt, 1);
9326         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9327         calls->o = (*env)->NewWeakGlobalRef(env, o);
9328         calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/ConfirmationTarget;)I");
9329         CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
9330
9331         LDKFeeEstimator ret = {
9332                 .this_arg = (void*) calls,
9333                 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
9334                 .free = LDKFeeEstimator_JCalls_free,
9335         };
9336         return ret;
9337 }
9338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
9339         LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
9340         *res_ptr = LDKFeeEstimator_init(env, clz, o);
9341         return tag_ptr(res_ptr, true);
9342 }
9343 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) {
9344         void* this_arg_ptr = untag_ptr(this_arg);
9345         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9346         LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
9347         LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
9348         int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
9349         return ret_conv;
9350 }
9351
9352 typedef struct LDKMessageRouter_JCalls {
9353         atomic_size_t refcnt;
9354         JavaVM *vm;
9355         jweak o;
9356         jmethodID find_path_meth;
9357         jmethodID create_blinded_paths_meth;
9358 } LDKMessageRouter_JCalls;
9359 static void LDKMessageRouter_JCalls_free(void* this_arg) {
9360         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
9361         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9362                 JNIEnv *env;
9363                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9364                 if (get_jenv_res == JNI_EDETACHED) {
9365                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9366                 } else {
9367                         DO_ASSERT(get_jenv_res == JNI_OK);
9368                 }
9369                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9370                 if (get_jenv_res == JNI_EDETACHED) {
9371                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9372                 }
9373                 FREE(j_calls);
9374         }
9375 }
9376 LDKCResult_OnionMessagePathNoneZ find_path_LDKMessageRouter_jcall(const void* this_arg, LDKPublicKey sender, LDKCVec_PublicKeyZ peers, LDKDestination destination) {
9377         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
9378         JNIEnv *env;
9379         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9380         if (get_jenv_res == JNI_EDETACHED) {
9381                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9382         } else {
9383                 DO_ASSERT(get_jenv_res == JNI_OK);
9384         }
9385         int8_tArray sender_arr = (*env)->NewByteArray(env, 33);
9386         (*env)->SetByteArrayRegion(env, sender_arr, 0, 33, sender.compressed_form);
9387         LDKCVec_PublicKeyZ peers_var = peers;
9388         jobjectArray peers_arr = NULL;
9389         peers_arr = (*env)->NewObjectArray(env, peers_var.datalen, arr_of_B_clz, NULL);
9390         ;
9391         for (size_t i = 0; i < peers_var.datalen; i++) {
9392                 int8_tArray peers_conv_8_arr = (*env)->NewByteArray(env, 33);
9393                 (*env)->SetByteArrayRegion(env, peers_conv_8_arr, 0, 33, peers_var.data[i].compressed_form);
9394                 (*env)->SetObjectArrayElement(env, peers_arr, i, peers_conv_8_arr);
9395         }
9396         
9397         FREE(peers_var.data);
9398         LDKDestination *destination_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
9399         *destination_copy = destination;
9400         int64_t destination_ref = tag_ptr(destination_copy, true);
9401         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9402         CHECK(obj != NULL);
9403         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_path_meth, sender_arr, peers_arr, destination_ref);
9404         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9405                 (*env)->ExceptionDescribe(env);
9406                 (*env)->FatalError(env, "A call to find_path in LDKMessageRouter from rust threw an exception.");
9407         }
9408         void* ret_ptr = untag_ptr(ret);
9409         CHECK_ACCESS(ret_ptr);
9410         LDKCResult_OnionMessagePathNoneZ ret_conv = *(LDKCResult_OnionMessagePathNoneZ*)(ret_ptr);
9411         FREE(untag_ptr(ret));
9412         if (get_jenv_res == JNI_EDETACHED) {
9413                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9414         }
9415         return ret_conv;
9416 }
9417 LDKCResult_CVec_BlindedPathZNoneZ create_blinded_paths_LDKMessageRouter_jcall(const void* this_arg, LDKPublicKey recipient, LDKCVec_PublicKeyZ peers) {
9418         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
9419         JNIEnv *env;
9420         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9421         if (get_jenv_res == JNI_EDETACHED) {
9422                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9423         } else {
9424                 DO_ASSERT(get_jenv_res == JNI_OK);
9425         }
9426         int8_tArray recipient_arr = (*env)->NewByteArray(env, 33);
9427         (*env)->SetByteArrayRegion(env, recipient_arr, 0, 33, recipient.compressed_form);
9428         LDKCVec_PublicKeyZ peers_var = peers;
9429         jobjectArray peers_arr = NULL;
9430         peers_arr = (*env)->NewObjectArray(env, peers_var.datalen, arr_of_B_clz, NULL);
9431         ;
9432         for (size_t i = 0; i < peers_var.datalen; i++) {
9433                 int8_tArray peers_conv_8_arr = (*env)->NewByteArray(env, 33);
9434                 (*env)->SetByteArrayRegion(env, peers_conv_8_arr, 0, 33, peers_var.data[i].compressed_form);
9435                 (*env)->SetObjectArrayElement(env, peers_arr, i, peers_conv_8_arr);
9436         }
9437         
9438         FREE(peers_var.data);
9439         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9440         CHECK(obj != NULL);
9441         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->create_blinded_paths_meth, recipient_arr, peers_arr);
9442         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9443                 (*env)->ExceptionDescribe(env);
9444                 (*env)->FatalError(env, "A call to create_blinded_paths in LDKMessageRouter from rust threw an exception.");
9445         }
9446         void* ret_ptr = untag_ptr(ret);
9447         CHECK_ACCESS(ret_ptr);
9448         LDKCResult_CVec_BlindedPathZNoneZ ret_conv = *(LDKCResult_CVec_BlindedPathZNoneZ*)(ret_ptr);
9449         FREE(untag_ptr(ret));
9450         if (get_jenv_res == JNI_EDETACHED) {
9451                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9452         }
9453         return ret_conv;
9454 }
9455 static void LDKMessageRouter_JCalls_cloned(LDKMessageRouter* new_obj) {
9456         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) new_obj->this_arg;
9457         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9458 }
9459 static inline LDKMessageRouter LDKMessageRouter_init (JNIEnv *env, jclass clz, jobject o) {
9460         jclass c = (*env)->GetObjectClass(env, o);
9461         CHECK(c != NULL);
9462         LDKMessageRouter_JCalls *calls = MALLOC(sizeof(LDKMessageRouter_JCalls), "LDKMessageRouter_JCalls");
9463         atomic_init(&calls->refcnt, 1);
9464         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9465         calls->o = (*env)->NewWeakGlobalRef(env, o);
9466         calls->find_path_meth = (*env)->GetMethodID(env, c, "find_path", "([B[[BJ)J");
9467         CHECK(calls->find_path_meth != NULL);
9468         calls->create_blinded_paths_meth = (*env)->GetMethodID(env, c, "create_blinded_paths", "([B[[B)J");
9469         CHECK(calls->create_blinded_paths_meth != NULL);
9470
9471         LDKMessageRouter ret = {
9472                 .this_arg = (void*) calls,
9473                 .find_path = find_path_LDKMessageRouter_jcall,
9474                 .create_blinded_paths = create_blinded_paths_LDKMessageRouter_jcall,
9475                 .free = LDKMessageRouter_JCalls_free,
9476         };
9477         return ret;
9478 }
9479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageRouter_1new(JNIEnv *env, jclass clz, jobject o) {
9480         LDKMessageRouter *res_ptr = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
9481         *res_ptr = LDKMessageRouter_init(env, clz, o);
9482         return tag_ptr(res_ptr, true);
9483 }
9484 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) {
9485         void* this_arg_ptr = untag_ptr(this_arg);
9486         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9487         LDKMessageRouter* this_arg_conv = (LDKMessageRouter*)this_arg_ptr;
9488         LDKPublicKey sender_ref;
9489         CHECK((*env)->GetArrayLength(env, sender) == 33);
9490         (*env)->GetByteArrayRegion(env, sender, 0, 33, sender_ref.compressed_form);
9491         LDKCVec_PublicKeyZ peers_constr;
9492         peers_constr.datalen = (*env)->GetArrayLength(env, peers);
9493         if (peers_constr.datalen > 0)
9494                 peers_constr.data = MALLOC(peers_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
9495         else
9496                 peers_constr.data = NULL;
9497         for (size_t i = 0; i < peers_constr.datalen; i++) {
9498                 int8_tArray peers_conv_8 = (*env)->GetObjectArrayElement(env, peers, i);
9499                 LDKPublicKey peers_conv_8_ref;
9500                 CHECK((*env)->GetArrayLength(env, peers_conv_8) == 33);
9501                 (*env)->GetByteArrayRegion(env, peers_conv_8, 0, 33, peers_conv_8_ref.compressed_form);
9502                 peers_constr.data[i] = peers_conv_8_ref;
9503         }
9504         void* destination_ptr = untag_ptr(destination);
9505         CHECK_ACCESS(destination_ptr);
9506         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
9507         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
9508         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
9509         *ret_conv = (this_arg_conv->find_path)(this_arg_conv->this_arg, sender_ref, peers_constr, destination_conv);
9510         return tag_ptr(ret_conv, true);
9511 }
9512
9513 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) {
9514         void* this_arg_ptr = untag_ptr(this_arg);
9515         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9516         LDKMessageRouter* this_arg_conv = (LDKMessageRouter*)this_arg_ptr;
9517         LDKPublicKey recipient_ref;
9518         CHECK((*env)->GetArrayLength(env, recipient) == 33);
9519         (*env)->GetByteArrayRegion(env, recipient, 0, 33, recipient_ref.compressed_form);
9520         LDKCVec_PublicKeyZ peers_constr;
9521         peers_constr.datalen = (*env)->GetArrayLength(env, peers);
9522         if (peers_constr.datalen > 0)
9523                 peers_constr.data = MALLOC(peers_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
9524         else
9525                 peers_constr.data = NULL;
9526         for (size_t i = 0; i < peers_constr.datalen; i++) {
9527                 int8_tArray peers_conv_8 = (*env)->GetObjectArrayElement(env, peers, i);
9528                 LDKPublicKey peers_conv_8_ref;
9529                 CHECK((*env)->GetArrayLength(env, peers_conv_8) == 33);
9530                 (*env)->GetByteArrayRegion(env, peers_conv_8, 0, 33, peers_conv_8_ref.compressed_form);
9531                 peers_constr.data[i] = peers_conv_8_ref;
9532         }
9533         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
9534         *ret_conv = (this_arg_conv->create_blinded_paths)(this_arg_conv->this_arg, recipient_ref, peers_constr);
9535         return tag_ptr(ret_conv, true);
9536 }
9537
9538 typedef struct LDKRouter_JCalls {
9539         atomic_size_t refcnt;
9540         JavaVM *vm;
9541         jweak o;
9542         LDKMessageRouter_JCalls* MessageRouter;
9543         jmethodID find_route_meth;
9544         jmethodID find_route_with_id_meth;
9545         jmethodID create_blinded_payment_paths_meth;
9546 } LDKRouter_JCalls;
9547 static void LDKRouter_JCalls_free(void* this_arg) {
9548         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
9549         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9550                 JNIEnv *env;
9551                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9552                 if (get_jenv_res == JNI_EDETACHED) {
9553                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9554                 } else {
9555                         DO_ASSERT(get_jenv_res == JNI_OK);
9556                 }
9557                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9558                 if (get_jenv_res == JNI_EDETACHED) {
9559                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9560                 }
9561                 FREE(j_calls);
9562         }
9563 }
9564 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, LDKInFlightHtlcs inflight_htlcs) {
9565         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
9566         JNIEnv *env;
9567         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9568         if (get_jenv_res == JNI_EDETACHED) {
9569                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9570         } else {
9571                 DO_ASSERT(get_jenv_res == JNI_OK);
9572         }
9573         int8_tArray payer_arr = (*env)->NewByteArray(env, 33);
9574         (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form);
9575         LDKRouteParameters route_params_var = *route_params;
9576         int64_t route_params_ref = 0;
9577         route_params_var = RouteParameters_clone(&route_params_var);
9578         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
9579         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
9580         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
9581         int64_tArray first_hops_arr = NULL;
9582         if (first_hops != NULL) {
9583                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
9584                 first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen);
9585                 int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL);
9586                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
9587                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
9588                         int64_t first_hops_conv_16_ref = 0;
9589                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
9590                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
9591                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
9592                 }
9593                 (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0);
9594         }
9595         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
9596         int64_t inflight_htlcs_ref = 0;
9597         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
9598         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
9599         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9600         CHECK(obj != NULL);
9601         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_route_meth, payer_arr, route_params_ref, first_hops_arr, inflight_htlcs_ref);
9602         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9603                 (*env)->ExceptionDescribe(env);
9604                 (*env)->FatalError(env, "A call to find_route in LDKRouter from rust threw an exception.");
9605         }
9606         void* ret_ptr = untag_ptr(ret);
9607         CHECK_ACCESS(ret_ptr);
9608         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
9609         FREE(untag_ptr(ret));
9610         if (get_jenv_res == JNI_EDETACHED) {
9611                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9612         }
9613         return ret_conv;
9614 }
9615 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) {
9616         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
9617         JNIEnv *env;
9618         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9619         if (get_jenv_res == JNI_EDETACHED) {
9620                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9621         } else {
9622                 DO_ASSERT(get_jenv_res == JNI_OK);
9623         }
9624         int8_tArray payer_arr = (*env)->NewByteArray(env, 33);
9625         (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form);
9626         LDKRouteParameters route_params_var = *route_params;
9627         int64_t route_params_ref = 0;
9628         route_params_var = RouteParameters_clone(&route_params_var);
9629         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
9630         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
9631         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
9632         int64_tArray first_hops_arr = NULL;
9633         if (first_hops != NULL) {
9634                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
9635                 first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen);
9636                 int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL);
9637                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
9638                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
9639                         int64_t first_hops_conv_16_ref = 0;
9640                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
9641                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
9642                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
9643                 }
9644                 (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0);
9645         }
9646         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
9647         int64_t inflight_htlcs_ref = 0;
9648         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
9649         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
9650         int8_tArray _payment_hash_arr = (*env)->NewByteArray(env, 32);
9651         (*env)->SetByteArrayRegion(env, _payment_hash_arr, 0, 32, _payment_hash.data);
9652         int8_tArray _payment_id_arr = (*env)->NewByteArray(env, 32);
9653         (*env)->SetByteArrayRegion(env, _payment_id_arr, 0, 32, _payment_id.data);
9654         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9655         CHECK(obj != NULL);
9656         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);
9657         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9658                 (*env)->ExceptionDescribe(env);
9659                 (*env)->FatalError(env, "A call to find_route_with_id in LDKRouter from rust threw an exception.");
9660         }
9661         void* ret_ptr = untag_ptr(ret);
9662         CHECK_ACCESS(ret_ptr);
9663         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
9664         FREE(untag_ptr(ret));
9665         if (get_jenv_res == JNI_EDETACHED) {
9666                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9667         }
9668         return ret_conv;
9669 }
9670 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) {
9671         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
9672         JNIEnv *env;
9673         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9674         if (get_jenv_res == JNI_EDETACHED) {
9675                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9676         } else {
9677                 DO_ASSERT(get_jenv_res == JNI_OK);
9678         }
9679         int8_tArray recipient_arr = (*env)->NewByteArray(env, 33);
9680         (*env)->SetByteArrayRegion(env, recipient_arr, 0, 33, recipient.compressed_form);
9681         LDKCVec_ChannelDetailsZ first_hops_var = first_hops;
9682         int64_tArray first_hops_arr = NULL;
9683         first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen);
9684         int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL);
9685         for (size_t q = 0; q < first_hops_var.datalen; q++) {
9686                 LDKChannelDetails first_hops_conv_16_var = first_hops_var.data[q];
9687                 int64_t first_hops_conv_16_ref = 0;
9688                 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
9689                 first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
9690                 first_hops_arr_ptr[q] = first_hops_conv_16_ref;
9691         }
9692         (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0);
9693         FREE(first_hops_var.data);
9694         LDKReceiveTlvs tlvs_var = tlvs;
9695         int64_t tlvs_ref = 0;
9696         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_var);
9697         tlvs_ref = tag_ptr(tlvs_var.inner, tlvs_var.is_owned);
9698         int64_t amount_msats_conv = amount_msats;
9699         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9700         CHECK(obj != NULL);
9701         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->create_blinded_payment_paths_meth, recipient_arr, first_hops_arr, tlvs_ref, amount_msats_conv);
9702         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9703                 (*env)->ExceptionDescribe(env);
9704                 (*env)->FatalError(env, "A call to create_blinded_payment_paths in LDKRouter from rust threw an exception.");
9705         }
9706         void* ret_ptr = untag_ptr(ret);
9707         CHECK_ACCESS(ret_ptr);
9708         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ ret_conv = *(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)(ret_ptr);
9709         FREE(untag_ptr(ret));
9710         if (get_jenv_res == JNI_EDETACHED) {
9711                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9712         }
9713         return ret_conv;
9714 }
9715 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
9716         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
9717         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9718         atomic_fetch_add_explicit(&j_calls->MessageRouter->refcnt, 1, memory_order_release);
9719 }
9720 static inline LDKRouter LDKRouter_init (JNIEnv *env, jclass clz, jobject o, jobject MessageRouter) {
9721         jclass c = (*env)->GetObjectClass(env, o);
9722         CHECK(c != NULL);
9723         LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
9724         atomic_init(&calls->refcnt, 1);
9725         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9726         calls->o = (*env)->NewWeakGlobalRef(env, o);
9727         calls->find_route_meth = (*env)->GetMethodID(env, c, "find_route", "([BJ[JJ)J");
9728         CHECK(calls->find_route_meth != NULL);
9729         calls->find_route_with_id_meth = (*env)->GetMethodID(env, c, "find_route_with_id", "([BJ[JJ[B[B)J");
9730         CHECK(calls->find_route_with_id_meth != NULL);
9731         calls->create_blinded_payment_paths_meth = (*env)->GetMethodID(env, c, "create_blinded_payment_paths", "([B[JJJ)J");
9732         CHECK(calls->create_blinded_payment_paths_meth != NULL);
9733
9734         LDKRouter ret = {
9735                 .this_arg = (void*) calls,
9736                 .find_route = find_route_LDKRouter_jcall,
9737                 .find_route_with_id = find_route_with_id_LDKRouter_jcall,
9738                 .create_blinded_payment_paths = create_blinded_payment_paths_LDKRouter_jcall,
9739                 .free = LDKRouter_JCalls_free,
9740                 .MessageRouter = LDKMessageRouter_init(env, clz, MessageRouter),
9741         };
9742         calls->MessageRouter = ret.MessageRouter.this_arg;
9743         return ret;
9744 }
9745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRouter_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageRouter) {
9746         LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
9747         *res_ptr = LDKRouter_init(env, clz, o, MessageRouter);
9748         return tag_ptr(res_ptr, true);
9749 }
9750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRouter_1get_1MessageRouter(JNIEnv *env, jclass clz, int64_t arg) {
9751         LDKRouter *inp = (LDKRouter *)untag_ptr(arg);
9752         return tag_ptr(&inp->MessageRouter, false);
9753 }
9754 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) {
9755         void* this_arg_ptr = untag_ptr(this_arg);
9756         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9757         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
9758         LDKPublicKey payer_ref;
9759         CHECK((*env)->GetArrayLength(env, payer) == 33);
9760         (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form);
9761         LDKRouteParameters route_params_conv;
9762         route_params_conv.inner = untag_ptr(route_params);
9763         route_params_conv.is_owned = ptr_is_owned(route_params);
9764         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
9765         route_params_conv.is_owned = false;
9766         LDKCVec_ChannelDetailsZ first_hops_constr;
9767         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
9768         if (first_hops != NULL) {
9769                 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
9770                 if (first_hops_constr.datalen > 0)
9771                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
9772                 else
9773                         first_hops_constr.data = NULL;
9774                 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
9775                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
9776                         int64_t first_hops_conv_16 = first_hops_vals[q];
9777                         LDKChannelDetails first_hops_conv_16_conv;
9778                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
9779                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
9780                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
9781                         first_hops_conv_16_conv.is_owned = false;
9782                         first_hops_constr.data[q] = first_hops_conv_16_conv;
9783                 }
9784                 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
9785                 first_hops_ptr = &first_hops_constr;
9786         }
9787         LDKInFlightHtlcs inflight_htlcs_conv;
9788         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
9789         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
9790         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
9791         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
9792         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9793         *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, inflight_htlcs_conv);
9794         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
9795         return tag_ptr(ret_conv, true);
9796 }
9797
9798 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) {
9799         void* this_arg_ptr = untag_ptr(this_arg);
9800         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9801         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
9802         LDKPublicKey payer_ref;
9803         CHECK((*env)->GetArrayLength(env, payer) == 33);
9804         (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form);
9805         LDKRouteParameters route_params_conv;
9806         route_params_conv.inner = untag_ptr(route_params);
9807         route_params_conv.is_owned = ptr_is_owned(route_params);
9808         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
9809         route_params_conv.is_owned = false;
9810         LDKCVec_ChannelDetailsZ first_hops_constr;
9811         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
9812         if (first_hops != NULL) {
9813                 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
9814                 if (first_hops_constr.datalen > 0)
9815                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
9816                 else
9817                         first_hops_constr.data = NULL;
9818                 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
9819                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
9820                         int64_t first_hops_conv_16 = first_hops_vals[q];
9821                         LDKChannelDetails first_hops_conv_16_conv;
9822                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
9823                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
9824                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
9825                         first_hops_conv_16_conv.is_owned = false;
9826                         first_hops_constr.data[q] = first_hops_conv_16_conv;
9827                 }
9828                 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
9829                 first_hops_ptr = &first_hops_constr;
9830         }
9831         LDKInFlightHtlcs inflight_htlcs_conv;
9832         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
9833         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
9834         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
9835         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
9836         LDKThirtyTwoBytes _payment_hash_ref;
9837         CHECK((*env)->GetArrayLength(env, _payment_hash) == 32);
9838         (*env)->GetByteArrayRegion(env, _payment_hash, 0, 32, _payment_hash_ref.data);
9839         LDKThirtyTwoBytes _payment_id_ref;
9840         CHECK((*env)->GetArrayLength(env, _payment_id) == 32);
9841         (*env)->GetByteArrayRegion(env, _payment_id, 0, 32, _payment_id_ref.data);
9842         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9843         *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);
9844         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
9845         return tag_ptr(ret_conv, true);
9846 }
9847
9848 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) {
9849         void* this_arg_ptr = untag_ptr(this_arg);
9850         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9851         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
9852         LDKPublicKey recipient_ref;
9853         CHECK((*env)->GetArrayLength(env, recipient) == 33);
9854         (*env)->GetByteArrayRegion(env, recipient, 0, 33, recipient_ref.compressed_form);
9855         LDKCVec_ChannelDetailsZ first_hops_constr;
9856         first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
9857         if (first_hops_constr.datalen > 0)
9858                 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
9859         else
9860                 first_hops_constr.data = NULL;
9861         int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
9862         for (size_t q = 0; q < first_hops_constr.datalen; q++) {
9863                 int64_t first_hops_conv_16 = first_hops_vals[q];
9864                 LDKChannelDetails first_hops_conv_16_conv;
9865                 first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
9866                 first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
9867                 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
9868                 first_hops_conv_16_conv = ChannelDetails_clone(&first_hops_conv_16_conv);
9869                 first_hops_constr.data[q] = first_hops_conv_16_conv;
9870         }
9871         (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
9872         LDKReceiveTlvs tlvs_conv;
9873         tlvs_conv.inner = untag_ptr(tlvs);
9874         tlvs_conv.is_owned = ptr_is_owned(tlvs);
9875         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_conv);
9876         tlvs_conv = ReceiveTlvs_clone(&tlvs_conv);
9877         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
9878         *ret_conv = (this_arg_conv->create_blinded_payment_paths)(this_arg_conv->this_arg, recipient_ref, first_hops_constr, tlvs_conv, amount_msats);
9879         return tag_ptr(ret_conv, true);
9880 }
9881
9882 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *NONNULL_PTR owner){
9883         return ThirtyTwoBytes_clone(&owner->a);
9884 }
9885 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
9886         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)untag_ptr(owner);
9887         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
9888         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(owner_conv).data);
9889         return ret_arr;
9890 }
9891
9892 static inline struct LDKChannelManager C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *NONNULL_PTR owner){
9893         LDKChannelManager ret = owner->b;
9894         ret.is_owned = false;
9895         return ret;
9896 }
9897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
9898         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)untag_ptr(owner);
9899         LDKChannelManager ret_var = C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(owner_conv);
9900         int64_t ret_ref = 0;
9901         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9902         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9903         return ret_ref;
9904 }
9905
9906 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
9907 CHECK(owner->result_ok);
9908         return &*owner->contents.result;
9909 }
9910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9911         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(owner);
9912         int64_t ret_ret = tag_ptr(CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(owner_conv), false);
9913         return ret_ret;
9914 }
9915
9916 static inline struct LDKDecodeError CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
9917 CHECK(!owner->result_ok);
9918         return DecodeError_clone(&*owner->contents.err);
9919 }
9920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9921         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(owner);
9922         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9923         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(owner_conv);
9924         int64_t ret_ref = tag_ptr(ret_copy, true);
9925         return ret_ref;
9926 }
9927
9928 static jclass LDKMaxDustHTLCExposure_FixedLimitMsat_class = NULL;
9929 static jmethodID LDKMaxDustHTLCExposure_FixedLimitMsat_meth = NULL;
9930 static jclass LDKMaxDustHTLCExposure_FeeRateMultiplier_class = NULL;
9931 static jmethodID LDKMaxDustHTLCExposure_FeeRateMultiplier_meth = NULL;
9932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMaxDustHTLCExposure_init (JNIEnv *env, jclass clz) {
9933         LDKMaxDustHTLCExposure_FixedLimitMsat_class =
9934                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMaxDustHTLCExposure$FixedLimitMsat"));
9935         CHECK(LDKMaxDustHTLCExposure_FixedLimitMsat_class != NULL);
9936         LDKMaxDustHTLCExposure_FixedLimitMsat_meth = (*env)->GetMethodID(env, LDKMaxDustHTLCExposure_FixedLimitMsat_class, "<init>", "(J)V");
9937         CHECK(LDKMaxDustHTLCExposure_FixedLimitMsat_meth != NULL);
9938         LDKMaxDustHTLCExposure_FeeRateMultiplier_class =
9939                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMaxDustHTLCExposure$FeeRateMultiplier"));
9940         CHECK(LDKMaxDustHTLCExposure_FeeRateMultiplier_class != NULL);
9941         LDKMaxDustHTLCExposure_FeeRateMultiplier_meth = (*env)->GetMethodID(env, LDKMaxDustHTLCExposure_FeeRateMultiplier_class, "<init>", "(J)V");
9942         CHECK(LDKMaxDustHTLCExposure_FeeRateMultiplier_meth != NULL);
9943 }
9944 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMaxDustHTLCExposure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9945         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
9946         switch(obj->tag) {
9947                 case LDKMaxDustHTLCExposure_FixedLimitMsat: {
9948                         int64_t fixed_limit_msat_conv = obj->fixed_limit_msat;
9949                         return (*env)->NewObject(env, LDKMaxDustHTLCExposure_FixedLimitMsat_class, LDKMaxDustHTLCExposure_FixedLimitMsat_meth, fixed_limit_msat_conv);
9950                 }
9951                 case LDKMaxDustHTLCExposure_FeeRateMultiplier: {
9952                         int64_t fee_rate_multiplier_conv = obj->fee_rate_multiplier;
9953                         return (*env)->NewObject(env, LDKMaxDustHTLCExposure_FeeRateMultiplier_class, LDKMaxDustHTLCExposure_FeeRateMultiplier_meth, fee_rate_multiplier_conv);
9954                 }
9955                 default: abort();
9956         }
9957 }
9958 static inline struct LDKMaxDustHTLCExposure CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
9959 CHECK(owner->result_ok);
9960         return MaxDustHTLCExposure_clone(&*owner->contents.result);
9961 }
9962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9963         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
9964         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
9965         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(owner_conv);
9966         int64_t ret_ref = tag_ptr(ret_copy, true);
9967         return ret_ref;
9968 }
9969
9970 static inline struct LDKDecodeError CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
9971 CHECK(!owner->result_ok);
9972         return DecodeError_clone(&*owner->contents.err);
9973 }
9974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9975         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
9976         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9977         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(owner_conv);
9978         int64_t ret_ref = tag_ptr(ret_copy, true);
9979         return ret_ref;
9980 }
9981
9982 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
9983         LDKChannelConfig ret = *owner->contents.result;
9984         ret.is_owned = false;
9985         return ret;
9986 }
9987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9988         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
9989         LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
9990         int64_t ret_ref = 0;
9991         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9992         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9993         return ret_ref;
9994 }
9995
9996 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
9997 CHECK(!owner->result_ok);
9998         return DecodeError_clone(&*owner->contents.err);
9999 }
10000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10001         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
10002         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10003         *ret_copy = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
10004         int64_t ret_ref = tag_ptr(ret_copy, true);
10005         return ret_ref;
10006 }
10007
10008 static jclass LDKCOption_MaxDustHTLCExposureZ_Some_class = NULL;
10009 static jmethodID LDKCOption_MaxDustHTLCExposureZ_Some_meth = NULL;
10010 static jclass LDKCOption_MaxDustHTLCExposureZ_None_class = NULL;
10011 static jmethodID LDKCOption_MaxDustHTLCExposureZ_None_meth = NULL;
10012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1MaxDustHTLCExposureZ_init (JNIEnv *env, jclass clz) {
10013         LDKCOption_MaxDustHTLCExposureZ_Some_class =
10014                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MaxDustHTLCExposureZ$Some"));
10015         CHECK(LDKCOption_MaxDustHTLCExposureZ_Some_class != NULL);
10016         LDKCOption_MaxDustHTLCExposureZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_MaxDustHTLCExposureZ_Some_class, "<init>", "(J)V");
10017         CHECK(LDKCOption_MaxDustHTLCExposureZ_Some_meth != NULL);
10018         LDKCOption_MaxDustHTLCExposureZ_None_class =
10019                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MaxDustHTLCExposureZ$None"));
10020         CHECK(LDKCOption_MaxDustHTLCExposureZ_None_class != NULL);
10021         LDKCOption_MaxDustHTLCExposureZ_None_meth = (*env)->GetMethodID(env, LDKCOption_MaxDustHTLCExposureZ_None_class, "<init>", "()V");
10022         CHECK(LDKCOption_MaxDustHTLCExposureZ_None_meth != NULL);
10023 }
10024 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1MaxDustHTLCExposureZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10025         LDKCOption_MaxDustHTLCExposureZ *obj = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(ptr);
10026         switch(obj->tag) {
10027                 case LDKCOption_MaxDustHTLCExposureZ_Some: {
10028                         int64_t some_ref = tag_ptr(&obj->some, false);
10029                         return (*env)->NewObject(env, LDKCOption_MaxDustHTLCExposureZ_Some_class, LDKCOption_MaxDustHTLCExposureZ_Some_meth, some_ref);
10030                 }
10031                 case LDKCOption_MaxDustHTLCExposureZ_None: {
10032                         return (*env)->NewObject(env, LDKCOption_MaxDustHTLCExposureZ_None_class, LDKCOption_MaxDustHTLCExposureZ_None_meth);
10033                 }
10034                 default: abort();
10035         }
10036 }
10037 static jclass LDKCOption_APIErrorZ_Some_class = NULL;
10038 static jmethodID LDKCOption_APIErrorZ_Some_meth = NULL;
10039 static jclass LDKCOption_APIErrorZ_None_class = NULL;
10040 static jmethodID LDKCOption_APIErrorZ_None_meth = NULL;
10041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1APIErrorZ_init (JNIEnv *env, jclass clz) {
10042         LDKCOption_APIErrorZ_Some_class =
10043                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_APIErrorZ$Some"));
10044         CHECK(LDKCOption_APIErrorZ_Some_class != NULL);
10045         LDKCOption_APIErrorZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_APIErrorZ_Some_class, "<init>", "(J)V");
10046         CHECK(LDKCOption_APIErrorZ_Some_meth != NULL);
10047         LDKCOption_APIErrorZ_None_class =
10048                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_APIErrorZ$None"));
10049         CHECK(LDKCOption_APIErrorZ_None_class != NULL);
10050         LDKCOption_APIErrorZ_None_meth = (*env)->GetMethodID(env, LDKCOption_APIErrorZ_None_class, "<init>", "()V");
10051         CHECK(LDKCOption_APIErrorZ_None_meth != NULL);
10052 }
10053 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1APIErrorZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10054         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
10055         switch(obj->tag) {
10056                 case LDKCOption_APIErrorZ_Some: {
10057                         int64_t some_ref = tag_ptr(&obj->some, false);
10058                         return (*env)->NewObject(env, LDKCOption_APIErrorZ_Some_class, LDKCOption_APIErrorZ_Some_meth, some_ref);
10059                 }
10060                 case LDKCOption_APIErrorZ_None: {
10061                         return (*env)->NewObject(env, LDKCOption_APIErrorZ_None_class, LDKCOption_APIErrorZ_None_meth);
10062                 }
10063                 default: abort();
10064         }
10065 }
10066 static inline struct LDKCOption_APIErrorZ CResult_COption_APIErrorZDecodeErrorZ_get_ok(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
10067 CHECK(owner->result_ok);
10068         return COption_APIErrorZ_clone(&*owner->contents.result);
10069 }
10070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10071         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
10072         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
10073         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_ok(owner_conv);
10074         int64_t ret_ref = tag_ptr(ret_copy, true);
10075         return ret_ref;
10076 }
10077
10078 static inline struct LDKDecodeError CResult_COption_APIErrorZDecodeErrorZ_get_err(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
10079 CHECK(!owner->result_ok);
10080         return DecodeError_clone(&*owner->contents.err);
10081 }
10082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10083         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
10084         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10085         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_err(owner_conv);
10086         int64_t ret_ref = tag_ptr(ret_copy, true);
10087         return ret_ref;
10088 }
10089
10090 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
10091         LDKChannelMonitorUpdate ret = *owner->contents.result;
10092         ret.is_owned = false;
10093         return ret;
10094 }
10095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10096         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
10097         LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
10098         int64_t ret_ref = 0;
10099         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10100         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10101         return ret_ref;
10102 }
10103
10104 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
10105 CHECK(!owner->result_ok);
10106         return DecodeError_clone(&*owner->contents.err);
10107 }
10108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10109         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
10110         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10111         *ret_copy = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
10112         int64_t ret_ref = tag_ptr(ret_copy, true);
10113         return ret_ref;
10114 }
10115
10116 static jclass LDKCOption_MonitorEventZ_Some_class = NULL;
10117 static jmethodID LDKCOption_MonitorEventZ_Some_meth = NULL;
10118 static jclass LDKCOption_MonitorEventZ_None_class = NULL;
10119 static jmethodID LDKCOption_MonitorEventZ_None_meth = NULL;
10120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1MonitorEventZ_init (JNIEnv *env, jclass clz) {
10121         LDKCOption_MonitorEventZ_Some_class =
10122                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$Some"));
10123         CHECK(LDKCOption_MonitorEventZ_Some_class != NULL);
10124         LDKCOption_MonitorEventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_Some_class, "<init>", "(J)V");
10125         CHECK(LDKCOption_MonitorEventZ_Some_meth != NULL);
10126         LDKCOption_MonitorEventZ_None_class =
10127                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$None"));
10128         CHECK(LDKCOption_MonitorEventZ_None_class != NULL);
10129         LDKCOption_MonitorEventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_None_class, "<init>", "()V");
10130         CHECK(LDKCOption_MonitorEventZ_None_meth != NULL);
10131 }
10132 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1MonitorEventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10133         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
10134         switch(obj->tag) {
10135                 case LDKCOption_MonitorEventZ_Some: {
10136                         int64_t some_ref = tag_ptr(&obj->some, false);
10137                         return (*env)->NewObject(env, LDKCOption_MonitorEventZ_Some_class, LDKCOption_MonitorEventZ_Some_meth, some_ref);
10138                 }
10139                 case LDKCOption_MonitorEventZ_None: {
10140                         return (*env)->NewObject(env, LDKCOption_MonitorEventZ_None_class, LDKCOption_MonitorEventZ_None_meth);
10141                 }
10142                 default: abort();
10143         }
10144 }
10145 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
10146 CHECK(owner->result_ok);
10147         return COption_MonitorEventZ_clone(&*owner->contents.result);
10148 }
10149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10150         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
10151         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
10152         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
10153         int64_t ret_ref = tag_ptr(ret_copy, true);
10154         return ret_ref;
10155 }
10156
10157 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
10158 CHECK(!owner->result_ok);
10159         return DecodeError_clone(&*owner->contents.err);
10160 }
10161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10162         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
10163         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10164         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
10165         int64_t ret_ref = tag_ptr(ret_copy, true);
10166         return ret_ref;
10167 }
10168
10169 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
10170         LDKHTLCUpdate ret = *owner->contents.result;
10171         ret.is_owned = false;
10172         return ret;
10173 }
10174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10175         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
10176         LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
10177         int64_t ret_ref = 0;
10178         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10179         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10180         return ret_ref;
10181 }
10182
10183 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
10184 CHECK(!owner->result_ok);
10185         return DecodeError_clone(&*owner->contents.err);
10186 }
10187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10188         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
10189         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10190         *ret_copy = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
10191         int64_t ret_ref = tag_ptr(ret_copy, true);
10192         return ret_ref;
10193 }
10194
10195 static inline struct LDKOutPoint C2Tuple_OutPointCVec_u8ZZ_get_a(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR owner){
10196         LDKOutPoint ret = owner->a;
10197         ret.is_owned = false;
10198         return ret;
10199 }
10200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
10201         LDKC2Tuple_OutPointCVec_u8ZZ* owner_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(owner);
10202         LDKOutPoint ret_var = C2Tuple_OutPointCVec_u8ZZ_get_a(owner_conv);
10203         int64_t ret_ref = 0;
10204         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10205         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10206         return ret_ref;
10207 }
10208
10209 static inline struct LDKCVec_u8Z C2Tuple_OutPointCVec_u8ZZ_get_b(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR owner){
10210         return CVec_u8Z_clone(&owner->b);
10211 }
10212 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
10213         LDKC2Tuple_OutPointCVec_u8ZZ* owner_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(owner);
10214         LDKCVec_u8Z ret_var = C2Tuple_OutPointCVec_u8ZZ_get_b(owner_conv);
10215         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
10216         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
10217         CVec_u8Z_free(ret_var);
10218         return ret_arr;
10219 }
10220
10221 static inline uint32_t C2Tuple_u32CVec_u8ZZ_get_a(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR owner){
10222         return owner->a;
10223 }
10224 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
10225         LDKC2Tuple_u32CVec_u8ZZ* owner_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(owner);
10226         int32_t ret_conv = C2Tuple_u32CVec_u8ZZ_get_a(owner_conv);
10227         return ret_conv;
10228 }
10229
10230 static inline struct LDKCVec_u8Z C2Tuple_u32CVec_u8ZZ_get_b(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR owner){
10231         return CVec_u8Z_clone(&owner->b);
10232 }
10233 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
10234         LDKC2Tuple_u32CVec_u8ZZ* owner_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(owner);
10235         LDKCVec_u8Z ret_var = C2Tuple_u32CVec_u8ZZ_get_b(owner_conv);
10236         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
10237         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
10238         CVec_u8Z_free(ret_var);
10239         return ret_arr;
10240 }
10241
10242 static inline LDKCVec_C2Tuple_u32CVec_u8ZZZ CVec_C2Tuple_u32CVec_u8ZZZ_clone(const LDKCVec_C2Tuple_u32CVec_u8ZZZ *orig) {
10243         LDKCVec_C2Tuple_u32CVec_u8ZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ) * orig->datalen, "LDKCVec_C2Tuple_u32CVec_u8ZZZ clone bytes"), .datalen = orig->datalen };
10244         for (size_t i = 0; i < ret.datalen; i++) {
10245                 ret.data[i] = C2Tuple_u32CVec_u8ZZ_clone(&orig->data[i]);
10246         }
10247         return ret;
10248 }
10249 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR owner){
10250         return ThirtyTwoBytes_clone(&owner->a);
10251 }
10252 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
10253         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(owner);
10254         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10255         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(owner_conv).data);
10256         return ret_arr;
10257 }
10258
10259 static inline struct LDKCVec_C2Tuple_u32CVec_u8ZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR owner){
10260         return CVec_C2Tuple_u32CVec_u8ZZZ_clone(&owner->b);
10261 }
10262 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
10263         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(owner);
10264         LDKCVec_C2Tuple_u32CVec_u8ZZZ ret_var = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(owner_conv);
10265         int64_tArray ret_arr = NULL;
10266         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
10267         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
10268         for (size_t x = 0; x < ret_var.datalen; x++) {
10269                 LDKC2Tuple_u32CVec_u8ZZ* ret_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
10270                 *ret_conv_23_conv = ret_var.data[x];
10271                 ret_arr_ptr[x] = tag_ptr(ret_conv_23_conv, true);
10272         }
10273         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
10274         FREE(ret_var.data);
10275         return ret_arr;
10276 }
10277
10278 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ *orig) {
10279         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 };
10280         for (size_t i = 0; i < ret.datalen; i++) {
10281                 ret.data[i] = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(&orig->data[i]);
10282         }
10283         return ret;
10284 }
10285 static inline LDKCVec_CommitmentTransactionZ CVec_CommitmentTransactionZ_clone(const LDKCVec_CommitmentTransactionZ *orig) {
10286         LDKCVec_CommitmentTransactionZ ret = { .data = MALLOC(sizeof(LDKCommitmentTransaction) * orig->datalen, "LDKCVec_CommitmentTransactionZ clone bytes"), .datalen = orig->datalen };
10287         for (size_t i = 0; i < ret.datalen; i++) {
10288                 ret.data[i] = CommitmentTransaction_clone(&orig->data[i]);
10289         }
10290         return ret;
10291 }
10292 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
10293         return owner->a;
10294 }
10295 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
10296         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
10297         int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
10298         return ret_conv;
10299 }
10300
10301 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
10302         return TxOut_clone(&owner->b);
10303 }
10304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
10305         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
10306         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
10307         *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
10308         return tag_ptr(ret_ref, true);
10309 }
10310
10311 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
10312         LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
10313         for (size_t i = 0; i < ret.datalen; i++) {
10314                 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
10315         }
10316         return ret;
10317 }
10318 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
10319         return ThirtyTwoBytes_clone(&owner->a);
10320 }
10321 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
10322         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
10323         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10324         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data);
10325         return ret_arr;
10326 }
10327
10328 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
10329         return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
10330 }
10331 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
10332         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
10333         LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
10334         int64_tArray ret_arr = NULL;
10335         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
10336         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
10337         for (size_t u = 0; u < ret_var.datalen; u++) {
10338                 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
10339                 *ret_conv_20_conv = ret_var.data[u];
10340                 ret_arr_ptr[u] = tag_ptr(ret_conv_20_conv, true);
10341         }
10342         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
10343         FREE(ret_var.data);
10344         return ret_arr;
10345 }
10346
10347 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ *orig) {
10348         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 };
10349         for (size_t i = 0; i < ret.datalen; i++) {
10350                 ret.data[i] = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
10351         }
10352         return ret;
10353 }
10354 static jclass LDKBalance_ClaimableOnChannelClose_class = NULL;
10355 static jmethodID LDKBalance_ClaimableOnChannelClose_meth = NULL;
10356 static jclass LDKBalance_ClaimableAwaitingConfirmations_class = NULL;
10357 static jmethodID LDKBalance_ClaimableAwaitingConfirmations_meth = NULL;
10358 static jclass LDKBalance_ContentiousClaimable_class = NULL;
10359 static jmethodID LDKBalance_ContentiousClaimable_meth = NULL;
10360 static jclass LDKBalance_MaybeTimeoutClaimableHTLC_class = NULL;
10361 static jmethodID LDKBalance_MaybeTimeoutClaimableHTLC_meth = NULL;
10362 static jclass LDKBalance_MaybePreimageClaimableHTLC_class = NULL;
10363 static jmethodID LDKBalance_MaybePreimageClaimableHTLC_meth = NULL;
10364 static jclass LDKBalance_CounterpartyRevokedOutputClaimable_class = NULL;
10365 static jmethodID LDKBalance_CounterpartyRevokedOutputClaimable_meth = NULL;
10366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBalance_init (JNIEnv *env, jclass clz) {
10367         LDKBalance_ClaimableOnChannelClose_class =
10368                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableOnChannelClose"));
10369         CHECK(LDKBalance_ClaimableOnChannelClose_class != NULL);
10370         LDKBalance_ClaimableOnChannelClose_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableOnChannelClose_class, "<init>", "(J)V");
10371         CHECK(LDKBalance_ClaimableOnChannelClose_meth != NULL);
10372         LDKBalance_ClaimableAwaitingConfirmations_class =
10373                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableAwaitingConfirmations"));
10374         CHECK(LDKBalance_ClaimableAwaitingConfirmations_class != NULL);
10375         LDKBalance_ClaimableAwaitingConfirmations_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableAwaitingConfirmations_class, "<init>", "(JI)V");
10376         CHECK(LDKBalance_ClaimableAwaitingConfirmations_meth != NULL);
10377         LDKBalance_ContentiousClaimable_class =
10378                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ContentiousClaimable"));
10379         CHECK(LDKBalance_ContentiousClaimable_class != NULL);
10380         LDKBalance_ContentiousClaimable_meth = (*env)->GetMethodID(env, LDKBalance_ContentiousClaimable_class, "<init>", "(JI[B[B)V");
10381         CHECK(LDKBalance_ContentiousClaimable_meth != NULL);
10382         LDKBalance_MaybeTimeoutClaimableHTLC_class =
10383                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$MaybeTimeoutClaimableHTLC"));
10384         CHECK(LDKBalance_MaybeTimeoutClaimableHTLC_class != NULL);
10385         LDKBalance_MaybeTimeoutClaimableHTLC_meth = (*env)->GetMethodID(env, LDKBalance_MaybeTimeoutClaimableHTLC_class, "<init>", "(JI[B)V");
10386         CHECK(LDKBalance_MaybeTimeoutClaimableHTLC_meth != NULL);
10387         LDKBalance_MaybePreimageClaimableHTLC_class =
10388                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$MaybePreimageClaimableHTLC"));
10389         CHECK(LDKBalance_MaybePreimageClaimableHTLC_class != NULL);
10390         LDKBalance_MaybePreimageClaimableHTLC_meth = (*env)->GetMethodID(env, LDKBalance_MaybePreimageClaimableHTLC_class, "<init>", "(JI[B)V");
10391         CHECK(LDKBalance_MaybePreimageClaimableHTLC_meth != NULL);
10392         LDKBalance_CounterpartyRevokedOutputClaimable_class =
10393                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$CounterpartyRevokedOutputClaimable"));
10394         CHECK(LDKBalance_CounterpartyRevokedOutputClaimable_class != NULL);
10395         LDKBalance_CounterpartyRevokedOutputClaimable_meth = (*env)->GetMethodID(env, LDKBalance_CounterpartyRevokedOutputClaimable_class, "<init>", "(J)V");
10396         CHECK(LDKBalance_CounterpartyRevokedOutputClaimable_meth != NULL);
10397 }
10398 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBalance_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10399         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
10400         switch(obj->tag) {
10401                 case LDKBalance_ClaimableOnChannelClose: {
10402                         int64_t amount_satoshis_conv = obj->claimable_on_channel_close.amount_satoshis;
10403                         return (*env)->NewObject(env, LDKBalance_ClaimableOnChannelClose_class, LDKBalance_ClaimableOnChannelClose_meth, amount_satoshis_conv);
10404                 }
10405                 case LDKBalance_ClaimableAwaitingConfirmations: {
10406                         int64_t amount_satoshis_conv = obj->claimable_awaiting_confirmations.amount_satoshis;
10407                         int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
10408                         return (*env)->NewObject(env, LDKBalance_ClaimableAwaitingConfirmations_class, LDKBalance_ClaimableAwaitingConfirmations_meth, amount_satoshis_conv, confirmation_height_conv);
10409                 }
10410                 case LDKBalance_ContentiousClaimable: {
10411                         int64_t amount_satoshis_conv = obj->contentious_claimable.amount_satoshis;
10412                         int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
10413                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
10414                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->contentious_claimable.payment_hash.data);
10415                         int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
10416                         (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->contentious_claimable.payment_preimage.data);
10417                         return (*env)->NewObject(env, LDKBalance_ContentiousClaimable_class, LDKBalance_ContentiousClaimable_meth, amount_satoshis_conv, timeout_height_conv, payment_hash_arr, payment_preimage_arr);
10418                 }
10419                 case LDKBalance_MaybeTimeoutClaimableHTLC: {
10420                         int64_t amount_satoshis_conv = obj->maybe_timeout_claimable_htlc.amount_satoshis;
10421                         int32_t claimable_height_conv = obj->maybe_timeout_claimable_htlc.claimable_height;
10422                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
10423                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->maybe_timeout_claimable_htlc.payment_hash.data);
10424                         return (*env)->NewObject(env, LDKBalance_MaybeTimeoutClaimableHTLC_class, LDKBalance_MaybeTimeoutClaimableHTLC_meth, amount_satoshis_conv, claimable_height_conv, payment_hash_arr);
10425                 }
10426                 case LDKBalance_MaybePreimageClaimableHTLC: {
10427                         int64_t amount_satoshis_conv = obj->maybe_preimage_claimable_htlc.amount_satoshis;
10428                         int32_t expiry_height_conv = obj->maybe_preimage_claimable_htlc.expiry_height;
10429                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
10430                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->maybe_preimage_claimable_htlc.payment_hash.data);
10431                         return (*env)->NewObject(env, LDKBalance_MaybePreimageClaimableHTLC_class, LDKBalance_MaybePreimageClaimableHTLC_meth, amount_satoshis_conv, expiry_height_conv, payment_hash_arr);
10432                 }
10433                 case LDKBalance_CounterpartyRevokedOutputClaimable: {
10434                         int64_t amount_satoshis_conv = obj->counterparty_revoked_output_claimable.amount_satoshis;
10435                         return (*env)->NewObject(env, LDKBalance_CounterpartyRevokedOutputClaimable_class, LDKBalance_CounterpartyRevokedOutputClaimable_meth, amount_satoshis_conv);
10436                 }
10437                 default: abort();
10438         }
10439 }
10440 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
10441         LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
10442         for (size_t i = 0; i < ret.datalen; i++) {
10443                 ret.data[i] = Balance_clone(&orig->data[i]);
10444         }
10445         return ret;
10446 }
10447 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR owner){
10448         return ThirtyTwoBytes_clone(&owner->a);
10449 }
10450 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
10451         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(owner);
10452         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10453         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(owner_conv).data);
10454         return ret_arr;
10455 }
10456
10457 static inline struct LDKChannelMonitor C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR owner){
10458         LDKChannelMonitor ret = owner->b;
10459         ret.is_owned = false;
10460         return ret;
10461 }
10462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
10463         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(owner);
10464         LDKChannelMonitor ret_var = C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(owner_conv);
10465         int64_t ret_ref = 0;
10466         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10467         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10468         return ret_ref;
10469 }
10470
10471 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
10472 CHECK(owner->result_ok);
10473         return C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&*owner->contents.result);
10474 }
10475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10476         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
10477         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
10478         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
10479         return tag_ptr(ret_conv, true);
10480 }
10481
10482 static inline struct LDKDecodeError CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
10483 CHECK(!owner->result_ok);
10484         return DecodeError_clone(&*owner->contents.err);
10485 }
10486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10487         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
10488         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10489         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(owner_conv);
10490         int64_t ret_ref = tag_ptr(ret_copy, true);
10491         return ret_ref;
10492 }
10493
10494 typedef struct LDKType_JCalls {
10495         atomic_size_t refcnt;
10496         JavaVM *vm;
10497         jweak o;
10498         jmethodID type_id_meth;
10499         jmethodID debug_str_meth;
10500         jmethodID write_meth;
10501 } LDKType_JCalls;
10502 static void LDKType_JCalls_free(void* this_arg) {
10503         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
10504         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10505                 JNIEnv *env;
10506                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10507                 if (get_jenv_res == JNI_EDETACHED) {
10508                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10509                 } else {
10510                         DO_ASSERT(get_jenv_res == JNI_OK);
10511                 }
10512                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10513                 if (get_jenv_res == JNI_EDETACHED) {
10514                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10515                 }
10516                 FREE(j_calls);
10517         }
10518 }
10519 uint16_t type_id_LDKType_jcall(const void* this_arg) {
10520         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
10521         JNIEnv *env;
10522         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10523         if (get_jenv_res == JNI_EDETACHED) {
10524                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10525         } else {
10526                 DO_ASSERT(get_jenv_res == JNI_OK);
10527         }
10528         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10529         CHECK(obj != NULL);
10530         int16_t ret = (*env)->CallShortMethod(env, obj, j_calls->type_id_meth);
10531         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10532                 (*env)->ExceptionDescribe(env);
10533                 (*env)->FatalError(env, "A call to type_id in LDKType from rust threw an exception.");
10534         }
10535         if (get_jenv_res == JNI_EDETACHED) {
10536                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10537         }
10538         return ret;
10539 }
10540 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
10541         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
10542         JNIEnv *env;
10543         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10544         if (get_jenv_res == JNI_EDETACHED) {
10545                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10546         } else {
10547                 DO_ASSERT(get_jenv_res == JNI_OK);
10548         }
10549         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10550         CHECK(obj != NULL);
10551         jstring ret = (*env)->CallObjectMethod(env, obj, j_calls->debug_str_meth);
10552         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10553                 (*env)->ExceptionDescribe(env);
10554                 (*env)->FatalError(env, "A call to debug_str in LDKType from rust threw an exception.");
10555         }
10556         LDKStr ret_conv = java_to_owned_str(env, ret);
10557         if (get_jenv_res == JNI_EDETACHED) {
10558                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10559         }
10560         return ret_conv;
10561 }
10562 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
10563         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
10564         JNIEnv *env;
10565         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10566         if (get_jenv_res == JNI_EDETACHED) {
10567                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10568         } else {
10569                 DO_ASSERT(get_jenv_res == JNI_OK);
10570         }
10571         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10572         CHECK(obj != NULL);
10573         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
10574         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10575                 (*env)->ExceptionDescribe(env);
10576                 (*env)->FatalError(env, "A call to write in LDKType from rust threw an exception.");
10577         }
10578         LDKCVec_u8Z ret_ref;
10579         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
10580         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
10581         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
10582         if (get_jenv_res == JNI_EDETACHED) {
10583                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10584         }
10585         return ret_ref;
10586 }
10587 static void LDKType_JCalls_cloned(LDKType* new_obj) {
10588         LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
10589         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10590 }
10591 static inline LDKType LDKType_init (JNIEnv *env, jclass clz, jobject o) {
10592         jclass c = (*env)->GetObjectClass(env, o);
10593         CHECK(c != NULL);
10594         LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
10595         atomic_init(&calls->refcnt, 1);
10596         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10597         calls->o = (*env)->NewWeakGlobalRef(env, o);
10598         calls->type_id_meth = (*env)->GetMethodID(env, c, "type_id", "()S");
10599         CHECK(calls->type_id_meth != NULL);
10600         calls->debug_str_meth = (*env)->GetMethodID(env, c, "debug_str", "()Ljava/lang/String;");
10601         CHECK(calls->debug_str_meth != NULL);
10602         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
10603         CHECK(calls->write_meth != NULL);
10604
10605         LDKType ret = {
10606                 .this_arg = (void*) calls,
10607                 .type_id = type_id_LDKType_jcall,
10608                 .debug_str = debug_str_LDKType_jcall,
10609                 .write = write_LDKType_jcall,
10610                 .cloned = LDKType_JCalls_cloned,
10611                 .free = LDKType_JCalls_free,
10612         };
10613         return ret;
10614 }
10615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKType_1new(JNIEnv *env, jclass clz, jobject o) {
10616         LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
10617         *res_ptr = LDKType_init(env, clz, o);
10618         return tag_ptr(res_ptr, true);
10619 }
10620 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Type_1type_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
10621         void* this_arg_ptr = untag_ptr(this_arg);
10622         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10623         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
10624         int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
10625         return ret_conv;
10626 }
10627
10628 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Type_1debug_1str(JNIEnv *env, jclass clz, int64_t this_arg) {
10629         void* this_arg_ptr = untag_ptr(this_arg);
10630         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10631         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
10632         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
10633         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
10634         Str_free(ret_str);
10635         return ret_conv;
10636 }
10637
10638 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Type_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
10639         void* this_arg_ptr = untag_ptr(this_arg);
10640         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10641         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
10642         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
10643         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
10644         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
10645         CVec_u8Z_free(ret_var);
10646         return ret_arr;
10647 }
10648
10649 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
10650         return owner->a;
10651 }
10652 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
10653         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
10654         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
10655         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form);
10656         return ret_arr;
10657 }
10658
10659 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
10660         return Type_clone(&owner->b);
10661 }
10662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
10663         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
10664         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
10665         *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
10666         return tag_ptr(ret_ret, true);
10667 }
10668
10669 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
10670         LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
10671         for (size_t i = 0; i < ret.datalen; i++) {
10672                 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
10673         }
10674         return ret;
10675 }
10676 static inline struct LDKPublicKey C2Tuple_PublicKeyCVec_SocketAddressZZ_get_a(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ *NONNULL_PTR owner){
10677         return owner->a;
10678 }
10679 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCVec_1SocketAddressZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
10680         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(owner);
10681         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
10682         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyCVec_SocketAddressZZ_get_a(owner_conv).compressed_form);
10683         return ret_arr;
10684 }
10685
10686 static inline struct LDKCVec_SocketAddressZ C2Tuple_PublicKeyCVec_SocketAddressZZ_get_b(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ *NONNULL_PTR owner){
10687         return CVec_SocketAddressZ_clone(&owner->b);
10688 }
10689 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCVec_1SocketAddressZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
10690         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(owner);
10691         LDKCVec_SocketAddressZ ret_var = C2Tuple_PublicKeyCVec_SocketAddressZZ_get_b(owner_conv);
10692         int64_tArray ret_arr = NULL;
10693         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
10694         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
10695         for (size_t p = 0; p < ret_var.datalen; p++) {
10696                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
10697                 *ret_conv_15_copy = ret_var.data[p];
10698                 int64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
10699                 ret_arr_ptr[p] = ret_conv_15_ref;
10700         }
10701         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
10702         FREE(ret_var.data);
10703         return ret_arr;
10704 }
10705
10706 static inline LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_clone(const LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ *orig) {
10707         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ clone bytes"), .datalen = orig->datalen };
10708         for (size_t i = 0; i < ret.datalen; i++) {
10709                 ret.data[i] = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(&orig->data[i]);
10710         }
10711         return ret;
10712 }
10713 typedef struct LDKOnionMessageContents_JCalls {
10714         atomic_size_t refcnt;
10715         JavaVM *vm;
10716         jweak o;
10717         jmethodID tlv_type_meth;
10718         jmethodID write_meth;
10719         jmethodID debug_str_meth;
10720 } LDKOnionMessageContents_JCalls;
10721 static void LDKOnionMessageContents_JCalls_free(void* this_arg) {
10722         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
10723         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10724                 JNIEnv *env;
10725                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10726                 if (get_jenv_res == JNI_EDETACHED) {
10727                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10728                 } else {
10729                         DO_ASSERT(get_jenv_res == JNI_OK);
10730                 }
10731                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10732                 if (get_jenv_res == JNI_EDETACHED) {
10733                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10734                 }
10735                 FREE(j_calls);
10736         }
10737 }
10738 uint64_t tlv_type_LDKOnionMessageContents_jcall(const void* this_arg) {
10739         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
10740         JNIEnv *env;
10741         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10742         if (get_jenv_res == JNI_EDETACHED) {
10743                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10744         } else {
10745                 DO_ASSERT(get_jenv_res == JNI_OK);
10746         }
10747         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10748         CHECK(obj != NULL);
10749         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->tlv_type_meth);
10750         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10751                 (*env)->ExceptionDescribe(env);
10752                 (*env)->FatalError(env, "A call to tlv_type in LDKOnionMessageContents from rust threw an exception.");
10753         }
10754         if (get_jenv_res == JNI_EDETACHED) {
10755                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10756         }
10757         return ret;
10758 }
10759 LDKCVec_u8Z write_LDKOnionMessageContents_jcall(const void* this_arg) {
10760         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
10761         JNIEnv *env;
10762         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10763         if (get_jenv_res == JNI_EDETACHED) {
10764                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10765         } else {
10766                 DO_ASSERT(get_jenv_res == JNI_OK);
10767         }
10768         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10769         CHECK(obj != NULL);
10770         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
10771         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10772                 (*env)->ExceptionDescribe(env);
10773                 (*env)->FatalError(env, "A call to write in LDKOnionMessageContents from rust threw an exception.");
10774         }
10775         LDKCVec_u8Z ret_ref;
10776         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
10777         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
10778         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
10779         if (get_jenv_res == JNI_EDETACHED) {
10780                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10781         }
10782         return ret_ref;
10783 }
10784 LDKStr debug_str_LDKOnionMessageContents_jcall(const void* this_arg) {
10785         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
10786         JNIEnv *env;
10787         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10788         if (get_jenv_res == JNI_EDETACHED) {
10789                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10790         } else {
10791                 DO_ASSERT(get_jenv_res == JNI_OK);
10792         }
10793         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10794         CHECK(obj != NULL);
10795         jstring ret = (*env)->CallObjectMethod(env, obj, j_calls->debug_str_meth);
10796         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10797                 (*env)->ExceptionDescribe(env);
10798                 (*env)->FatalError(env, "A call to debug_str in LDKOnionMessageContents from rust threw an exception.");
10799         }
10800         LDKStr ret_conv = java_to_owned_str(env, ret);
10801         if (get_jenv_res == JNI_EDETACHED) {
10802                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10803         }
10804         return ret_conv;
10805 }
10806 static void LDKOnionMessageContents_JCalls_cloned(LDKOnionMessageContents* new_obj) {
10807         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) new_obj->this_arg;
10808         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10809 }
10810 static inline LDKOnionMessageContents LDKOnionMessageContents_init (JNIEnv *env, jclass clz, jobject o) {
10811         jclass c = (*env)->GetObjectClass(env, o);
10812         CHECK(c != NULL);
10813         LDKOnionMessageContents_JCalls *calls = MALLOC(sizeof(LDKOnionMessageContents_JCalls), "LDKOnionMessageContents_JCalls");
10814         atomic_init(&calls->refcnt, 1);
10815         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10816         calls->o = (*env)->NewWeakGlobalRef(env, o);
10817         calls->tlv_type_meth = (*env)->GetMethodID(env, c, "tlv_type", "()J");
10818         CHECK(calls->tlv_type_meth != NULL);
10819         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
10820         CHECK(calls->write_meth != NULL);
10821         calls->debug_str_meth = (*env)->GetMethodID(env, c, "debug_str", "()Ljava/lang/String;");
10822         CHECK(calls->debug_str_meth != NULL);
10823
10824         LDKOnionMessageContents ret = {
10825                 .this_arg = (void*) calls,
10826                 .tlv_type = tlv_type_LDKOnionMessageContents_jcall,
10827                 .write = write_LDKOnionMessageContents_jcall,
10828                 .debug_str = debug_str_LDKOnionMessageContents_jcall,
10829                 .cloned = LDKOnionMessageContents_JCalls_cloned,
10830                 .free = LDKOnionMessageContents_JCalls_free,
10831         };
10832         return ret;
10833 }
10834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageContents_1new(JNIEnv *env, jclass clz, jobject o) {
10835         LDKOnionMessageContents *res_ptr = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
10836         *res_ptr = LDKOnionMessageContents_init(env, clz, o);
10837         return tag_ptr(res_ptr, true);
10838 }
10839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1tlv_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
10840         void* this_arg_ptr = untag_ptr(this_arg);
10841         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10842         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
10843         int64_t ret_conv = (this_arg_conv->tlv_type)(this_arg_conv->this_arg);
10844         return ret_conv;
10845 }
10846
10847 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
10848         void* this_arg_ptr = untag_ptr(this_arg);
10849         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10850         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
10851         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
10852         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
10853         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
10854         CVec_u8Z_free(ret_var);
10855         return ret_arr;
10856 }
10857
10858 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1debug_1str(JNIEnv *env, jclass clz, int64_t this_arg) {
10859         void* this_arg_ptr = untag_ptr(this_arg);
10860         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10861         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
10862         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
10863         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
10864         Str_free(ret_str);
10865         return ret_conv;
10866 }
10867
10868 static jclass LDKCOption_OnionMessageContentsZ_Some_class = NULL;
10869 static jmethodID LDKCOption_OnionMessageContentsZ_Some_meth = NULL;
10870 static jclass LDKCOption_OnionMessageContentsZ_None_class = NULL;
10871 static jmethodID LDKCOption_OnionMessageContentsZ_None_meth = NULL;
10872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1OnionMessageContentsZ_init (JNIEnv *env, jclass clz) {
10873         LDKCOption_OnionMessageContentsZ_Some_class =
10874                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_OnionMessageContentsZ$Some"));
10875         CHECK(LDKCOption_OnionMessageContentsZ_Some_class != NULL);
10876         LDKCOption_OnionMessageContentsZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_OnionMessageContentsZ_Some_class, "<init>", "(J)V");
10877         CHECK(LDKCOption_OnionMessageContentsZ_Some_meth != NULL);
10878         LDKCOption_OnionMessageContentsZ_None_class =
10879                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_OnionMessageContentsZ$None"));
10880         CHECK(LDKCOption_OnionMessageContentsZ_None_class != NULL);
10881         LDKCOption_OnionMessageContentsZ_None_meth = (*env)->GetMethodID(env, LDKCOption_OnionMessageContentsZ_None_class, "<init>", "()V");
10882         CHECK(LDKCOption_OnionMessageContentsZ_None_meth != NULL);
10883 }
10884 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1OnionMessageContentsZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10885         LDKCOption_OnionMessageContentsZ *obj = (LDKCOption_OnionMessageContentsZ*)untag_ptr(ptr);
10886         switch(obj->tag) {
10887                 case LDKCOption_OnionMessageContentsZ_Some: {
10888                         LDKOnionMessageContents* some_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
10889                         *some_ret = OnionMessageContents_clone(&obj->some);
10890                         return (*env)->NewObject(env, LDKCOption_OnionMessageContentsZ_Some_class, LDKCOption_OnionMessageContentsZ_Some_meth, tag_ptr(some_ret, true));
10891                 }
10892                 case LDKCOption_OnionMessageContentsZ_None: {
10893                         return (*env)->NewObject(env, LDKCOption_OnionMessageContentsZ_None_class, LDKCOption_OnionMessageContentsZ_None_meth);
10894                 }
10895                 default: abort();
10896         }
10897 }
10898 static inline struct LDKCOption_OnionMessageContentsZ CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
10899 CHECK(owner->result_ok);
10900         return COption_OnionMessageContentsZ_clone(&*owner->contents.result);
10901 }
10902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10903         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
10904         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
10905         *ret_copy = CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(owner_conv);
10906         int64_t ret_ref = tag_ptr(ret_copy, true);
10907         return ret_ref;
10908 }
10909
10910 static inline struct LDKDecodeError CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
10911 CHECK(!owner->result_ok);
10912         return DecodeError_clone(&*owner->contents.err);
10913 }
10914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10915         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
10916         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10917         *ret_copy = CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(owner_conv);
10918         int64_t ret_ref = tag_ptr(ret_copy, true);
10919         return ret_ref;
10920 }
10921
10922 static inline struct LDKOnionMessageContents C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
10923         return OnionMessageContents_clone(&owner->a);
10924 }
10925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
10926         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
10927         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
10928         *ret_ret = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(owner_conv);
10929         return tag_ptr(ret_ret, true);
10930 }
10931
10932 static inline struct LDKDestination C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
10933         return Destination_clone(&owner->b);
10934 }
10935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
10936         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
10937         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
10938         *ret_copy = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(owner_conv);
10939         int64_t ret_ref = tag_ptr(ret_copy, true);
10940         return ret_ref;
10941 }
10942
10943 static inline struct LDKBlindedPath C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
10944         LDKBlindedPath ret = owner->c;
10945         ret.is_owned = false;
10946         return ret;
10947 }
10948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
10949         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
10950         LDKBlindedPath ret_var = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(owner_conv);
10951         int64_t ret_ref = 0;
10952         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10953         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10954         return ret_ref;
10955 }
10956
10957 static inline LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_clone(const LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ *orig) {
10958         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ) * orig->datalen, "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ clone bytes"), .datalen = orig->datalen };
10959         for (size_t i = 0; i < ret.datalen; i++) {
10960                 ret.data[i] = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(&orig->data[i]);
10961         }
10962         return ret;
10963 }
10964 static jclass LDKCOption_TypeZ_Some_class = NULL;
10965 static jmethodID LDKCOption_TypeZ_Some_meth = NULL;
10966 static jclass LDKCOption_TypeZ_None_class = NULL;
10967 static jmethodID LDKCOption_TypeZ_None_meth = NULL;
10968 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TypeZ_init (JNIEnv *env, jclass clz) {
10969         LDKCOption_TypeZ_Some_class =
10970                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$Some"));
10971         CHECK(LDKCOption_TypeZ_Some_class != NULL);
10972         LDKCOption_TypeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_Some_class, "<init>", "(J)V");
10973         CHECK(LDKCOption_TypeZ_Some_meth != NULL);
10974         LDKCOption_TypeZ_None_class =
10975                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$None"));
10976         CHECK(LDKCOption_TypeZ_None_class != NULL);
10977         LDKCOption_TypeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_None_class, "<init>", "()V");
10978         CHECK(LDKCOption_TypeZ_None_meth != NULL);
10979 }
10980 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TypeZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10981         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
10982         switch(obj->tag) {
10983                 case LDKCOption_TypeZ_Some: {
10984                         LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
10985                         *some_ret = Type_clone(&obj->some);
10986                         return (*env)->NewObject(env, LDKCOption_TypeZ_Some_class, LDKCOption_TypeZ_Some_meth, tag_ptr(some_ret, true));
10987                 }
10988                 case LDKCOption_TypeZ_None: {
10989                         return (*env)->NewObject(env, LDKCOption_TypeZ_None_class, LDKCOption_TypeZ_None_meth);
10990                 }
10991                 default: abort();
10992         }
10993 }
10994 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
10995 CHECK(owner->result_ok);
10996         return COption_TypeZ_clone(&*owner->contents.result);
10997 }
10998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10999         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
11000         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
11001         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
11002         int64_t ret_ref = tag_ptr(ret_copy, true);
11003         return ret_ref;
11004 }
11005
11006 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
11007 CHECK(!owner->result_ok);
11008         return DecodeError_clone(&*owner->contents.err);
11009 }
11010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11011         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
11012         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11013         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
11014         int64_t ret_ref = tag_ptr(ret_copy, true);
11015         return ret_ref;
11016 }
11017
11018 static jclass LDKCOption_SocketAddressZ_Some_class = NULL;
11019 static jmethodID LDKCOption_SocketAddressZ_Some_meth = NULL;
11020 static jclass LDKCOption_SocketAddressZ_None_class = NULL;
11021 static jmethodID LDKCOption_SocketAddressZ_None_meth = NULL;
11022 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1SocketAddressZ_init (JNIEnv *env, jclass clz) {
11023         LDKCOption_SocketAddressZ_Some_class =
11024                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_SocketAddressZ$Some"));
11025         CHECK(LDKCOption_SocketAddressZ_Some_class != NULL);
11026         LDKCOption_SocketAddressZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_SocketAddressZ_Some_class, "<init>", "(J)V");
11027         CHECK(LDKCOption_SocketAddressZ_Some_meth != NULL);
11028         LDKCOption_SocketAddressZ_None_class =
11029                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_SocketAddressZ$None"));
11030         CHECK(LDKCOption_SocketAddressZ_None_class != NULL);
11031         LDKCOption_SocketAddressZ_None_meth = (*env)->GetMethodID(env, LDKCOption_SocketAddressZ_None_class, "<init>", "()V");
11032         CHECK(LDKCOption_SocketAddressZ_None_meth != NULL);
11033 }
11034 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1SocketAddressZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11035         LDKCOption_SocketAddressZ *obj = (LDKCOption_SocketAddressZ*)untag_ptr(ptr);
11036         switch(obj->tag) {
11037                 case LDKCOption_SocketAddressZ_Some: {
11038                         int64_t some_ref = tag_ptr(&obj->some, false);
11039                         return (*env)->NewObject(env, LDKCOption_SocketAddressZ_Some_class, LDKCOption_SocketAddressZ_Some_meth, some_ref);
11040                 }
11041                 case LDKCOption_SocketAddressZ_None: {
11042                         return (*env)->NewObject(env, LDKCOption_SocketAddressZ_None_class, LDKCOption_SocketAddressZ_None_meth);
11043                 }
11044                 default: abort();
11045         }
11046 }
11047 static inline struct LDKPublicKey C2Tuple_PublicKeyCOption_SocketAddressZZ_get_a(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *NONNULL_PTR owner){
11048         return owner->a;
11049 }
11050 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1SocketAddressZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
11051         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(owner);
11052         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
11053         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyCOption_SocketAddressZZ_get_a(owner_conv).compressed_form);
11054         return ret_arr;
11055 }
11056
11057 static inline struct LDKCOption_SocketAddressZ C2Tuple_PublicKeyCOption_SocketAddressZZ_get_b(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *NONNULL_PTR owner){
11058         return COption_SocketAddressZ_clone(&owner->b);
11059 }
11060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1SocketAddressZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
11061         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(owner);
11062         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
11063         *ret_copy = C2Tuple_PublicKeyCOption_SocketAddressZZ_get_b(owner_conv);
11064         int64_t ret_ref = tag_ptr(ret_copy, true);
11065         return ret_ref;
11066 }
11067
11068 static inline LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_clone(const LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ *orig) {
11069         LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ clone bytes"), .datalen = orig->datalen };
11070         for (size_t i = 0; i < ret.datalen; i++) {
11071                 ret.data[i] = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(&orig->data[i]);
11072         }
11073         return ret;
11074 }
11075 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
11076 CHECK(owner->result_ok);
11077         return CVec_u8Z_clone(&*owner->contents.result);
11078 }
11079 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11080         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
11081         LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
11082         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
11083         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
11084         CVec_u8Z_free(ret_var);
11085         return ret_arr;
11086 }
11087
11088 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
11089         LDKPeerHandleError ret = *owner->contents.err;
11090         ret.is_owned = false;
11091         return ret;
11092 }
11093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11094         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
11095         LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
11096         int64_t ret_ref = 0;
11097         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11098         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11099         return ret_ref;
11100 }
11101
11102 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
11103 CHECK(owner->result_ok);
11104         return *owner->contents.result;
11105 }
11106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11107         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
11108         CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
11109 }
11110
11111 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
11112         LDKPeerHandleError ret = *owner->contents.err;
11113         ret.is_owned = false;
11114         return ret;
11115 }
11116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11117         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
11118         LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
11119         int64_t ret_ref = 0;
11120         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11121         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11122         return ret_ref;
11123 }
11124
11125 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
11126 CHECK(owner->result_ok);
11127         return *owner->contents.result;
11128 }
11129 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11130         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
11131         jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
11132         return ret_conv;
11133 }
11134
11135 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
11136         LDKPeerHandleError ret = *owner->contents.err;
11137         ret.is_owned = false;
11138         return ret;
11139 }
11140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11141         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
11142         LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
11143         int64_t ret_ref = 0;
11144         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11145         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11146         return ret_ref;
11147 }
11148
11149 static jclass LDKGraphSyncError_DecodeError_class = NULL;
11150 static jmethodID LDKGraphSyncError_DecodeError_meth = NULL;
11151 static jclass LDKGraphSyncError_LightningError_class = NULL;
11152 static jmethodID LDKGraphSyncError_LightningError_meth = NULL;
11153 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKGraphSyncError_init (JNIEnv *env, jclass clz) {
11154         LDKGraphSyncError_DecodeError_class =
11155                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGraphSyncError$DecodeError"));
11156         CHECK(LDKGraphSyncError_DecodeError_class != NULL);
11157         LDKGraphSyncError_DecodeError_meth = (*env)->GetMethodID(env, LDKGraphSyncError_DecodeError_class, "<init>", "(J)V");
11158         CHECK(LDKGraphSyncError_DecodeError_meth != NULL);
11159         LDKGraphSyncError_LightningError_class =
11160                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGraphSyncError$LightningError"));
11161         CHECK(LDKGraphSyncError_LightningError_class != NULL);
11162         LDKGraphSyncError_LightningError_meth = (*env)->GetMethodID(env, LDKGraphSyncError_LightningError_class, "<init>", "(J)V");
11163         CHECK(LDKGraphSyncError_LightningError_meth != NULL);
11164 }
11165 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKGraphSyncError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11166         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
11167         switch(obj->tag) {
11168                 case LDKGraphSyncError_DecodeError: {
11169                         int64_t decode_error_ref = tag_ptr(&obj->decode_error, false);
11170                         return (*env)->NewObject(env, LDKGraphSyncError_DecodeError_class, LDKGraphSyncError_DecodeError_meth, decode_error_ref);
11171                 }
11172                 case LDKGraphSyncError_LightningError: {
11173                         LDKLightningError lightning_error_var = obj->lightning_error;
11174                         int64_t lightning_error_ref = 0;
11175                         CHECK_INNER_FIELD_ACCESS_OR_NULL(lightning_error_var);
11176                         lightning_error_ref = tag_ptr(lightning_error_var.inner, false);
11177                         return (*env)->NewObject(env, LDKGraphSyncError_LightningError_class, LDKGraphSyncError_LightningError_meth, lightning_error_ref);
11178                 }
11179                 default: abort();
11180         }
11181 }
11182 static inline uint32_t CResult_u32GraphSyncErrorZ_get_ok(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
11183 CHECK(owner->result_ok);
11184         return *owner->contents.result;
11185 }
11186 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11187         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
11188         int32_t ret_conv = CResult_u32GraphSyncErrorZ_get_ok(owner_conv);
11189         return ret_conv;
11190 }
11191
11192 static inline struct LDKGraphSyncError CResult_u32GraphSyncErrorZ_get_err(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
11193 CHECK(!owner->result_ok);
11194         return GraphSyncError_clone(&*owner->contents.err);
11195 }
11196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11197         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
11198         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
11199         *ret_copy = CResult_u32GraphSyncErrorZ_get_err(owner_conv);
11200         int64_t ret_ref = tag_ptr(ret_copy, true);
11201         return ret_ref;
11202 }
11203
11204 static inline struct LDKCVec_u8Z CResult_CVec_u8ZIOErrorZ_get_ok(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR owner){
11205 CHECK(owner->result_ok);
11206         return CVec_u8Z_clone(&*owner->contents.result);
11207 }
11208 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11209         LDKCResult_CVec_u8ZIOErrorZ* owner_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(owner);
11210         LDKCVec_u8Z ret_var = CResult_CVec_u8ZIOErrorZ_get_ok(owner_conv);
11211         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
11212         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
11213         CVec_u8Z_free(ret_var);
11214         return ret_arr;
11215 }
11216
11217 static inline enum LDKIOError CResult_CVec_u8ZIOErrorZ_get_err(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR owner){
11218 CHECK(!owner->result_ok);
11219         return *owner->contents.err;
11220 }
11221 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11222         LDKCResult_CVec_u8ZIOErrorZ* owner_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(owner);
11223         jclass ret_conv = LDKIOError_to_java(env, CResult_CVec_u8ZIOErrorZ_get_err(owner_conv));
11224         return ret_conv;
11225 }
11226
11227 static inline struct LDKCVec_StrZ CResult_CVec_StrZIOErrorZ_get_ok(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR owner){
11228 CHECK(owner->result_ok);
11229         return *owner->contents.result;
11230 }
11231 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11232         LDKCResult_CVec_StrZIOErrorZ* owner_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(owner);
11233         LDKCVec_StrZ ret_var = CResult_CVec_StrZIOErrorZ_get_ok(owner_conv);
11234         jobjectArray ret_arr = NULL;
11235         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, String_clz, NULL);
11236         ;
11237         jstring *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
11238         for (size_t i = 0; i < ret_var.datalen; i++) {
11239                 LDKStr ret_conv_8_str = ret_var.data[i];
11240                 jstring ret_conv_8_conv = str_ref_to_java(env, ret_conv_8_str.chars, ret_conv_8_str.len);
11241                 ret_arr_ptr[i] = ret_conv_8_conv;
11242         }
11243         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
11244         return ret_arr;
11245 }
11246
11247 static inline enum LDKIOError CResult_CVec_StrZIOErrorZ_get_err(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR owner){
11248 CHECK(!owner->result_ok);
11249         return *owner->contents.err;
11250 }
11251 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11252         LDKCResult_CVec_StrZIOErrorZ* owner_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(owner);
11253         jclass ret_conv = LDKIOError_to_java(env, CResult_CVec_StrZIOErrorZ_get_err(owner_conv));
11254         return ret_conv;
11255 }
11256
11257 static inline LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ *orig) {
11258         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
11259         for (size_t i = 0; i < ret.datalen; i++) {
11260                 ret.data[i] = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&orig->data[i]);
11261         }
11262         return ret;
11263 }
11264 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR owner){
11265 CHECK(owner->result_ok);
11266         return CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_clone(&*owner->contents.result);
11267 }
11268 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11269         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(owner);
11270         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(owner_conv);
11271         int64_tArray ret_arr = NULL;
11272         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
11273         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
11274         for (size_t o = 0; o < ret_var.datalen; o++) {
11275                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
11276                 *ret_conv_40_conv = ret_var.data[o];
11277                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
11278         }
11279         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
11280         FREE(ret_var.data);
11281         return ret_arr;
11282 }
11283
11284 static inline enum LDKIOError CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR owner){
11285 CHECK(!owner->result_ok);
11286         return *owner->contents.err;
11287 }
11288 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11289         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(owner);
11290         jclass ret_conv = LDKIOError_to_java(env, CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(owner_conv));
11291         return ret_conv;
11292 }
11293
11294 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR owner){
11295 CHECK(owner->result_ok);
11296         return C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&*owner->contents.result);
11297 }
11298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11299         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(owner);
11300         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
11301         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(owner_conv);
11302         return tag_ptr(ret_conv, true);
11303 }
11304
11305 static inline enum LDKIOError CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR owner){
11306 CHECK(!owner->result_ok);
11307         return *owner->contents.err;
11308 }
11309 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11310         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(owner);
11311         jclass ret_conv = LDKIOError_to_java(env, CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(owner_conv));
11312         return ret_conv;
11313 }
11314
11315 static jclass LDKCOption_SecretKeyZ_Some_class = NULL;
11316 static jmethodID LDKCOption_SecretKeyZ_Some_meth = NULL;
11317 static jclass LDKCOption_SecretKeyZ_None_class = NULL;
11318 static jmethodID LDKCOption_SecretKeyZ_None_meth = NULL;
11319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1SecretKeyZ_init (JNIEnv *env, jclass clz) {
11320         LDKCOption_SecretKeyZ_Some_class =
11321                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_SecretKeyZ$Some"));
11322         CHECK(LDKCOption_SecretKeyZ_Some_class != NULL);
11323         LDKCOption_SecretKeyZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_SecretKeyZ_Some_class, "<init>", "([B)V");
11324         CHECK(LDKCOption_SecretKeyZ_Some_meth != NULL);
11325         LDKCOption_SecretKeyZ_None_class =
11326                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_SecretKeyZ$None"));
11327         CHECK(LDKCOption_SecretKeyZ_None_class != NULL);
11328         LDKCOption_SecretKeyZ_None_meth = (*env)->GetMethodID(env, LDKCOption_SecretKeyZ_None_class, "<init>", "()V");
11329         CHECK(LDKCOption_SecretKeyZ_None_meth != NULL);
11330 }
11331 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1SecretKeyZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11332         LDKCOption_SecretKeyZ *obj = (LDKCOption_SecretKeyZ*)untag_ptr(ptr);
11333         switch(obj->tag) {
11334                 case LDKCOption_SecretKeyZ_Some: {
11335                         int8_tArray some_arr = (*env)->NewByteArray(env, 32);
11336                         (*env)->SetByteArrayRegion(env, some_arr, 0, 32, obj->some.bytes);
11337                         return (*env)->NewObject(env, LDKCOption_SecretKeyZ_Some_class, LDKCOption_SecretKeyZ_Some_meth, some_arr);
11338                 }
11339                 case LDKCOption_SecretKeyZ_None: {
11340                         return (*env)->NewObject(env, LDKCOption_SecretKeyZ_None_class, LDKCOption_SecretKeyZ_None_meth);
11341                 }
11342                 default: abort();
11343         }
11344 }
11345 static inline struct LDKVerifiedInvoiceRequest CResult_VerifiedInvoiceRequestNoneZ_get_ok(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR owner){
11346         LDKVerifiedInvoiceRequest ret = *owner->contents.result;
11347         ret.is_owned = false;
11348         return ret;
11349 }
11350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11351         LDKCResult_VerifiedInvoiceRequestNoneZ* owner_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(owner);
11352         LDKVerifiedInvoiceRequest ret_var = CResult_VerifiedInvoiceRequestNoneZ_get_ok(owner_conv);
11353         int64_t ret_ref = 0;
11354         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11355         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11356         return ret_ref;
11357 }
11358
11359 static inline void CResult_VerifiedInvoiceRequestNoneZ_get_err(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR owner){
11360 CHECK(!owner->result_ok);
11361         return *owner->contents.err;
11362 }
11363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11364         LDKCResult_VerifiedInvoiceRequestNoneZ* owner_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(owner);
11365         CResult_VerifiedInvoiceRequestNoneZ_get_err(owner_conv);
11366 }
11367
11368 static inline LDKCVec_WitnessZ CVec_WitnessZ_clone(const LDKCVec_WitnessZ *orig) {
11369         LDKCVec_WitnessZ ret = { .data = MALLOC(sizeof(LDKWitness) * orig->datalen, "LDKCVec_WitnessZ clone bytes"), .datalen = orig->datalen };
11370         for (size_t i = 0; i < ret.datalen; i++) {
11371                 ret.data[i] = Witness_clone(&orig->data[i]);
11372         }
11373         return ret;
11374 }
11375 static jclass LDKCOption_i64Z_Some_class = NULL;
11376 static jmethodID LDKCOption_i64Z_Some_meth = NULL;
11377 static jclass LDKCOption_i64Z_None_class = NULL;
11378 static jmethodID LDKCOption_i64Z_None_meth = NULL;
11379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1i64Z_init (JNIEnv *env, jclass clz) {
11380         LDKCOption_i64Z_Some_class =
11381                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_i64Z$Some"));
11382         CHECK(LDKCOption_i64Z_Some_class != NULL);
11383         LDKCOption_i64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_i64Z_Some_class, "<init>", "(J)V");
11384         CHECK(LDKCOption_i64Z_Some_meth != NULL);
11385         LDKCOption_i64Z_None_class =
11386                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_i64Z$None"));
11387         CHECK(LDKCOption_i64Z_None_class != NULL);
11388         LDKCOption_i64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_i64Z_None_class, "<init>", "()V");
11389         CHECK(LDKCOption_i64Z_None_meth != NULL);
11390 }
11391 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1i64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11392         LDKCOption_i64Z *obj = (LDKCOption_i64Z*)untag_ptr(ptr);
11393         switch(obj->tag) {
11394                 case LDKCOption_i64Z_Some: {
11395                         int64_t some_conv = obj->some;
11396                         return (*env)->NewObject(env, LDKCOption_i64Z_Some_class, LDKCOption_i64Z_Some_meth, some_conv);
11397                 }
11398                 case LDKCOption_i64Z_None: {
11399                         return (*env)->NewObject(env, LDKCOption_i64Z_None_class, LDKCOption_i64Z_None_meth);
11400                 }
11401                 default: abort();
11402         }
11403 }
11404 static inline struct LDKSocketAddress CResult_SocketAddressDecodeErrorZ_get_ok(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR owner){
11405 CHECK(owner->result_ok);
11406         return SocketAddress_clone(&*owner->contents.result);
11407 }
11408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11409         LDKCResult_SocketAddressDecodeErrorZ* owner_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(owner);
11410         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
11411         *ret_copy = CResult_SocketAddressDecodeErrorZ_get_ok(owner_conv);
11412         int64_t ret_ref = tag_ptr(ret_copy, true);
11413         return ret_ref;
11414 }
11415
11416 static inline struct LDKDecodeError CResult_SocketAddressDecodeErrorZ_get_err(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR owner){
11417 CHECK(!owner->result_ok);
11418         return DecodeError_clone(&*owner->contents.err);
11419 }
11420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11421         LDKCResult_SocketAddressDecodeErrorZ* owner_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(owner);
11422         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11423         *ret_copy = CResult_SocketAddressDecodeErrorZ_get_err(owner_conv);
11424         int64_t ret_ref = tag_ptr(ret_copy, true);
11425         return ret_ref;
11426 }
11427
11428 static inline struct LDKSocketAddress CResult_SocketAddressSocketAddressParseErrorZ_get_ok(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR owner){
11429 CHECK(owner->result_ok);
11430         return SocketAddress_clone(&*owner->contents.result);
11431 }
11432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11433         LDKCResult_SocketAddressSocketAddressParseErrorZ* owner_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(owner);
11434         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
11435         *ret_copy = CResult_SocketAddressSocketAddressParseErrorZ_get_ok(owner_conv);
11436         int64_t ret_ref = tag_ptr(ret_copy, true);
11437         return ret_ref;
11438 }
11439
11440 static inline enum LDKSocketAddressParseError CResult_SocketAddressSocketAddressParseErrorZ_get_err(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR owner){
11441 CHECK(!owner->result_ok);
11442         return SocketAddressParseError_clone(&*owner->contents.err);
11443 }
11444 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11445         LDKCResult_SocketAddressSocketAddressParseErrorZ* owner_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(owner);
11446         jclass ret_conv = LDKSocketAddressParseError_to_java(env, CResult_SocketAddressSocketAddressParseErrorZ_get_err(owner_conv));
11447         return ret_conv;
11448 }
11449
11450 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
11451         LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
11452         for (size_t i = 0; i < ret.datalen; i++) {
11453                 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
11454         }
11455         return ret;
11456 }
11457 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
11458         LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
11459         for (size_t i = 0; i < ret.datalen; i++) {
11460                 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
11461         }
11462         return ret;
11463 }
11464 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
11465         LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
11466         for (size_t i = 0; i < ret.datalen; i++) {
11467                 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
11468         }
11469         return ret;
11470 }
11471 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
11472         LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
11473         for (size_t i = 0; i < ret.datalen; i++) {
11474                 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
11475         }
11476         return ret;
11477 }
11478 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
11479         LDKAcceptChannel ret = *owner->contents.result;
11480         ret.is_owned = false;
11481         return ret;
11482 }
11483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11484         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
11485         LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
11486         int64_t ret_ref = 0;
11487         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11488         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11489         return ret_ref;
11490 }
11491
11492 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
11493 CHECK(!owner->result_ok);
11494         return DecodeError_clone(&*owner->contents.err);
11495 }
11496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11497         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
11498         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11499         *ret_copy = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
11500         int64_t ret_ref = tag_ptr(ret_copy, true);
11501         return ret_ref;
11502 }
11503
11504 static inline struct LDKAcceptChannelV2 CResult_AcceptChannelV2DecodeErrorZ_get_ok(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
11505         LDKAcceptChannelV2 ret = *owner->contents.result;
11506         ret.is_owned = false;
11507         return ret;
11508 }
11509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11510         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
11511         LDKAcceptChannelV2 ret_var = CResult_AcceptChannelV2DecodeErrorZ_get_ok(owner_conv);
11512         int64_t ret_ref = 0;
11513         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11514         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11515         return ret_ref;
11516 }
11517
11518 static inline struct LDKDecodeError CResult_AcceptChannelV2DecodeErrorZ_get_err(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
11519 CHECK(!owner->result_ok);
11520         return DecodeError_clone(&*owner->contents.err);
11521 }
11522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11523         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
11524         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11525         *ret_copy = CResult_AcceptChannelV2DecodeErrorZ_get_err(owner_conv);
11526         int64_t ret_ref = tag_ptr(ret_copy, true);
11527         return ret_ref;
11528 }
11529
11530 static inline struct LDKStfu CResult_StfuDecodeErrorZ_get_ok(LDKCResult_StfuDecodeErrorZ *NONNULL_PTR owner){
11531         LDKStfu ret = *owner->contents.result;
11532         ret.is_owned = false;
11533         return ret;
11534 }
11535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StfuDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11536         LDKCResult_StfuDecodeErrorZ* owner_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(owner);
11537         LDKStfu ret_var = CResult_StfuDecodeErrorZ_get_ok(owner_conv);
11538         int64_t ret_ref = 0;
11539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11541         return ret_ref;
11542 }
11543
11544 static inline struct LDKDecodeError CResult_StfuDecodeErrorZ_get_err(LDKCResult_StfuDecodeErrorZ *NONNULL_PTR owner){
11545 CHECK(!owner->result_ok);
11546         return DecodeError_clone(&*owner->contents.err);
11547 }
11548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StfuDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11549         LDKCResult_StfuDecodeErrorZ* owner_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(owner);
11550         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11551         *ret_copy = CResult_StfuDecodeErrorZ_get_err(owner_conv);
11552         int64_t ret_ref = tag_ptr(ret_copy, true);
11553         return ret_ref;
11554 }
11555
11556 static inline struct LDKSplice CResult_SpliceDecodeErrorZ_get_ok(LDKCResult_SpliceDecodeErrorZ *NONNULL_PTR owner){
11557         LDKSplice ret = *owner->contents.result;
11558         ret.is_owned = false;
11559         return ret;
11560 }
11561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11562         LDKCResult_SpliceDecodeErrorZ* owner_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(owner);
11563         LDKSplice ret_var = CResult_SpliceDecodeErrorZ_get_ok(owner_conv);
11564         int64_t ret_ref = 0;
11565         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11566         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11567         return ret_ref;
11568 }
11569
11570 static inline struct LDKDecodeError CResult_SpliceDecodeErrorZ_get_err(LDKCResult_SpliceDecodeErrorZ *NONNULL_PTR owner){
11571 CHECK(!owner->result_ok);
11572         return DecodeError_clone(&*owner->contents.err);
11573 }
11574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11575         LDKCResult_SpliceDecodeErrorZ* owner_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(owner);
11576         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11577         *ret_copy = CResult_SpliceDecodeErrorZ_get_err(owner_conv);
11578         int64_t ret_ref = tag_ptr(ret_copy, true);
11579         return ret_ref;
11580 }
11581
11582 static inline struct LDKSpliceAck CResult_SpliceAckDecodeErrorZ_get_ok(LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR owner){
11583         LDKSpliceAck ret = *owner->contents.result;
11584         ret.is_owned = false;
11585         return ret;
11586 }
11587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceAckDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11588         LDKCResult_SpliceAckDecodeErrorZ* owner_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(owner);
11589         LDKSpliceAck ret_var = CResult_SpliceAckDecodeErrorZ_get_ok(owner_conv);
11590         int64_t ret_ref = 0;
11591         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11592         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11593         return ret_ref;
11594 }
11595
11596 static inline struct LDKDecodeError CResult_SpliceAckDecodeErrorZ_get_err(LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR owner){
11597 CHECK(!owner->result_ok);
11598         return DecodeError_clone(&*owner->contents.err);
11599 }
11600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceAckDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11601         LDKCResult_SpliceAckDecodeErrorZ* owner_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(owner);
11602         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11603         *ret_copy = CResult_SpliceAckDecodeErrorZ_get_err(owner_conv);
11604         int64_t ret_ref = tag_ptr(ret_copy, true);
11605         return ret_ref;
11606 }
11607
11608 static inline struct LDKSpliceLocked CResult_SpliceLockedDecodeErrorZ_get_ok(LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR owner){
11609         LDKSpliceLocked ret = *owner->contents.result;
11610         ret.is_owned = false;
11611         return ret;
11612 }
11613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceLockedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11614         LDKCResult_SpliceLockedDecodeErrorZ* owner_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(owner);
11615         LDKSpliceLocked ret_var = CResult_SpliceLockedDecodeErrorZ_get_ok(owner_conv);
11616         int64_t ret_ref = 0;
11617         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11618         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11619         return ret_ref;
11620 }
11621
11622 static inline struct LDKDecodeError CResult_SpliceLockedDecodeErrorZ_get_err(LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR owner){
11623 CHECK(!owner->result_ok);
11624         return DecodeError_clone(&*owner->contents.err);
11625 }
11626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceLockedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11627         LDKCResult_SpliceLockedDecodeErrorZ* owner_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(owner);
11628         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11629         *ret_copy = CResult_SpliceLockedDecodeErrorZ_get_err(owner_conv);
11630         int64_t ret_ref = tag_ptr(ret_copy, true);
11631         return ret_ref;
11632 }
11633
11634 static inline struct LDKTxAddInput CResult_TxAddInputDecodeErrorZ_get_ok(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
11635         LDKTxAddInput ret = *owner->contents.result;
11636         ret.is_owned = false;
11637         return ret;
11638 }
11639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11640         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
11641         LDKTxAddInput ret_var = CResult_TxAddInputDecodeErrorZ_get_ok(owner_conv);
11642         int64_t ret_ref = 0;
11643         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11644         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11645         return ret_ref;
11646 }
11647
11648 static inline struct LDKDecodeError CResult_TxAddInputDecodeErrorZ_get_err(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
11649 CHECK(!owner->result_ok);
11650         return DecodeError_clone(&*owner->contents.err);
11651 }
11652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11653         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
11654         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11655         *ret_copy = CResult_TxAddInputDecodeErrorZ_get_err(owner_conv);
11656         int64_t ret_ref = tag_ptr(ret_copy, true);
11657         return ret_ref;
11658 }
11659
11660 static inline struct LDKTxAddOutput CResult_TxAddOutputDecodeErrorZ_get_ok(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
11661         LDKTxAddOutput ret = *owner->contents.result;
11662         ret.is_owned = false;
11663         return ret;
11664 }
11665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11666         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
11667         LDKTxAddOutput ret_var = CResult_TxAddOutputDecodeErrorZ_get_ok(owner_conv);
11668         int64_t ret_ref = 0;
11669         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11670         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11671         return ret_ref;
11672 }
11673
11674 static inline struct LDKDecodeError CResult_TxAddOutputDecodeErrorZ_get_err(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
11675 CHECK(!owner->result_ok);
11676         return DecodeError_clone(&*owner->contents.err);
11677 }
11678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11679         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
11680         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11681         *ret_copy = CResult_TxAddOutputDecodeErrorZ_get_err(owner_conv);
11682         int64_t ret_ref = tag_ptr(ret_copy, true);
11683         return ret_ref;
11684 }
11685
11686 static inline struct LDKTxRemoveInput CResult_TxRemoveInputDecodeErrorZ_get_ok(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
11687         LDKTxRemoveInput ret = *owner->contents.result;
11688         ret.is_owned = false;
11689         return ret;
11690 }
11691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11692         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
11693         LDKTxRemoveInput ret_var = CResult_TxRemoveInputDecodeErrorZ_get_ok(owner_conv);
11694         int64_t ret_ref = 0;
11695         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11696         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11697         return ret_ref;
11698 }
11699
11700 static inline struct LDKDecodeError CResult_TxRemoveInputDecodeErrorZ_get_err(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
11701 CHECK(!owner->result_ok);
11702         return DecodeError_clone(&*owner->contents.err);
11703 }
11704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11705         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
11706         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11707         *ret_copy = CResult_TxRemoveInputDecodeErrorZ_get_err(owner_conv);
11708         int64_t ret_ref = tag_ptr(ret_copy, true);
11709         return ret_ref;
11710 }
11711
11712 static inline struct LDKTxRemoveOutput CResult_TxRemoveOutputDecodeErrorZ_get_ok(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
11713         LDKTxRemoveOutput ret = *owner->contents.result;
11714         ret.is_owned = false;
11715         return ret;
11716 }
11717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11718         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
11719         LDKTxRemoveOutput ret_var = CResult_TxRemoveOutputDecodeErrorZ_get_ok(owner_conv);
11720         int64_t ret_ref = 0;
11721         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11722         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11723         return ret_ref;
11724 }
11725
11726 static inline struct LDKDecodeError CResult_TxRemoveOutputDecodeErrorZ_get_err(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
11727 CHECK(!owner->result_ok);
11728         return DecodeError_clone(&*owner->contents.err);
11729 }
11730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11731         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
11732         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11733         *ret_copy = CResult_TxRemoveOutputDecodeErrorZ_get_err(owner_conv);
11734         int64_t ret_ref = tag_ptr(ret_copy, true);
11735         return ret_ref;
11736 }
11737
11738 static inline struct LDKTxComplete CResult_TxCompleteDecodeErrorZ_get_ok(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
11739         LDKTxComplete ret = *owner->contents.result;
11740         ret.is_owned = false;
11741         return ret;
11742 }
11743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11744         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
11745         LDKTxComplete ret_var = CResult_TxCompleteDecodeErrorZ_get_ok(owner_conv);
11746         int64_t ret_ref = 0;
11747         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11748         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11749         return ret_ref;
11750 }
11751
11752 static inline struct LDKDecodeError CResult_TxCompleteDecodeErrorZ_get_err(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
11753 CHECK(!owner->result_ok);
11754         return DecodeError_clone(&*owner->contents.err);
11755 }
11756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11757         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
11758         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11759         *ret_copy = CResult_TxCompleteDecodeErrorZ_get_err(owner_conv);
11760         int64_t ret_ref = tag_ptr(ret_copy, true);
11761         return ret_ref;
11762 }
11763
11764 static inline struct LDKTxSignatures CResult_TxSignaturesDecodeErrorZ_get_ok(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
11765         LDKTxSignatures ret = *owner->contents.result;
11766         ret.is_owned = false;
11767         return ret;
11768 }
11769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11770         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
11771         LDKTxSignatures ret_var = CResult_TxSignaturesDecodeErrorZ_get_ok(owner_conv);
11772         int64_t ret_ref = 0;
11773         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11774         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11775         return ret_ref;
11776 }
11777
11778 static inline struct LDKDecodeError CResult_TxSignaturesDecodeErrorZ_get_err(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
11779 CHECK(!owner->result_ok);
11780         return DecodeError_clone(&*owner->contents.err);
11781 }
11782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11783         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
11784         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11785         *ret_copy = CResult_TxSignaturesDecodeErrorZ_get_err(owner_conv);
11786         int64_t ret_ref = tag_ptr(ret_copy, true);
11787         return ret_ref;
11788 }
11789
11790 static inline struct LDKTxInitRbf CResult_TxInitRbfDecodeErrorZ_get_ok(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
11791         LDKTxInitRbf ret = *owner->contents.result;
11792         ret.is_owned = false;
11793         return ret;
11794 }
11795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11796         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
11797         LDKTxInitRbf ret_var = CResult_TxInitRbfDecodeErrorZ_get_ok(owner_conv);
11798         int64_t ret_ref = 0;
11799         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11800         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11801         return ret_ref;
11802 }
11803
11804 static inline struct LDKDecodeError CResult_TxInitRbfDecodeErrorZ_get_err(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
11805 CHECK(!owner->result_ok);
11806         return DecodeError_clone(&*owner->contents.err);
11807 }
11808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11809         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
11810         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11811         *ret_copy = CResult_TxInitRbfDecodeErrorZ_get_err(owner_conv);
11812         int64_t ret_ref = tag_ptr(ret_copy, true);
11813         return ret_ref;
11814 }
11815
11816 static inline struct LDKTxAckRbf CResult_TxAckRbfDecodeErrorZ_get_ok(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
11817         LDKTxAckRbf ret = *owner->contents.result;
11818         ret.is_owned = false;
11819         return ret;
11820 }
11821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11822         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
11823         LDKTxAckRbf ret_var = CResult_TxAckRbfDecodeErrorZ_get_ok(owner_conv);
11824         int64_t ret_ref = 0;
11825         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11826         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11827         return ret_ref;
11828 }
11829
11830 static inline struct LDKDecodeError CResult_TxAckRbfDecodeErrorZ_get_err(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
11831 CHECK(!owner->result_ok);
11832         return DecodeError_clone(&*owner->contents.err);
11833 }
11834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11835         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
11836         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11837         *ret_copy = CResult_TxAckRbfDecodeErrorZ_get_err(owner_conv);
11838         int64_t ret_ref = tag_ptr(ret_copy, true);
11839         return ret_ref;
11840 }
11841
11842 static inline struct LDKTxAbort CResult_TxAbortDecodeErrorZ_get_ok(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
11843         LDKTxAbort ret = *owner->contents.result;
11844         ret.is_owned = false;
11845         return ret;
11846 }
11847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11848         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
11849         LDKTxAbort ret_var = CResult_TxAbortDecodeErrorZ_get_ok(owner_conv);
11850         int64_t ret_ref = 0;
11851         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11852         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11853         return ret_ref;
11854 }
11855
11856 static inline struct LDKDecodeError CResult_TxAbortDecodeErrorZ_get_err(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
11857 CHECK(!owner->result_ok);
11858         return DecodeError_clone(&*owner->contents.err);
11859 }
11860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11861         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
11862         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11863         *ret_copy = CResult_TxAbortDecodeErrorZ_get_err(owner_conv);
11864         int64_t ret_ref = tag_ptr(ret_copy, true);
11865         return ret_ref;
11866 }
11867
11868 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
11869         LDKAnnouncementSignatures ret = *owner->contents.result;
11870         ret.is_owned = false;
11871         return ret;
11872 }
11873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11874         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
11875         LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
11876         int64_t ret_ref = 0;
11877         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11878         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11879         return ret_ref;
11880 }
11881
11882 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
11883 CHECK(!owner->result_ok);
11884         return DecodeError_clone(&*owner->contents.err);
11885 }
11886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11887         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
11888         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11889         *ret_copy = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
11890         int64_t ret_ref = tag_ptr(ret_copy, true);
11891         return ret_ref;
11892 }
11893
11894 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
11895         LDKChannelReestablish ret = *owner->contents.result;
11896         ret.is_owned = false;
11897         return ret;
11898 }
11899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11900         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
11901         LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
11902         int64_t ret_ref = 0;
11903         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11904         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11905         return ret_ref;
11906 }
11907
11908 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
11909 CHECK(!owner->result_ok);
11910         return DecodeError_clone(&*owner->contents.err);
11911 }
11912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11913         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
11914         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11915         *ret_copy = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
11916         int64_t ret_ref = tag_ptr(ret_copy, true);
11917         return ret_ref;
11918 }
11919
11920 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
11921         LDKClosingSigned ret = *owner->contents.result;
11922         ret.is_owned = false;
11923         return ret;
11924 }
11925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11926         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
11927         LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
11928         int64_t ret_ref = 0;
11929         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11930         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11931         return ret_ref;
11932 }
11933
11934 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
11935 CHECK(!owner->result_ok);
11936         return DecodeError_clone(&*owner->contents.err);
11937 }
11938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11939         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
11940         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11941         *ret_copy = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
11942         int64_t ret_ref = tag_ptr(ret_copy, true);
11943         return ret_ref;
11944 }
11945
11946 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
11947         LDKClosingSignedFeeRange ret = *owner->contents.result;
11948         ret.is_owned = false;
11949         return ret;
11950 }
11951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11952         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
11953         LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
11954         int64_t ret_ref = 0;
11955         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11956         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11957         return ret_ref;
11958 }
11959
11960 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
11961 CHECK(!owner->result_ok);
11962         return DecodeError_clone(&*owner->contents.err);
11963 }
11964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11965         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
11966         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11967         *ret_copy = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
11968         int64_t ret_ref = tag_ptr(ret_copy, true);
11969         return ret_ref;
11970 }
11971
11972 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
11973         LDKCommitmentSigned ret = *owner->contents.result;
11974         ret.is_owned = false;
11975         return ret;
11976 }
11977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11978         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
11979         LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
11980         int64_t ret_ref = 0;
11981         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11982         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11983         return ret_ref;
11984 }
11985
11986 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
11987 CHECK(!owner->result_ok);
11988         return DecodeError_clone(&*owner->contents.err);
11989 }
11990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11991         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
11992         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11993         *ret_copy = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
11994         int64_t ret_ref = tag_ptr(ret_copy, true);
11995         return ret_ref;
11996 }
11997
11998 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
11999         LDKFundingCreated ret = *owner->contents.result;
12000         ret.is_owned = false;
12001         return ret;
12002 }
12003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12004         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
12005         LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
12006         int64_t ret_ref = 0;
12007         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12008         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12009         return ret_ref;
12010 }
12011
12012 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
12013 CHECK(!owner->result_ok);
12014         return DecodeError_clone(&*owner->contents.err);
12015 }
12016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12017         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
12018         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12019         *ret_copy = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
12020         int64_t ret_ref = tag_ptr(ret_copy, true);
12021         return ret_ref;
12022 }
12023
12024 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
12025         LDKFundingSigned ret = *owner->contents.result;
12026         ret.is_owned = false;
12027         return ret;
12028 }
12029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12030         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
12031         LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
12032         int64_t ret_ref = 0;
12033         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12034         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12035         return ret_ref;
12036 }
12037
12038 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
12039 CHECK(!owner->result_ok);
12040         return DecodeError_clone(&*owner->contents.err);
12041 }
12042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12043         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
12044         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12045         *ret_copy = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
12046         int64_t ret_ref = tag_ptr(ret_copy, true);
12047         return ret_ref;
12048 }
12049
12050 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
12051         LDKChannelReady ret = *owner->contents.result;
12052         ret.is_owned = false;
12053         return ret;
12054 }
12055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12056         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
12057         LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
12058         int64_t ret_ref = 0;
12059         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12060         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12061         return ret_ref;
12062 }
12063
12064 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
12065 CHECK(!owner->result_ok);
12066         return DecodeError_clone(&*owner->contents.err);
12067 }
12068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12069         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
12070         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12071         *ret_copy = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
12072         int64_t ret_ref = tag_ptr(ret_copy, true);
12073         return ret_ref;
12074 }
12075
12076 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
12077         LDKInit ret = *owner->contents.result;
12078         ret.is_owned = false;
12079         return ret;
12080 }
12081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12082         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
12083         LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
12084         int64_t ret_ref = 0;
12085         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12086         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12087         return ret_ref;
12088 }
12089
12090 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
12091 CHECK(!owner->result_ok);
12092         return DecodeError_clone(&*owner->contents.err);
12093 }
12094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12095         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
12096         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12097         *ret_copy = CResult_InitDecodeErrorZ_get_err(owner_conv);
12098         int64_t ret_ref = tag_ptr(ret_copy, true);
12099         return ret_ref;
12100 }
12101
12102 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
12103         LDKOpenChannel ret = *owner->contents.result;
12104         ret.is_owned = false;
12105         return ret;
12106 }
12107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12108         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
12109         LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
12110         int64_t ret_ref = 0;
12111         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12112         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12113         return ret_ref;
12114 }
12115
12116 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
12117 CHECK(!owner->result_ok);
12118         return DecodeError_clone(&*owner->contents.err);
12119 }
12120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12121         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
12122         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12123         *ret_copy = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
12124         int64_t ret_ref = tag_ptr(ret_copy, true);
12125         return ret_ref;
12126 }
12127
12128 static inline struct LDKOpenChannelV2 CResult_OpenChannelV2DecodeErrorZ_get_ok(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
12129         LDKOpenChannelV2 ret = *owner->contents.result;
12130         ret.is_owned = false;
12131         return ret;
12132 }
12133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12134         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
12135         LDKOpenChannelV2 ret_var = CResult_OpenChannelV2DecodeErrorZ_get_ok(owner_conv);
12136         int64_t ret_ref = 0;
12137         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12138         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12139         return ret_ref;
12140 }
12141
12142 static inline struct LDKDecodeError CResult_OpenChannelV2DecodeErrorZ_get_err(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
12143 CHECK(!owner->result_ok);
12144         return DecodeError_clone(&*owner->contents.err);
12145 }
12146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12147         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
12148         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12149         *ret_copy = CResult_OpenChannelV2DecodeErrorZ_get_err(owner_conv);
12150         int64_t ret_ref = tag_ptr(ret_copy, true);
12151         return ret_ref;
12152 }
12153
12154 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
12155         LDKRevokeAndACK ret = *owner->contents.result;
12156         ret.is_owned = false;
12157         return ret;
12158 }
12159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12160         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
12161         LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
12162         int64_t ret_ref = 0;
12163         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12164         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12165         return ret_ref;
12166 }
12167
12168 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
12169 CHECK(!owner->result_ok);
12170         return DecodeError_clone(&*owner->contents.err);
12171 }
12172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12173         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
12174         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12175         *ret_copy = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
12176         int64_t ret_ref = tag_ptr(ret_copy, true);
12177         return ret_ref;
12178 }
12179
12180 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
12181         LDKShutdown ret = *owner->contents.result;
12182         ret.is_owned = false;
12183         return ret;
12184 }
12185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12186         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
12187         LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
12188         int64_t ret_ref = 0;
12189         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12190         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12191         return ret_ref;
12192 }
12193
12194 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
12195 CHECK(!owner->result_ok);
12196         return DecodeError_clone(&*owner->contents.err);
12197 }
12198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12199         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
12200         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12201         *ret_copy = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
12202         int64_t ret_ref = tag_ptr(ret_copy, true);
12203         return ret_ref;
12204 }
12205
12206 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
12207         LDKUpdateFailHTLC ret = *owner->contents.result;
12208         ret.is_owned = false;
12209         return ret;
12210 }
12211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12212         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
12213         LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
12214         int64_t ret_ref = 0;
12215         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12216         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12217         return ret_ref;
12218 }
12219
12220 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
12221 CHECK(!owner->result_ok);
12222         return DecodeError_clone(&*owner->contents.err);
12223 }
12224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12225         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
12226         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12227         *ret_copy = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
12228         int64_t ret_ref = tag_ptr(ret_copy, true);
12229         return ret_ref;
12230 }
12231
12232 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
12233         LDKUpdateFailMalformedHTLC ret = *owner->contents.result;
12234         ret.is_owned = false;
12235         return ret;
12236 }
12237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12238         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
12239         LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
12240         int64_t ret_ref = 0;
12241         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12242         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12243         return ret_ref;
12244 }
12245
12246 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
12247 CHECK(!owner->result_ok);
12248         return DecodeError_clone(&*owner->contents.err);
12249 }
12250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12251         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
12252         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12253         *ret_copy = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
12254         int64_t ret_ref = tag_ptr(ret_copy, true);
12255         return ret_ref;
12256 }
12257
12258 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
12259         LDKUpdateFee ret = *owner->contents.result;
12260         ret.is_owned = false;
12261         return ret;
12262 }
12263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12264         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
12265         LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
12266         int64_t ret_ref = 0;
12267         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12268         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12269         return ret_ref;
12270 }
12271
12272 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
12273 CHECK(!owner->result_ok);
12274         return DecodeError_clone(&*owner->contents.err);
12275 }
12276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12277         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
12278         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12279         *ret_copy = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
12280         int64_t ret_ref = tag_ptr(ret_copy, true);
12281         return ret_ref;
12282 }
12283
12284 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
12285         LDKUpdateFulfillHTLC ret = *owner->contents.result;
12286         ret.is_owned = false;
12287         return ret;
12288 }
12289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12290         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
12291         LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
12292         int64_t ret_ref = 0;
12293         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12294         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12295         return ret_ref;
12296 }
12297
12298 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
12299 CHECK(!owner->result_ok);
12300         return DecodeError_clone(&*owner->contents.err);
12301 }
12302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12303         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
12304         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12305         *ret_copy = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
12306         int64_t ret_ref = tag_ptr(ret_copy, true);
12307         return ret_ref;
12308 }
12309
12310 static inline struct LDKOnionPacket CResult_OnionPacketDecodeErrorZ_get_ok(LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR owner){
12311         LDKOnionPacket ret = *owner->contents.result;
12312         ret.is_owned = false;
12313         return ret;
12314 }
12315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionPacketDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12316         LDKCResult_OnionPacketDecodeErrorZ* owner_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(owner);
12317         LDKOnionPacket ret_var = CResult_OnionPacketDecodeErrorZ_get_ok(owner_conv);
12318         int64_t ret_ref = 0;
12319         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12320         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12321         return ret_ref;
12322 }
12323
12324 static inline struct LDKDecodeError CResult_OnionPacketDecodeErrorZ_get_err(LDKCResult_OnionPacketDecodeErrorZ *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_1OnionPacketDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12329         LDKCResult_OnionPacketDecodeErrorZ* owner_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(owner);
12330         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12331         *ret_copy = CResult_OnionPacketDecodeErrorZ_get_err(owner_conv);
12332         int64_t ret_ref = tag_ptr(ret_copy, true);
12333         return ret_ref;
12334 }
12335
12336 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
12337         LDKUpdateAddHTLC ret = *owner->contents.result;
12338         ret.is_owned = false;
12339         return ret;
12340 }
12341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12342         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
12343         LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
12344         int64_t ret_ref = 0;
12345         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12346         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12347         return ret_ref;
12348 }
12349
12350 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
12351 CHECK(!owner->result_ok);
12352         return DecodeError_clone(&*owner->contents.err);
12353 }
12354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12355         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
12356         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12357         *ret_copy = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
12358         int64_t ret_ref = tag_ptr(ret_copy, true);
12359         return ret_ref;
12360 }
12361
12362 static inline struct LDKOnionMessage CResult_OnionMessageDecodeErrorZ_get_ok(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
12363         LDKOnionMessage ret = *owner->contents.result;
12364         ret.is_owned = false;
12365         return ret;
12366 }
12367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12368         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
12369         LDKOnionMessage ret_var = CResult_OnionMessageDecodeErrorZ_get_ok(owner_conv);
12370         int64_t ret_ref = 0;
12371         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12372         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12373         return ret_ref;
12374 }
12375
12376 static inline struct LDKDecodeError CResult_OnionMessageDecodeErrorZ_get_err(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
12377 CHECK(!owner->result_ok);
12378         return DecodeError_clone(&*owner->contents.err);
12379 }
12380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12381         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
12382         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12383         *ret_copy = CResult_OnionMessageDecodeErrorZ_get_err(owner_conv);
12384         int64_t ret_ref = tag_ptr(ret_copy, true);
12385         return ret_ref;
12386 }
12387
12388 static inline struct LDKFinalOnionHopData CResult_FinalOnionHopDataDecodeErrorZ_get_ok(LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR owner){
12389         LDKFinalOnionHopData ret = *owner->contents.result;
12390         ret.is_owned = false;
12391         return ret;
12392 }
12393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FinalOnionHopDataDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12394         LDKCResult_FinalOnionHopDataDecodeErrorZ* owner_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(owner);
12395         LDKFinalOnionHopData ret_var = CResult_FinalOnionHopDataDecodeErrorZ_get_ok(owner_conv);
12396         int64_t ret_ref = 0;
12397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12399         return ret_ref;
12400 }
12401
12402 static inline struct LDKDecodeError CResult_FinalOnionHopDataDecodeErrorZ_get_err(LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR owner){
12403 CHECK(!owner->result_ok);
12404         return DecodeError_clone(&*owner->contents.err);
12405 }
12406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FinalOnionHopDataDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12407         LDKCResult_FinalOnionHopDataDecodeErrorZ* owner_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(owner);
12408         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12409         *ret_copy = CResult_FinalOnionHopDataDecodeErrorZ_get_err(owner_conv);
12410         int64_t ret_ref = tag_ptr(ret_copy, true);
12411         return ret_ref;
12412 }
12413
12414 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
12415         LDKPing ret = *owner->contents.result;
12416         ret.is_owned = false;
12417         return ret;
12418 }
12419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12420         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
12421         LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
12422         int64_t ret_ref = 0;
12423         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12424         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12425         return ret_ref;
12426 }
12427
12428 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
12429 CHECK(!owner->result_ok);
12430         return DecodeError_clone(&*owner->contents.err);
12431 }
12432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12433         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
12434         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12435         *ret_copy = CResult_PingDecodeErrorZ_get_err(owner_conv);
12436         int64_t ret_ref = tag_ptr(ret_copy, true);
12437         return ret_ref;
12438 }
12439
12440 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
12441         LDKPong ret = *owner->contents.result;
12442         ret.is_owned = false;
12443         return ret;
12444 }
12445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12446         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
12447         LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
12448         int64_t ret_ref = 0;
12449         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12450         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12451         return ret_ref;
12452 }
12453
12454 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
12455 CHECK(!owner->result_ok);
12456         return DecodeError_clone(&*owner->contents.err);
12457 }
12458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12459         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
12460         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12461         *ret_copy = CResult_PongDecodeErrorZ_get_err(owner_conv);
12462         int64_t ret_ref = tag_ptr(ret_copy, true);
12463         return ret_ref;
12464 }
12465
12466 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
12467         LDKUnsignedChannelAnnouncement ret = *owner->contents.result;
12468         ret.is_owned = false;
12469         return ret;
12470 }
12471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12472         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
12473         LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
12474         int64_t ret_ref = 0;
12475         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12476         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12477         return ret_ref;
12478 }
12479
12480 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
12481 CHECK(!owner->result_ok);
12482         return DecodeError_clone(&*owner->contents.err);
12483 }
12484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12485         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
12486         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12487         *ret_copy = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
12488         int64_t ret_ref = tag_ptr(ret_copy, true);
12489         return ret_ref;
12490 }
12491
12492 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
12493         LDKChannelAnnouncement ret = *owner->contents.result;
12494         ret.is_owned = false;
12495         return ret;
12496 }
12497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12498         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
12499         LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
12500         int64_t ret_ref = 0;
12501         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12502         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12503         return ret_ref;
12504 }
12505
12506 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
12507 CHECK(!owner->result_ok);
12508         return DecodeError_clone(&*owner->contents.err);
12509 }
12510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12511         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
12512         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12513         *ret_copy = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
12514         int64_t ret_ref = tag_ptr(ret_copy, true);
12515         return ret_ref;
12516 }
12517
12518 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
12519         LDKUnsignedChannelUpdate ret = *owner->contents.result;
12520         ret.is_owned = false;
12521         return ret;
12522 }
12523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12524         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
12525         LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
12526         int64_t ret_ref = 0;
12527         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12528         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12529         return ret_ref;
12530 }
12531
12532 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
12533 CHECK(!owner->result_ok);
12534         return DecodeError_clone(&*owner->contents.err);
12535 }
12536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12537         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
12538         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12539         *ret_copy = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
12540         int64_t ret_ref = tag_ptr(ret_copy, true);
12541         return ret_ref;
12542 }
12543
12544 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
12545         LDKChannelUpdate ret = *owner->contents.result;
12546         ret.is_owned = false;
12547         return ret;
12548 }
12549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12550         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
12551         LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
12552         int64_t ret_ref = 0;
12553         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12554         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12555         return ret_ref;
12556 }
12557
12558 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
12559 CHECK(!owner->result_ok);
12560         return DecodeError_clone(&*owner->contents.err);
12561 }
12562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12563         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
12564         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12565         *ret_copy = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
12566         int64_t ret_ref = tag_ptr(ret_copy, true);
12567         return ret_ref;
12568 }
12569
12570 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
12571         LDKErrorMessage ret = *owner->contents.result;
12572         ret.is_owned = false;
12573         return ret;
12574 }
12575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12576         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
12577         LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
12578         int64_t ret_ref = 0;
12579         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12580         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12581         return ret_ref;
12582 }
12583
12584 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
12585 CHECK(!owner->result_ok);
12586         return DecodeError_clone(&*owner->contents.err);
12587 }
12588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12589         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
12590         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12591         *ret_copy = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
12592         int64_t ret_ref = tag_ptr(ret_copy, true);
12593         return ret_ref;
12594 }
12595
12596 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
12597         LDKWarningMessage ret = *owner->contents.result;
12598         ret.is_owned = false;
12599         return ret;
12600 }
12601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12602         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
12603         LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
12604         int64_t ret_ref = 0;
12605         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12606         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12607         return ret_ref;
12608 }
12609
12610 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
12611 CHECK(!owner->result_ok);
12612         return DecodeError_clone(&*owner->contents.err);
12613 }
12614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12615         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
12616         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12617         *ret_copy = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
12618         int64_t ret_ref = tag_ptr(ret_copy, true);
12619         return ret_ref;
12620 }
12621
12622 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
12623         LDKUnsignedNodeAnnouncement ret = *owner->contents.result;
12624         ret.is_owned = false;
12625         return ret;
12626 }
12627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12628         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
12629         LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
12630         int64_t ret_ref = 0;
12631         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12632         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12633         return ret_ref;
12634 }
12635
12636 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
12637 CHECK(!owner->result_ok);
12638         return DecodeError_clone(&*owner->contents.err);
12639 }
12640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12641         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
12642         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12643         *ret_copy = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
12644         int64_t ret_ref = tag_ptr(ret_copy, true);
12645         return ret_ref;
12646 }
12647
12648 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
12649         LDKNodeAnnouncement ret = *owner->contents.result;
12650         ret.is_owned = false;
12651         return ret;
12652 }
12653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12654         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
12655         LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
12656         int64_t ret_ref = 0;
12657         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12658         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12659         return ret_ref;
12660 }
12661
12662 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
12663 CHECK(!owner->result_ok);
12664         return DecodeError_clone(&*owner->contents.err);
12665 }
12666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12667         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
12668         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12669         *ret_copy = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
12670         int64_t ret_ref = tag_ptr(ret_copy, true);
12671         return ret_ref;
12672 }
12673
12674 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
12675         LDKQueryShortChannelIds ret = *owner->contents.result;
12676         ret.is_owned = false;
12677         return ret;
12678 }
12679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12680         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
12681         LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
12682         int64_t ret_ref = 0;
12683         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12684         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12685         return ret_ref;
12686 }
12687
12688 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
12689 CHECK(!owner->result_ok);
12690         return DecodeError_clone(&*owner->contents.err);
12691 }
12692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12693         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
12694         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12695         *ret_copy = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
12696         int64_t ret_ref = tag_ptr(ret_copy, true);
12697         return ret_ref;
12698 }
12699
12700 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
12701         LDKReplyShortChannelIdsEnd ret = *owner->contents.result;
12702         ret.is_owned = false;
12703         return ret;
12704 }
12705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12706         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
12707         LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
12708         int64_t ret_ref = 0;
12709         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12710         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12711         return ret_ref;
12712 }
12713
12714 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
12715 CHECK(!owner->result_ok);
12716         return DecodeError_clone(&*owner->contents.err);
12717 }
12718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12719         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
12720         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12721         *ret_copy = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
12722         int64_t ret_ref = tag_ptr(ret_copy, true);
12723         return ret_ref;
12724 }
12725
12726 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
12727         LDKQueryChannelRange ret = *owner->contents.result;
12728         ret.is_owned = false;
12729         return ret;
12730 }
12731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12732         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
12733         LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
12734         int64_t ret_ref = 0;
12735         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12736         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12737         return ret_ref;
12738 }
12739
12740 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
12741 CHECK(!owner->result_ok);
12742         return DecodeError_clone(&*owner->contents.err);
12743 }
12744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12745         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
12746         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12747         *ret_copy = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
12748         int64_t ret_ref = tag_ptr(ret_copy, true);
12749         return ret_ref;
12750 }
12751
12752 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
12753         LDKReplyChannelRange ret = *owner->contents.result;
12754         ret.is_owned = false;
12755         return ret;
12756 }
12757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12758         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
12759         LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
12760         int64_t ret_ref = 0;
12761         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12762         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12763         return ret_ref;
12764 }
12765
12766 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
12767 CHECK(!owner->result_ok);
12768         return DecodeError_clone(&*owner->contents.err);
12769 }
12770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12771         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
12772         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12773         *ret_copy = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
12774         int64_t ret_ref = tag_ptr(ret_copy, true);
12775         return ret_ref;
12776 }
12777
12778 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
12779         LDKGossipTimestampFilter ret = *owner->contents.result;
12780         ret.is_owned = false;
12781         return ret;
12782 }
12783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12784         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
12785         LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
12786         int64_t ret_ref = 0;
12787         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12788         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12789         return ret_ref;
12790 }
12791
12792 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
12793 CHECK(!owner->result_ok);
12794         return DecodeError_clone(&*owner->contents.err);
12795 }
12796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12797         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
12798         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12799         *ret_copy = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
12800         int64_t ret_ref = tag_ptr(ret_copy, true);
12801         return ret_ref;
12802 }
12803
12804 static inline LDKCVec_PhantomRouteHintsZ CVec_PhantomRouteHintsZ_clone(const LDKCVec_PhantomRouteHintsZ *orig) {
12805         LDKCVec_PhantomRouteHintsZ ret = { .data = MALLOC(sizeof(LDKPhantomRouteHints) * orig->datalen, "LDKCVec_PhantomRouteHintsZ clone bytes"), .datalen = orig->datalen };
12806         for (size_t i = 0; i < ret.datalen; i++) {
12807                 ret.data[i] = PhantomRouteHints_clone(&orig->data[i]);
12808         }
12809         return ret;
12810 }
12811 static jclass LDKSignOrCreationError_SignError_class = NULL;
12812 static jmethodID LDKSignOrCreationError_SignError_meth = NULL;
12813 static jclass LDKSignOrCreationError_CreationError_class = NULL;
12814 static jmethodID LDKSignOrCreationError_CreationError_meth = NULL;
12815 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSignOrCreationError_init (JNIEnv *env, jclass clz) {
12816         LDKSignOrCreationError_SignError_class =
12817                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$SignError"));
12818         CHECK(LDKSignOrCreationError_SignError_class != NULL);
12819         LDKSignOrCreationError_SignError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_SignError_class, "<init>", "()V");
12820         CHECK(LDKSignOrCreationError_SignError_meth != NULL);
12821         LDKSignOrCreationError_CreationError_class =
12822                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$CreationError"));
12823         CHECK(LDKSignOrCreationError_CreationError_class != NULL);
12824         LDKSignOrCreationError_CreationError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_CreationError_class, "<init>", "(Lorg/ldk/enums/CreationError;)V");
12825         CHECK(LDKSignOrCreationError_CreationError_meth != NULL);
12826 }
12827 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSignOrCreationError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12828         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
12829         switch(obj->tag) {
12830                 case LDKSignOrCreationError_SignError: {
12831                         return (*env)->NewObject(env, LDKSignOrCreationError_SignError_class, LDKSignOrCreationError_SignError_meth);
12832                 }
12833                 case LDKSignOrCreationError_CreationError: {
12834                         jclass creation_error_conv = LDKCreationError_to_java(env, obj->creation_error);
12835                         return (*env)->NewObject(env, LDKSignOrCreationError_CreationError_class, LDKSignOrCreationError_CreationError_meth, creation_error_conv);
12836                 }
12837                 default: abort();
12838         }
12839 }
12840 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
12841         LDKBolt11Invoice ret = *owner->contents.result;
12842         ret.is_owned = false;
12843         return ret;
12844 }
12845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12846         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
12847         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
12848         int64_t ret_ref = 0;
12849         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12850         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12851         return ret_ref;
12852 }
12853
12854 static inline struct LDKSignOrCreationError CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
12855 CHECK(!owner->result_ok);
12856         return SignOrCreationError_clone(&*owner->contents.err);
12857 }
12858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12859         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
12860         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
12861         *ret_copy = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(owner_conv);
12862         int64_t ret_ref = tag_ptr(ret_copy, true);
12863         return ret_ref;
12864 }
12865
12866 static inline LDKCVec_FutureZ CVec_FutureZ_clone(const LDKCVec_FutureZ *orig) {
12867         LDKCVec_FutureZ ret = { .data = MALLOC(sizeof(LDKFuture) * orig->datalen, "LDKCVec_FutureZ clone bytes"), .datalen = orig->datalen };
12868         for (size_t i = 0; i < ret.datalen; i++) {
12869                 ret.data[i] = Future_clone(&orig->data[i]);
12870         }
12871         return ret;
12872 }
12873 static inline struct LDKOffersMessage CResult_OffersMessageDecodeErrorZ_get_ok(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
12874 CHECK(owner->result_ok);
12875         return OffersMessage_clone(&*owner->contents.result);
12876 }
12877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12878         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
12879         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
12880         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_ok(owner_conv);
12881         int64_t ret_ref = tag_ptr(ret_copy, true);
12882         return ret_ref;
12883 }
12884
12885 static inline struct LDKDecodeError CResult_OffersMessageDecodeErrorZ_get_err(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
12886 CHECK(!owner->result_ok);
12887         return DecodeError_clone(&*owner->contents.err);
12888 }
12889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12890         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
12891         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12892         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_err(owner_conv);
12893         int64_t ret_ref = tag_ptr(ret_copy, true);
12894         return ret_ref;
12895 }
12896
12897 static jclass LDKCOption_HTLCClaimZ_Some_class = NULL;
12898 static jmethodID LDKCOption_HTLCClaimZ_Some_meth = NULL;
12899 static jclass LDKCOption_HTLCClaimZ_None_class = NULL;
12900 static jmethodID LDKCOption_HTLCClaimZ_None_meth = NULL;
12901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1HTLCClaimZ_init (JNIEnv *env, jclass clz) {
12902         LDKCOption_HTLCClaimZ_Some_class =
12903                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCClaimZ$Some"));
12904         CHECK(LDKCOption_HTLCClaimZ_Some_class != NULL);
12905         LDKCOption_HTLCClaimZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_HTLCClaimZ_Some_class, "<init>", "(Lorg/ldk/enums/HTLCClaim;)V");
12906         CHECK(LDKCOption_HTLCClaimZ_Some_meth != NULL);
12907         LDKCOption_HTLCClaimZ_None_class =
12908                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCClaimZ$None"));
12909         CHECK(LDKCOption_HTLCClaimZ_None_class != NULL);
12910         LDKCOption_HTLCClaimZ_None_meth = (*env)->GetMethodID(env, LDKCOption_HTLCClaimZ_None_class, "<init>", "()V");
12911         CHECK(LDKCOption_HTLCClaimZ_None_meth != NULL);
12912 }
12913 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1HTLCClaimZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12914         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
12915         switch(obj->tag) {
12916                 case LDKCOption_HTLCClaimZ_Some: {
12917                         jclass some_conv = LDKHTLCClaim_to_java(env, obj->some);
12918                         return (*env)->NewObject(env, LDKCOption_HTLCClaimZ_Some_class, LDKCOption_HTLCClaimZ_Some_meth, some_conv);
12919                 }
12920                 case LDKCOption_HTLCClaimZ_None: {
12921                         return (*env)->NewObject(env, LDKCOption_HTLCClaimZ_None_class, LDKCOption_HTLCClaimZ_None_meth);
12922                 }
12923                 default: abort();
12924         }
12925 }
12926 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
12927         LDKCounterpartyCommitmentSecrets ret = *owner->contents.result;
12928         ret.is_owned = false;
12929         return ret;
12930 }
12931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12932         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
12933         LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
12934         int64_t ret_ref = 0;
12935         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12936         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12937         return ret_ref;
12938 }
12939
12940 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
12941 CHECK(!owner->result_ok);
12942         return DecodeError_clone(&*owner->contents.err);
12943 }
12944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12945         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
12946         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12947         *ret_copy = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
12948         int64_t ret_ref = tag_ptr(ret_copy, true);
12949         return ret_ref;
12950 }
12951
12952 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
12953         LDKTxCreationKeys ret = *owner->contents.result;
12954         ret.is_owned = false;
12955         return ret;
12956 }
12957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12958         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
12959         LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
12960         int64_t ret_ref = 0;
12961         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12962         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12963         return ret_ref;
12964 }
12965
12966 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
12967 CHECK(!owner->result_ok);
12968         return DecodeError_clone(&*owner->contents.err);
12969 }
12970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12971         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
12972         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12973         *ret_copy = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
12974         int64_t ret_ref = tag_ptr(ret_copy, true);
12975         return ret_ref;
12976 }
12977
12978 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
12979         LDKChannelPublicKeys ret = *owner->contents.result;
12980         ret.is_owned = false;
12981         return ret;
12982 }
12983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12984         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
12985         LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
12986         int64_t ret_ref = 0;
12987         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12988         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12989         return ret_ref;
12990 }
12991
12992 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
12993 CHECK(!owner->result_ok);
12994         return DecodeError_clone(&*owner->contents.err);
12995 }
12996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12997         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
12998         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12999         *ret_copy = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
13000         int64_t ret_ref = tag_ptr(ret_copy, true);
13001         return ret_ref;
13002 }
13003
13004 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
13005         LDKHTLCOutputInCommitment ret = *owner->contents.result;
13006         ret.is_owned = false;
13007         return ret;
13008 }
13009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13010         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
13011         LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
13012         int64_t ret_ref = 0;
13013         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13014         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13015         return ret_ref;
13016 }
13017
13018 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
13019 CHECK(!owner->result_ok);
13020         return DecodeError_clone(&*owner->contents.err);
13021 }
13022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13023         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
13024         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13025         *ret_copy = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
13026         int64_t ret_ref = tag_ptr(ret_copy, true);
13027         return ret_ref;
13028 }
13029
13030 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
13031         LDKCounterpartyChannelTransactionParameters ret = *owner->contents.result;
13032         ret.is_owned = false;
13033         return ret;
13034 }
13035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13036         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
13037         LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
13038         int64_t ret_ref = 0;
13039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13041         return ret_ref;
13042 }
13043
13044 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
13045 CHECK(!owner->result_ok);
13046         return DecodeError_clone(&*owner->contents.err);
13047 }
13048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13049         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
13050         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13051         *ret_copy = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
13052         int64_t ret_ref = tag_ptr(ret_copy, true);
13053         return ret_ref;
13054 }
13055
13056 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
13057         LDKChannelTransactionParameters ret = *owner->contents.result;
13058         ret.is_owned = false;
13059         return ret;
13060 }
13061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13062         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
13063         LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
13064         int64_t ret_ref = 0;
13065         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13066         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13067         return ret_ref;
13068 }
13069
13070 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
13071 CHECK(!owner->result_ok);
13072         return DecodeError_clone(&*owner->contents.err);
13073 }
13074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13075         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
13076         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13077         *ret_copy = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
13078         int64_t ret_ref = tag_ptr(ret_copy, true);
13079         return ret_ref;
13080 }
13081
13082 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
13083         LDKHolderCommitmentTransaction ret = *owner->contents.result;
13084         ret.is_owned = false;
13085         return ret;
13086 }
13087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13088         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
13089         LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
13090         int64_t ret_ref = 0;
13091         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13092         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13093         return ret_ref;
13094 }
13095
13096 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
13097 CHECK(!owner->result_ok);
13098         return DecodeError_clone(&*owner->contents.err);
13099 }
13100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13101         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
13102         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13103         *ret_copy = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
13104         int64_t ret_ref = tag_ptr(ret_copy, true);
13105         return ret_ref;
13106 }
13107
13108 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
13109         LDKBuiltCommitmentTransaction ret = *owner->contents.result;
13110         ret.is_owned = false;
13111         return ret;
13112 }
13113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13114         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
13115         LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
13116         int64_t ret_ref = 0;
13117         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13118         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13119         return ret_ref;
13120 }
13121
13122 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
13123 CHECK(!owner->result_ok);
13124         return DecodeError_clone(&*owner->contents.err);
13125 }
13126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13127         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
13128         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13129         *ret_copy = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
13130         int64_t ret_ref = tag_ptr(ret_copy, true);
13131         return ret_ref;
13132 }
13133
13134 static inline struct LDKTrustedClosingTransaction CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
13135         LDKTrustedClosingTransaction ret = *owner->contents.result;
13136         ret.is_owned = false;
13137         return ret;
13138 }
13139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13140         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
13141         LDKTrustedClosingTransaction ret_var = CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
13142         int64_t ret_ref = 0;
13143         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13144         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13145         return ret_ref;
13146 }
13147
13148 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
13149 CHECK(!owner->result_ok);
13150         return *owner->contents.err;
13151 }
13152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13153         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
13154         CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
13155 }
13156
13157 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
13158         LDKCommitmentTransaction ret = *owner->contents.result;
13159         ret.is_owned = false;
13160         return ret;
13161 }
13162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13163         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
13164         LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
13165         int64_t ret_ref = 0;
13166         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13167         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13168         return ret_ref;
13169 }
13170
13171 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
13172 CHECK(!owner->result_ok);
13173         return DecodeError_clone(&*owner->contents.err);
13174 }
13175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13176         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
13177         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13178         *ret_copy = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
13179         int64_t ret_ref = tag_ptr(ret_copy, true);
13180         return ret_ref;
13181 }
13182
13183 static inline struct LDKTrustedCommitmentTransaction CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
13184         LDKTrustedCommitmentTransaction ret = *owner->contents.result;
13185         ret.is_owned = false;
13186         return ret;
13187 }
13188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13189         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
13190         LDKTrustedCommitmentTransaction ret_var = CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
13191         int64_t ret_ref = 0;
13192         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13193         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13194         return ret_ref;
13195 }
13196
13197 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
13198 CHECK(!owner->result_ok);
13199         return *owner->contents.err;
13200 }
13201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13202         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
13203         CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
13204 }
13205
13206 static inline struct LDKCVec_ECDSASignatureZ CResult_CVec_ECDSASignatureZNoneZ_get_ok(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR owner){
13207 CHECK(owner->result_ok);
13208         return *owner->contents.result;
13209 }
13210 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13211         LDKCResult_CVec_ECDSASignatureZNoneZ* owner_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(owner);
13212         LDKCVec_ECDSASignatureZ ret_var = CResult_CVec_ECDSASignatureZNoneZ_get_ok(owner_conv);
13213         jobjectArray ret_arr = NULL;
13214         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
13215         ;
13216         for (size_t i = 0; i < ret_var.datalen; i++) {
13217                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
13218                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
13219                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
13220         }
13221         
13222         return ret_arr;
13223 }
13224
13225 static inline void CResult_CVec_ECDSASignatureZNoneZ_get_err(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR owner){
13226 CHECK(!owner->result_ok);
13227         return *owner->contents.err;
13228 }
13229 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13230         LDKCResult_CVec_ECDSASignatureZNoneZ* owner_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(owner);
13231         CResult_CVec_ECDSASignatureZNoneZ_get_err(owner_conv);
13232 }
13233
13234 static jclass LDKCOption_usizeZ_Some_class = NULL;
13235 static jmethodID LDKCOption_usizeZ_Some_meth = NULL;
13236 static jclass LDKCOption_usizeZ_None_class = NULL;
13237 static jmethodID LDKCOption_usizeZ_None_meth = NULL;
13238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1usizeZ_init (JNIEnv *env, jclass clz) {
13239         LDKCOption_usizeZ_Some_class =
13240                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_usizeZ$Some"));
13241         CHECK(LDKCOption_usizeZ_Some_class != NULL);
13242         LDKCOption_usizeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_usizeZ_Some_class, "<init>", "(J)V");
13243         CHECK(LDKCOption_usizeZ_Some_meth != NULL);
13244         LDKCOption_usizeZ_None_class =
13245                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_usizeZ$None"));
13246         CHECK(LDKCOption_usizeZ_None_class != NULL);
13247         LDKCOption_usizeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_usizeZ_None_class, "<init>", "()V");
13248         CHECK(LDKCOption_usizeZ_None_meth != NULL);
13249 }
13250 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1usizeZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13251         LDKCOption_usizeZ *obj = (LDKCOption_usizeZ*)untag_ptr(ptr);
13252         switch(obj->tag) {
13253                 case LDKCOption_usizeZ_Some: {
13254                         int64_t some_conv = obj->some;
13255                         return (*env)->NewObject(env, LDKCOption_usizeZ_Some_class, LDKCOption_usizeZ_Some_meth, some_conv);
13256                 }
13257                 case LDKCOption_usizeZ_None: {
13258                         return (*env)->NewObject(env, LDKCOption_usizeZ_None_class, LDKCOption_usizeZ_None_meth);
13259                 }
13260                 default: abort();
13261         }
13262 }
13263 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
13264         LDKShutdownScript ret = *owner->contents.result;
13265         ret.is_owned = false;
13266         return ret;
13267 }
13268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13269         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
13270         LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
13271         int64_t ret_ref = 0;
13272         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13273         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13274         return ret_ref;
13275 }
13276
13277 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
13278 CHECK(!owner->result_ok);
13279         return DecodeError_clone(&*owner->contents.err);
13280 }
13281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13282         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
13283         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13284         *ret_copy = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
13285         int64_t ret_ref = tag_ptr(ret_copy, true);
13286         return ret_ref;
13287 }
13288
13289 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
13290         LDKShutdownScript ret = *owner->contents.result;
13291         ret.is_owned = false;
13292         return ret;
13293 }
13294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13295         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
13296         LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
13297         int64_t ret_ref = 0;
13298         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13299         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13300         return ret_ref;
13301 }
13302
13303 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
13304         LDKInvalidShutdownScript ret = *owner->contents.err;
13305         ret.is_owned = false;
13306         return ret;
13307 }
13308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13309         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
13310         LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
13311         int64_t ret_ref = 0;
13312         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13313         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13314         return ret_ref;
13315 }
13316
13317 static jclass LDKPaymentPurpose_InvoicePayment_class = NULL;
13318 static jmethodID LDKPaymentPurpose_InvoicePayment_meth = NULL;
13319 static jclass LDKPaymentPurpose_SpontaneousPayment_class = NULL;
13320 static jmethodID LDKPaymentPurpose_SpontaneousPayment_meth = NULL;
13321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentPurpose_init (JNIEnv *env, jclass clz) {
13322         LDKPaymentPurpose_InvoicePayment_class =
13323                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$InvoicePayment"));
13324         CHECK(LDKPaymentPurpose_InvoicePayment_class != NULL);
13325         LDKPaymentPurpose_InvoicePayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_InvoicePayment_class, "<init>", "(J[B)V");
13326         CHECK(LDKPaymentPurpose_InvoicePayment_meth != NULL);
13327         LDKPaymentPurpose_SpontaneousPayment_class =
13328                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$SpontaneousPayment"));
13329         CHECK(LDKPaymentPurpose_SpontaneousPayment_class != NULL);
13330         LDKPaymentPurpose_SpontaneousPayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_SpontaneousPayment_class, "<init>", "([B)V");
13331         CHECK(LDKPaymentPurpose_SpontaneousPayment_meth != NULL);
13332 }
13333 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentPurpose_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13334         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
13335         switch(obj->tag) {
13336                 case LDKPaymentPurpose_InvoicePayment: {
13337                         int64_t payment_preimage_ref = tag_ptr(&obj->invoice_payment.payment_preimage, false);
13338                         int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
13339                         (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->invoice_payment.payment_secret.data);
13340                         return (*env)->NewObject(env, LDKPaymentPurpose_InvoicePayment_class, LDKPaymentPurpose_InvoicePayment_meth, payment_preimage_ref, payment_secret_arr);
13341                 }
13342                 case LDKPaymentPurpose_SpontaneousPayment: {
13343                         int8_tArray spontaneous_payment_arr = (*env)->NewByteArray(env, 32);
13344                         (*env)->SetByteArrayRegion(env, spontaneous_payment_arr, 0, 32, obj->spontaneous_payment.data);
13345                         return (*env)->NewObject(env, LDKPaymentPurpose_SpontaneousPayment_class, LDKPaymentPurpose_SpontaneousPayment_meth, spontaneous_payment_arr);
13346                 }
13347                 default: abort();
13348         }
13349 }
13350 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
13351 CHECK(owner->result_ok);
13352         return PaymentPurpose_clone(&*owner->contents.result);
13353 }
13354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13355         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
13356         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
13357         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
13358         int64_t ret_ref = tag_ptr(ret_copy, true);
13359         return ret_ref;
13360 }
13361
13362 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *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_1PaymentPurposeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13367         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
13368         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13369         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
13370         int64_t ret_ref = tag_ptr(ret_copy, true);
13371         return ret_ref;
13372 }
13373
13374 static inline struct LDKClaimedHTLC CResult_ClaimedHTLCDecodeErrorZ_get_ok(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR owner){
13375         LDKClaimedHTLC ret = *owner->contents.result;
13376         ret.is_owned = false;
13377         return ret;
13378 }
13379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13380         LDKCResult_ClaimedHTLCDecodeErrorZ* owner_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(owner);
13381         LDKClaimedHTLC ret_var = CResult_ClaimedHTLCDecodeErrorZ_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_ClaimedHTLCDecodeErrorZ_get_err(LDKCResult_ClaimedHTLCDecodeErrorZ *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_1ClaimedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13393         LDKCResult_ClaimedHTLCDecodeErrorZ* owner_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(owner);
13394         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13395         *ret_copy = CResult_ClaimedHTLCDecodeErrorZ_get_err(owner_conv);
13396         int64_t ret_ref = tag_ptr(ret_copy, true);
13397         return ret_ref;
13398 }
13399
13400 static jclass LDKPathFailure_InitialSend_class = NULL;
13401 static jmethodID LDKPathFailure_InitialSend_meth = NULL;
13402 static jclass LDKPathFailure_OnPath_class = NULL;
13403 static jmethodID LDKPathFailure_OnPath_meth = NULL;
13404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPathFailure_init (JNIEnv *env, jclass clz) {
13405         LDKPathFailure_InitialSend_class =
13406                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPathFailure$InitialSend"));
13407         CHECK(LDKPathFailure_InitialSend_class != NULL);
13408         LDKPathFailure_InitialSend_meth = (*env)->GetMethodID(env, LDKPathFailure_InitialSend_class, "<init>", "(J)V");
13409         CHECK(LDKPathFailure_InitialSend_meth != NULL);
13410         LDKPathFailure_OnPath_class =
13411                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPathFailure$OnPath"));
13412         CHECK(LDKPathFailure_OnPath_class != NULL);
13413         LDKPathFailure_OnPath_meth = (*env)->GetMethodID(env, LDKPathFailure_OnPath_class, "<init>", "(J)V");
13414         CHECK(LDKPathFailure_OnPath_meth != NULL);
13415 }
13416 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPathFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13417         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
13418         switch(obj->tag) {
13419                 case LDKPathFailure_InitialSend: {
13420                         int64_t err_ref = tag_ptr(&obj->initial_send.err, false);
13421                         return (*env)->NewObject(env, LDKPathFailure_InitialSend_class, LDKPathFailure_InitialSend_meth, err_ref);
13422                 }
13423                 case LDKPathFailure_OnPath: {
13424                         int64_t network_update_ref = tag_ptr(&obj->on_path.network_update, false);
13425                         return (*env)->NewObject(env, LDKPathFailure_OnPath_class, LDKPathFailure_OnPath_meth, network_update_ref);
13426                 }
13427                 default: abort();
13428         }
13429 }
13430 static jclass LDKCOption_PathFailureZ_Some_class = NULL;
13431 static jmethodID LDKCOption_PathFailureZ_Some_meth = NULL;
13432 static jclass LDKCOption_PathFailureZ_None_class = NULL;
13433 static jmethodID LDKCOption_PathFailureZ_None_meth = NULL;
13434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1PathFailureZ_init (JNIEnv *env, jclass clz) {
13435         LDKCOption_PathFailureZ_Some_class =
13436                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PathFailureZ$Some"));
13437         CHECK(LDKCOption_PathFailureZ_Some_class != NULL);
13438         LDKCOption_PathFailureZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_PathFailureZ_Some_class, "<init>", "(J)V");
13439         CHECK(LDKCOption_PathFailureZ_Some_meth != NULL);
13440         LDKCOption_PathFailureZ_None_class =
13441                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PathFailureZ$None"));
13442         CHECK(LDKCOption_PathFailureZ_None_class != NULL);
13443         LDKCOption_PathFailureZ_None_meth = (*env)->GetMethodID(env, LDKCOption_PathFailureZ_None_class, "<init>", "()V");
13444         CHECK(LDKCOption_PathFailureZ_None_meth != NULL);
13445 }
13446 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1PathFailureZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13447         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
13448         switch(obj->tag) {
13449                 case LDKCOption_PathFailureZ_Some: {
13450                         int64_t some_ref = tag_ptr(&obj->some, false);
13451                         return (*env)->NewObject(env, LDKCOption_PathFailureZ_Some_class, LDKCOption_PathFailureZ_Some_meth, some_ref);
13452                 }
13453                 case LDKCOption_PathFailureZ_None: {
13454                         return (*env)->NewObject(env, LDKCOption_PathFailureZ_None_class, LDKCOption_PathFailureZ_None_meth);
13455                 }
13456                 default: abort();
13457         }
13458 }
13459 static inline struct LDKCOption_PathFailureZ CResult_COption_PathFailureZDecodeErrorZ_get_ok(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
13460 CHECK(owner->result_ok);
13461         return COption_PathFailureZ_clone(&*owner->contents.result);
13462 }
13463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13464         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
13465         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
13466         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_ok(owner_conv);
13467         int64_t ret_ref = tag_ptr(ret_copy, true);
13468         return ret_ref;
13469 }
13470
13471 static inline struct LDKDecodeError CResult_COption_PathFailureZDecodeErrorZ_get_err(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
13472 CHECK(!owner->result_ok);
13473         return DecodeError_clone(&*owner->contents.err);
13474 }
13475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13476         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
13477         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13478         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_err(owner_conv);
13479         int64_t ret_ref = tag_ptr(ret_copy, true);
13480         return ret_ref;
13481 }
13482
13483 static jclass LDKClosureReason_CounterpartyForceClosed_class = NULL;
13484 static jmethodID LDKClosureReason_CounterpartyForceClosed_meth = NULL;
13485 static jclass LDKClosureReason_HolderForceClosed_class = NULL;
13486 static jmethodID LDKClosureReason_HolderForceClosed_meth = NULL;
13487 static jclass LDKClosureReason_CooperativeClosure_class = NULL;
13488 static jmethodID LDKClosureReason_CooperativeClosure_meth = NULL;
13489 static jclass LDKClosureReason_CommitmentTxConfirmed_class = NULL;
13490 static jmethodID LDKClosureReason_CommitmentTxConfirmed_meth = NULL;
13491 static jclass LDKClosureReason_FundingTimedOut_class = NULL;
13492 static jmethodID LDKClosureReason_FundingTimedOut_meth = NULL;
13493 static jclass LDKClosureReason_ProcessingError_class = NULL;
13494 static jmethodID LDKClosureReason_ProcessingError_meth = NULL;
13495 static jclass LDKClosureReason_DisconnectedPeer_class = NULL;
13496 static jmethodID LDKClosureReason_DisconnectedPeer_meth = NULL;
13497 static jclass LDKClosureReason_OutdatedChannelManager_class = NULL;
13498 static jmethodID LDKClosureReason_OutdatedChannelManager_meth = NULL;
13499 static jclass LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class = NULL;
13500 static jmethodID LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_meth = NULL;
13501 static jclass LDKClosureReason_FundingBatchClosure_class = NULL;
13502 static jmethodID LDKClosureReason_FundingBatchClosure_meth = NULL;
13503 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKClosureReason_init (JNIEnv *env, jclass clz) {
13504         LDKClosureReason_CounterpartyForceClosed_class =
13505                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CounterpartyForceClosed"));
13506         CHECK(LDKClosureReason_CounterpartyForceClosed_class != NULL);
13507         LDKClosureReason_CounterpartyForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyForceClosed_class, "<init>", "(J)V");
13508         CHECK(LDKClosureReason_CounterpartyForceClosed_meth != NULL);
13509         LDKClosureReason_HolderForceClosed_class =
13510                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$HolderForceClosed"));
13511         CHECK(LDKClosureReason_HolderForceClosed_class != NULL);
13512         LDKClosureReason_HolderForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_HolderForceClosed_class, "<init>", "()V");
13513         CHECK(LDKClosureReason_HolderForceClosed_meth != NULL);
13514         LDKClosureReason_CooperativeClosure_class =
13515                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CooperativeClosure"));
13516         CHECK(LDKClosureReason_CooperativeClosure_class != NULL);
13517         LDKClosureReason_CooperativeClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_CooperativeClosure_class, "<init>", "()V");
13518         CHECK(LDKClosureReason_CooperativeClosure_meth != NULL);
13519         LDKClosureReason_CommitmentTxConfirmed_class =
13520                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CommitmentTxConfirmed"));
13521         CHECK(LDKClosureReason_CommitmentTxConfirmed_class != NULL);
13522         LDKClosureReason_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKClosureReason_CommitmentTxConfirmed_class, "<init>", "()V");
13523         CHECK(LDKClosureReason_CommitmentTxConfirmed_meth != NULL);
13524         LDKClosureReason_FundingTimedOut_class =
13525                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$FundingTimedOut"));
13526         CHECK(LDKClosureReason_FundingTimedOut_class != NULL);
13527         LDKClosureReason_FundingTimedOut_meth = (*env)->GetMethodID(env, LDKClosureReason_FundingTimedOut_class, "<init>", "()V");
13528         CHECK(LDKClosureReason_FundingTimedOut_meth != NULL);
13529         LDKClosureReason_ProcessingError_class =
13530                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$ProcessingError"));
13531         CHECK(LDKClosureReason_ProcessingError_class != NULL);
13532         LDKClosureReason_ProcessingError_meth = (*env)->GetMethodID(env, LDKClosureReason_ProcessingError_class, "<init>", "(Ljava/lang/String;)V");
13533         CHECK(LDKClosureReason_ProcessingError_meth != NULL);
13534         LDKClosureReason_DisconnectedPeer_class =
13535                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$DisconnectedPeer"));
13536         CHECK(LDKClosureReason_DisconnectedPeer_class != NULL);
13537         LDKClosureReason_DisconnectedPeer_meth = (*env)->GetMethodID(env, LDKClosureReason_DisconnectedPeer_class, "<init>", "()V");
13538         CHECK(LDKClosureReason_DisconnectedPeer_meth != NULL);
13539         LDKClosureReason_OutdatedChannelManager_class =
13540                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$OutdatedChannelManager"));
13541         CHECK(LDKClosureReason_OutdatedChannelManager_class != NULL);
13542         LDKClosureReason_OutdatedChannelManager_meth = (*env)->GetMethodID(env, LDKClosureReason_OutdatedChannelManager_class, "<init>", "()V");
13543         CHECK(LDKClosureReason_OutdatedChannelManager_meth != NULL);
13544         LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class =
13545                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CounterpartyCoopClosedUnfundedChannel"));
13546         CHECK(LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class != NULL);
13547         LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class, "<init>", "()V");
13548         CHECK(LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_meth != NULL);
13549         LDKClosureReason_FundingBatchClosure_class =
13550                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$FundingBatchClosure"));
13551         CHECK(LDKClosureReason_FundingBatchClosure_class != NULL);
13552         LDKClosureReason_FundingBatchClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_FundingBatchClosure_class, "<init>", "()V");
13553         CHECK(LDKClosureReason_FundingBatchClosure_meth != NULL);
13554 }
13555 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKClosureReason_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13556         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
13557         switch(obj->tag) {
13558                 case LDKClosureReason_CounterpartyForceClosed: {
13559                         LDKUntrustedString peer_msg_var = obj->counterparty_force_closed.peer_msg;
13560                         int64_t peer_msg_ref = 0;
13561                         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_var);
13562                         peer_msg_ref = tag_ptr(peer_msg_var.inner, false);
13563                         return (*env)->NewObject(env, LDKClosureReason_CounterpartyForceClosed_class, LDKClosureReason_CounterpartyForceClosed_meth, peer_msg_ref);
13564                 }
13565                 case LDKClosureReason_HolderForceClosed: {
13566                         return (*env)->NewObject(env, LDKClosureReason_HolderForceClosed_class, LDKClosureReason_HolderForceClosed_meth);
13567                 }
13568                 case LDKClosureReason_CooperativeClosure: {
13569                         return (*env)->NewObject(env, LDKClosureReason_CooperativeClosure_class, LDKClosureReason_CooperativeClosure_meth);
13570                 }
13571                 case LDKClosureReason_CommitmentTxConfirmed: {
13572                         return (*env)->NewObject(env, LDKClosureReason_CommitmentTxConfirmed_class, LDKClosureReason_CommitmentTxConfirmed_meth);
13573                 }
13574                 case LDKClosureReason_FundingTimedOut: {
13575                         return (*env)->NewObject(env, LDKClosureReason_FundingTimedOut_class, LDKClosureReason_FundingTimedOut_meth);
13576                 }
13577                 case LDKClosureReason_ProcessingError: {
13578                         LDKStr err_str = obj->processing_error.err;
13579                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
13580                         return (*env)->NewObject(env, LDKClosureReason_ProcessingError_class, LDKClosureReason_ProcessingError_meth, err_conv);
13581                 }
13582                 case LDKClosureReason_DisconnectedPeer: {
13583                         return (*env)->NewObject(env, LDKClosureReason_DisconnectedPeer_class, LDKClosureReason_DisconnectedPeer_meth);
13584                 }
13585                 case LDKClosureReason_OutdatedChannelManager: {
13586                         return (*env)->NewObject(env, LDKClosureReason_OutdatedChannelManager_class, LDKClosureReason_OutdatedChannelManager_meth);
13587                 }
13588                 case LDKClosureReason_CounterpartyCoopClosedUnfundedChannel: {
13589                         return (*env)->NewObject(env, LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class, LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_meth);
13590                 }
13591                 case LDKClosureReason_FundingBatchClosure: {
13592                         return (*env)->NewObject(env, LDKClosureReason_FundingBatchClosure_class, LDKClosureReason_FundingBatchClosure_meth);
13593                 }
13594                 default: abort();
13595         }
13596 }
13597 static jclass LDKCOption_ClosureReasonZ_Some_class = NULL;
13598 static jmethodID LDKCOption_ClosureReasonZ_Some_meth = NULL;
13599 static jclass LDKCOption_ClosureReasonZ_None_class = NULL;
13600 static jmethodID LDKCOption_ClosureReasonZ_None_meth = NULL;
13601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ClosureReasonZ_init (JNIEnv *env, jclass clz) {
13602         LDKCOption_ClosureReasonZ_Some_class =
13603                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$Some"));
13604         CHECK(LDKCOption_ClosureReasonZ_Some_class != NULL);
13605         LDKCOption_ClosureReasonZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_Some_class, "<init>", "(J)V");
13606         CHECK(LDKCOption_ClosureReasonZ_Some_meth != NULL);
13607         LDKCOption_ClosureReasonZ_None_class =
13608                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$None"));
13609         CHECK(LDKCOption_ClosureReasonZ_None_class != NULL);
13610         LDKCOption_ClosureReasonZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_None_class, "<init>", "()V");
13611         CHECK(LDKCOption_ClosureReasonZ_None_meth != NULL);
13612 }
13613 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ClosureReasonZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13614         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
13615         switch(obj->tag) {
13616                 case LDKCOption_ClosureReasonZ_Some: {
13617                         int64_t some_ref = tag_ptr(&obj->some, false);
13618                         return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_Some_class, LDKCOption_ClosureReasonZ_Some_meth, some_ref);
13619                 }
13620                 case LDKCOption_ClosureReasonZ_None: {
13621                         return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_None_class, LDKCOption_ClosureReasonZ_None_meth);
13622                 }
13623                 default: abort();
13624         }
13625 }
13626 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
13627 CHECK(owner->result_ok);
13628         return COption_ClosureReasonZ_clone(&*owner->contents.result);
13629 }
13630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13631         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
13632         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
13633         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
13634         int64_t ret_ref = tag_ptr(ret_copy, true);
13635         return ret_ref;
13636 }
13637
13638 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
13639 CHECK(!owner->result_ok);
13640         return DecodeError_clone(&*owner->contents.err);
13641 }
13642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13643         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
13644         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13645         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
13646         int64_t ret_ref = tag_ptr(ret_copy, true);
13647         return ret_ref;
13648 }
13649
13650 static jclass LDKHTLCDestination_NextHopChannel_class = NULL;
13651 static jmethodID LDKHTLCDestination_NextHopChannel_meth = NULL;
13652 static jclass LDKHTLCDestination_UnknownNextHop_class = NULL;
13653 static jmethodID LDKHTLCDestination_UnknownNextHop_meth = NULL;
13654 static jclass LDKHTLCDestination_InvalidForward_class = NULL;
13655 static jmethodID LDKHTLCDestination_InvalidForward_meth = NULL;
13656 static jclass LDKHTLCDestination_FailedPayment_class = NULL;
13657 static jmethodID LDKHTLCDestination_FailedPayment_meth = NULL;
13658 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCDestination_init (JNIEnv *env, jclass clz) {
13659         LDKHTLCDestination_NextHopChannel_class =
13660                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$NextHopChannel"));
13661         CHECK(LDKHTLCDestination_NextHopChannel_class != NULL);
13662         LDKHTLCDestination_NextHopChannel_meth = (*env)->GetMethodID(env, LDKHTLCDestination_NextHopChannel_class, "<init>", "([B[B)V");
13663         CHECK(LDKHTLCDestination_NextHopChannel_meth != NULL);
13664         LDKHTLCDestination_UnknownNextHop_class =
13665                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$UnknownNextHop"));
13666         CHECK(LDKHTLCDestination_UnknownNextHop_class != NULL);
13667         LDKHTLCDestination_UnknownNextHop_meth = (*env)->GetMethodID(env, LDKHTLCDestination_UnknownNextHop_class, "<init>", "(J)V");
13668         CHECK(LDKHTLCDestination_UnknownNextHop_meth != NULL);
13669         LDKHTLCDestination_InvalidForward_class =
13670                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$InvalidForward"));
13671         CHECK(LDKHTLCDestination_InvalidForward_class != NULL);
13672         LDKHTLCDestination_InvalidForward_meth = (*env)->GetMethodID(env, LDKHTLCDestination_InvalidForward_class, "<init>", "(J)V");
13673         CHECK(LDKHTLCDestination_InvalidForward_meth != NULL);
13674         LDKHTLCDestination_FailedPayment_class =
13675                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$FailedPayment"));
13676         CHECK(LDKHTLCDestination_FailedPayment_class != NULL);
13677         LDKHTLCDestination_FailedPayment_meth = (*env)->GetMethodID(env, LDKHTLCDestination_FailedPayment_class, "<init>", "([B)V");
13678         CHECK(LDKHTLCDestination_FailedPayment_meth != NULL);
13679 }
13680 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCDestination_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13681         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
13682         switch(obj->tag) {
13683                 case LDKHTLCDestination_NextHopChannel: {
13684                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
13685                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->next_hop_channel.node_id.compressed_form);
13686                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
13687                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->next_hop_channel.channel_id.data);
13688                         return (*env)->NewObject(env, LDKHTLCDestination_NextHopChannel_class, LDKHTLCDestination_NextHopChannel_meth, node_id_arr, channel_id_arr);
13689                 }
13690                 case LDKHTLCDestination_UnknownNextHop: {
13691                         int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
13692                         return (*env)->NewObject(env, LDKHTLCDestination_UnknownNextHop_class, LDKHTLCDestination_UnknownNextHop_meth, requested_forward_scid_conv);
13693                 }
13694                 case LDKHTLCDestination_InvalidForward: {
13695                         int64_t requested_forward_scid_conv = obj->invalid_forward.requested_forward_scid;
13696                         return (*env)->NewObject(env, LDKHTLCDestination_InvalidForward_class, LDKHTLCDestination_InvalidForward_meth, requested_forward_scid_conv);
13697                 }
13698                 case LDKHTLCDestination_FailedPayment: {
13699                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
13700                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->failed_payment.payment_hash.data);
13701                         return (*env)->NewObject(env, LDKHTLCDestination_FailedPayment_class, LDKHTLCDestination_FailedPayment_meth, payment_hash_arr);
13702                 }
13703                 default: abort();
13704         }
13705 }
13706 static jclass LDKCOption_HTLCDestinationZ_Some_class = NULL;
13707 static jmethodID LDKCOption_HTLCDestinationZ_Some_meth = NULL;
13708 static jclass LDKCOption_HTLCDestinationZ_None_class = NULL;
13709 static jmethodID LDKCOption_HTLCDestinationZ_None_meth = NULL;
13710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1HTLCDestinationZ_init (JNIEnv *env, jclass clz) {
13711         LDKCOption_HTLCDestinationZ_Some_class =
13712                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCDestinationZ$Some"));
13713         CHECK(LDKCOption_HTLCDestinationZ_Some_class != NULL);
13714         LDKCOption_HTLCDestinationZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_HTLCDestinationZ_Some_class, "<init>", "(J)V");
13715         CHECK(LDKCOption_HTLCDestinationZ_Some_meth != NULL);
13716         LDKCOption_HTLCDestinationZ_None_class =
13717                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCDestinationZ$None"));
13718         CHECK(LDKCOption_HTLCDestinationZ_None_class != NULL);
13719         LDKCOption_HTLCDestinationZ_None_meth = (*env)->GetMethodID(env, LDKCOption_HTLCDestinationZ_None_class, "<init>", "()V");
13720         CHECK(LDKCOption_HTLCDestinationZ_None_meth != NULL);
13721 }
13722 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1HTLCDestinationZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13723         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
13724         switch(obj->tag) {
13725                 case LDKCOption_HTLCDestinationZ_Some: {
13726                         int64_t some_ref = tag_ptr(&obj->some, false);
13727                         return (*env)->NewObject(env, LDKCOption_HTLCDestinationZ_Some_class, LDKCOption_HTLCDestinationZ_Some_meth, some_ref);
13728                 }
13729                 case LDKCOption_HTLCDestinationZ_None: {
13730                         return (*env)->NewObject(env, LDKCOption_HTLCDestinationZ_None_class, LDKCOption_HTLCDestinationZ_None_meth);
13731                 }
13732                 default: abort();
13733         }
13734 }
13735 static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
13736 CHECK(owner->result_ok);
13737         return COption_HTLCDestinationZ_clone(&*owner->contents.result);
13738 }
13739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13740         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
13741         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
13742         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv);
13743         int64_t ret_ref = tag_ptr(ret_copy, true);
13744         return ret_ref;
13745 }
13746
13747 static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
13748 CHECK(!owner->result_ok);
13749         return DecodeError_clone(&*owner->contents.err);
13750 }
13751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13752         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
13753         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13754         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
13755         int64_t ret_ref = tag_ptr(ret_copy, true);
13756         return ret_ref;
13757 }
13758
13759 static inline enum LDKPaymentFailureReason CResult_PaymentFailureReasonDecodeErrorZ_get_ok(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
13760 CHECK(owner->result_ok);
13761         return PaymentFailureReason_clone(&*owner->contents.result);
13762 }
13763 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13764         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
13765         jclass ret_conv = LDKPaymentFailureReason_to_java(env, CResult_PaymentFailureReasonDecodeErrorZ_get_ok(owner_conv));
13766         return ret_conv;
13767 }
13768
13769 static inline struct LDKDecodeError CResult_PaymentFailureReasonDecodeErrorZ_get_err(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
13770 CHECK(!owner->result_ok);
13771         return DecodeError_clone(&*owner->contents.err);
13772 }
13773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13774         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
13775         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13776         *ret_copy = CResult_PaymentFailureReasonDecodeErrorZ_get_err(owner_conv);
13777         int64_t ret_ref = tag_ptr(ret_copy, true);
13778         return ret_ref;
13779 }
13780
13781 static jclass LDKCOption_U128Z_Some_class = NULL;
13782 static jmethodID LDKCOption_U128Z_Some_meth = NULL;
13783 static jclass LDKCOption_U128Z_None_class = NULL;
13784 static jmethodID LDKCOption_U128Z_None_meth = NULL;
13785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1U128Z_init (JNIEnv *env, jclass clz) {
13786         LDKCOption_U128Z_Some_class =
13787                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_U128Z$Some"));
13788         CHECK(LDKCOption_U128Z_Some_class != NULL);
13789         LDKCOption_U128Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_U128Z_Some_class, "<init>", "([B)V");
13790         CHECK(LDKCOption_U128Z_Some_meth != NULL);
13791         LDKCOption_U128Z_None_class =
13792                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_U128Z$None"));
13793         CHECK(LDKCOption_U128Z_None_class != NULL);
13794         LDKCOption_U128Z_None_meth = (*env)->GetMethodID(env, LDKCOption_U128Z_None_class, "<init>", "()V");
13795         CHECK(LDKCOption_U128Z_None_meth != NULL);
13796 }
13797 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1U128Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13798         LDKCOption_U128Z *obj = (LDKCOption_U128Z*)untag_ptr(ptr);
13799         switch(obj->tag) {
13800                 case LDKCOption_U128Z_Some: {
13801                         int8_tArray some_arr = (*env)->NewByteArray(env, 16);
13802                         (*env)->SetByteArrayRegion(env, some_arr, 0, 16, obj->some.le_bytes);
13803                         return (*env)->NewObject(env, LDKCOption_U128Z_Some_class, LDKCOption_U128Z_Some_meth, some_arr);
13804                 }
13805                 case LDKCOption_U128Z_None: {
13806                         return (*env)->NewObject(env, LDKCOption_U128Z_None_class, LDKCOption_U128Z_None_meth);
13807                 }
13808                 default: abort();
13809         }
13810 }
13811 static inline LDKCVec_ClaimedHTLCZ CVec_ClaimedHTLCZ_clone(const LDKCVec_ClaimedHTLCZ *orig) {
13812         LDKCVec_ClaimedHTLCZ ret = { .data = MALLOC(sizeof(LDKClaimedHTLC) * orig->datalen, "LDKCVec_ClaimedHTLCZ clone bytes"), .datalen = orig->datalen };
13813         for (size_t i = 0; i < ret.datalen; i++) {
13814                 ret.data[i] = ClaimedHTLC_clone(&orig->data[i]);
13815         }
13816         return ret;
13817 }
13818 static jclass LDKCOption_PaymentFailureReasonZ_Some_class = NULL;
13819 static jmethodID LDKCOption_PaymentFailureReasonZ_Some_meth = NULL;
13820 static jclass LDKCOption_PaymentFailureReasonZ_None_class = NULL;
13821 static jmethodID LDKCOption_PaymentFailureReasonZ_None_meth = NULL;
13822 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1PaymentFailureReasonZ_init (JNIEnv *env, jclass clz) {
13823         LDKCOption_PaymentFailureReasonZ_Some_class =
13824                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PaymentFailureReasonZ$Some"));
13825         CHECK(LDKCOption_PaymentFailureReasonZ_Some_class != NULL);
13826         LDKCOption_PaymentFailureReasonZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_PaymentFailureReasonZ_Some_class, "<init>", "(Lorg/ldk/enums/PaymentFailureReason;)V");
13827         CHECK(LDKCOption_PaymentFailureReasonZ_Some_meth != NULL);
13828         LDKCOption_PaymentFailureReasonZ_None_class =
13829                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PaymentFailureReasonZ$None"));
13830         CHECK(LDKCOption_PaymentFailureReasonZ_None_class != NULL);
13831         LDKCOption_PaymentFailureReasonZ_None_meth = (*env)->GetMethodID(env, LDKCOption_PaymentFailureReasonZ_None_class, "<init>", "()V");
13832         CHECK(LDKCOption_PaymentFailureReasonZ_None_meth != NULL);
13833 }
13834 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1PaymentFailureReasonZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13835         LDKCOption_PaymentFailureReasonZ *obj = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(ptr);
13836         switch(obj->tag) {
13837                 case LDKCOption_PaymentFailureReasonZ_Some: {
13838                         jclass some_conv = LDKPaymentFailureReason_to_java(env, obj->some);
13839                         return (*env)->NewObject(env, LDKCOption_PaymentFailureReasonZ_Some_class, LDKCOption_PaymentFailureReasonZ_Some_meth, some_conv);
13840                 }
13841                 case LDKCOption_PaymentFailureReasonZ_None: {
13842                         return (*env)->NewObject(env, LDKCOption_PaymentFailureReasonZ_None_class, LDKCOption_PaymentFailureReasonZ_None_meth);
13843                 }
13844                 default: abort();
13845         }
13846 }
13847 static jclass LDKBumpTransactionEvent_ChannelClose_class = NULL;
13848 static jmethodID LDKBumpTransactionEvent_ChannelClose_meth = NULL;
13849 static jclass LDKBumpTransactionEvent_HTLCResolution_class = NULL;
13850 static jmethodID LDKBumpTransactionEvent_HTLCResolution_meth = NULL;
13851 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBumpTransactionEvent_init (JNIEnv *env, jclass clz) {
13852         LDKBumpTransactionEvent_ChannelClose_class =
13853                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBumpTransactionEvent$ChannelClose"));
13854         CHECK(LDKBumpTransactionEvent_ChannelClose_class != NULL);
13855         LDKBumpTransactionEvent_ChannelClose_meth = (*env)->GetMethodID(env, LDKBumpTransactionEvent_ChannelClose_class, "<init>", "([BI[BJJ[J)V");
13856         CHECK(LDKBumpTransactionEvent_ChannelClose_meth != NULL);
13857         LDKBumpTransactionEvent_HTLCResolution_class =
13858                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBumpTransactionEvent$HTLCResolution"));
13859         CHECK(LDKBumpTransactionEvent_HTLCResolution_class != NULL);
13860         LDKBumpTransactionEvent_HTLCResolution_meth = (*env)->GetMethodID(env, LDKBumpTransactionEvent_HTLCResolution_class, "<init>", "([BI[JI)V");
13861         CHECK(LDKBumpTransactionEvent_HTLCResolution_meth != NULL);
13862 }
13863 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBumpTransactionEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13864         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
13865         switch(obj->tag) {
13866                 case LDKBumpTransactionEvent_ChannelClose: {
13867                         int8_tArray claim_id_arr = (*env)->NewByteArray(env, 32);
13868                         (*env)->SetByteArrayRegion(env, claim_id_arr, 0, 32, obj->channel_close.claim_id.data);
13869                         int32_t package_target_feerate_sat_per_1000_weight_conv = obj->channel_close.package_target_feerate_sat_per_1000_weight;
13870                         LDKTransaction commitment_tx_var = obj->channel_close.commitment_tx;
13871                         int8_tArray commitment_tx_arr = (*env)->NewByteArray(env, commitment_tx_var.datalen);
13872                         (*env)->SetByteArrayRegion(env, commitment_tx_arr, 0, commitment_tx_var.datalen, commitment_tx_var.data);
13873                         int64_t commitment_tx_fee_satoshis_conv = obj->channel_close.commitment_tx_fee_satoshis;
13874                         LDKAnchorDescriptor anchor_descriptor_var = obj->channel_close.anchor_descriptor;
13875                         int64_t anchor_descriptor_ref = 0;
13876                         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_var);
13877                         anchor_descriptor_ref = tag_ptr(anchor_descriptor_var.inner, false);
13878                         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_var = obj->channel_close.pending_htlcs;
13879                         int64_tArray pending_htlcs_arr = NULL;
13880                         pending_htlcs_arr = (*env)->NewLongArray(env, pending_htlcs_var.datalen);
13881                         int64_t *pending_htlcs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, pending_htlcs_arr, NULL);
13882                         for (size_t y = 0; y < pending_htlcs_var.datalen; y++) {
13883                                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_var = pending_htlcs_var.data[y];
13884                                 int64_t pending_htlcs_conv_24_ref = 0;
13885                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_var);
13886                                 pending_htlcs_conv_24_ref = tag_ptr(pending_htlcs_conv_24_var.inner, false);
13887                                 pending_htlcs_arr_ptr[y] = pending_htlcs_conv_24_ref;
13888                         }
13889                         (*env)->ReleasePrimitiveArrayCritical(env, pending_htlcs_arr, pending_htlcs_arr_ptr, 0);
13890                         return (*env)->NewObject(env, LDKBumpTransactionEvent_ChannelClose_class, LDKBumpTransactionEvent_ChannelClose_meth, claim_id_arr, package_target_feerate_sat_per_1000_weight_conv, commitment_tx_arr, commitment_tx_fee_satoshis_conv, anchor_descriptor_ref, pending_htlcs_arr);
13891                 }
13892                 case LDKBumpTransactionEvent_HTLCResolution: {
13893                         int8_tArray claim_id_arr = (*env)->NewByteArray(env, 32);
13894                         (*env)->SetByteArrayRegion(env, claim_id_arr, 0, 32, obj->htlc_resolution.claim_id.data);
13895                         int32_t target_feerate_sat_per_1000_weight_conv = obj->htlc_resolution.target_feerate_sat_per_1000_weight;
13896                         LDKCVec_HTLCDescriptorZ htlc_descriptors_var = obj->htlc_resolution.htlc_descriptors;
13897                         int64_tArray htlc_descriptors_arr = NULL;
13898                         htlc_descriptors_arr = (*env)->NewLongArray(env, htlc_descriptors_var.datalen);
13899                         int64_t *htlc_descriptors_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, htlc_descriptors_arr, NULL);
13900                         for (size_t q = 0; q < htlc_descriptors_var.datalen; q++) {
13901                                 LDKHTLCDescriptor htlc_descriptors_conv_16_var = htlc_descriptors_var.data[q];
13902                                 int64_t htlc_descriptors_conv_16_ref = 0;
13903                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_var);
13904                                 htlc_descriptors_conv_16_ref = tag_ptr(htlc_descriptors_conv_16_var.inner, false);
13905                                 htlc_descriptors_arr_ptr[q] = htlc_descriptors_conv_16_ref;
13906                         }
13907                         (*env)->ReleasePrimitiveArrayCritical(env, htlc_descriptors_arr, htlc_descriptors_arr_ptr, 0);
13908                         int32_t tx_lock_time_conv = obj->htlc_resolution.tx_lock_time;
13909                         return (*env)->NewObject(env, LDKBumpTransactionEvent_HTLCResolution_class, LDKBumpTransactionEvent_HTLCResolution_meth, claim_id_arr, target_feerate_sat_per_1000_weight_conv, htlc_descriptors_arr, tx_lock_time_conv);
13910                 }
13911                 default: abort();
13912         }
13913 }
13914 static jclass LDKEvent_FundingGenerationReady_class = NULL;
13915 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
13916 static jclass LDKEvent_PaymentClaimable_class = NULL;
13917 static jmethodID LDKEvent_PaymentClaimable_meth = NULL;
13918 static jclass LDKEvent_PaymentClaimed_class = NULL;
13919 static jmethodID LDKEvent_PaymentClaimed_meth = NULL;
13920 static jclass LDKEvent_ConnectionNeeded_class = NULL;
13921 static jmethodID LDKEvent_ConnectionNeeded_meth = NULL;
13922 static jclass LDKEvent_InvoiceRequestFailed_class = NULL;
13923 static jmethodID LDKEvent_InvoiceRequestFailed_meth = NULL;
13924 static jclass LDKEvent_PaymentSent_class = NULL;
13925 static jmethodID LDKEvent_PaymentSent_meth = NULL;
13926 static jclass LDKEvent_PaymentFailed_class = NULL;
13927 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
13928 static jclass LDKEvent_PaymentPathSuccessful_class = NULL;
13929 static jmethodID LDKEvent_PaymentPathSuccessful_meth = NULL;
13930 static jclass LDKEvent_PaymentPathFailed_class = NULL;
13931 static jmethodID LDKEvent_PaymentPathFailed_meth = NULL;
13932 static jclass LDKEvent_ProbeSuccessful_class = NULL;
13933 static jmethodID LDKEvent_ProbeSuccessful_meth = NULL;
13934 static jclass LDKEvent_ProbeFailed_class = NULL;
13935 static jmethodID LDKEvent_ProbeFailed_meth = NULL;
13936 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
13937 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
13938 static jclass LDKEvent_HTLCIntercepted_class = NULL;
13939 static jmethodID LDKEvent_HTLCIntercepted_meth = NULL;
13940 static jclass LDKEvent_SpendableOutputs_class = NULL;
13941 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
13942 static jclass LDKEvent_PaymentForwarded_class = NULL;
13943 static jmethodID LDKEvent_PaymentForwarded_meth = NULL;
13944 static jclass LDKEvent_ChannelPending_class = NULL;
13945 static jmethodID LDKEvent_ChannelPending_meth = NULL;
13946 static jclass LDKEvent_ChannelReady_class = NULL;
13947 static jmethodID LDKEvent_ChannelReady_meth = NULL;
13948 static jclass LDKEvent_ChannelClosed_class = NULL;
13949 static jmethodID LDKEvent_ChannelClosed_meth = NULL;
13950 static jclass LDKEvent_DiscardFunding_class = NULL;
13951 static jmethodID LDKEvent_DiscardFunding_meth = NULL;
13952 static jclass LDKEvent_OpenChannelRequest_class = NULL;
13953 static jmethodID LDKEvent_OpenChannelRequest_meth = NULL;
13954 static jclass LDKEvent_HTLCHandlingFailed_class = NULL;
13955 static jmethodID LDKEvent_HTLCHandlingFailed_meth = NULL;
13956 static jclass LDKEvent_BumpTransaction_class = NULL;
13957 static jmethodID LDKEvent_BumpTransaction_meth = NULL;
13958 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
13959         LDKEvent_FundingGenerationReady_class =
13960                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$FundingGenerationReady"));
13961         CHECK(LDKEvent_FundingGenerationReady_class != NULL);
13962         LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([B[BJ[B[B)V");
13963         CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
13964         LDKEvent_PaymentClaimable_class =
13965                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentClaimable"));
13966         CHECK(LDKEvent_PaymentClaimable_class != NULL);
13967         LDKEvent_PaymentClaimable_meth = (*env)->GetMethodID(env, LDKEvent_PaymentClaimable_class, "<init>", "([B[BJJJJJJJ)V");
13968         CHECK(LDKEvent_PaymentClaimable_meth != NULL);
13969         LDKEvent_PaymentClaimed_class =
13970                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentClaimed"));
13971         CHECK(LDKEvent_PaymentClaimed_class != NULL);
13972         LDKEvent_PaymentClaimed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentClaimed_class, "<init>", "([B[BJJ[JJ)V");
13973         CHECK(LDKEvent_PaymentClaimed_meth != NULL);
13974         LDKEvent_ConnectionNeeded_class =
13975                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ConnectionNeeded"));
13976         CHECK(LDKEvent_ConnectionNeeded_class != NULL);
13977         LDKEvent_ConnectionNeeded_meth = (*env)->GetMethodID(env, LDKEvent_ConnectionNeeded_class, "<init>", "([B[J)V");
13978         CHECK(LDKEvent_ConnectionNeeded_meth != NULL);
13979         LDKEvent_InvoiceRequestFailed_class =
13980                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$InvoiceRequestFailed"));
13981         CHECK(LDKEvent_InvoiceRequestFailed_class != NULL);
13982         LDKEvent_InvoiceRequestFailed_meth = (*env)->GetMethodID(env, LDKEvent_InvoiceRequestFailed_class, "<init>", "([B)V");
13983         CHECK(LDKEvent_InvoiceRequestFailed_meth != NULL);
13984         LDKEvent_PaymentSent_class =
13985                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentSent"));
13986         CHECK(LDKEvent_PaymentSent_class != NULL);
13987         LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "(J[B[BJ)V");
13988         CHECK(LDKEvent_PaymentSent_meth != NULL);
13989         LDKEvent_PaymentFailed_class =
13990                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentFailed"));
13991         CHECK(LDKEvent_PaymentFailed_class != NULL);
13992         LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([B[BJ)V");
13993         CHECK(LDKEvent_PaymentFailed_meth != NULL);
13994         LDKEvent_PaymentPathSuccessful_class =
13995                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathSuccessful"));
13996         CHECK(LDKEvent_PaymentPathSuccessful_class != NULL);
13997         LDKEvent_PaymentPathSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathSuccessful_class, "<init>", "([BJJ)V");
13998         CHECK(LDKEvent_PaymentPathSuccessful_meth != NULL);
13999         LDKEvent_PaymentPathFailed_class =
14000                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathFailed"));
14001         CHECK(LDKEvent_PaymentPathFailed_class != NULL);
14002         LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "<init>", "(J[BZJJJ)V");
14003         CHECK(LDKEvent_PaymentPathFailed_meth != NULL);
14004         LDKEvent_ProbeSuccessful_class =
14005                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ProbeSuccessful"));
14006         CHECK(LDKEvent_ProbeSuccessful_class != NULL);
14007         LDKEvent_ProbeSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_ProbeSuccessful_class, "<init>", "([B[BJ)V");
14008         CHECK(LDKEvent_ProbeSuccessful_meth != NULL);
14009         LDKEvent_ProbeFailed_class =
14010                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ProbeFailed"));
14011         CHECK(LDKEvent_ProbeFailed_class != NULL);
14012         LDKEvent_ProbeFailed_meth = (*env)->GetMethodID(env, LDKEvent_ProbeFailed_class, "<init>", "([B[BJJ)V");
14013         CHECK(LDKEvent_ProbeFailed_meth != NULL);
14014         LDKEvent_PendingHTLCsForwardable_class =
14015                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable"));
14016         CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
14017         LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
14018         CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
14019         LDKEvent_HTLCIntercepted_class =
14020                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$HTLCIntercepted"));
14021         CHECK(LDKEvent_HTLCIntercepted_class != NULL);
14022         LDKEvent_HTLCIntercepted_meth = (*env)->GetMethodID(env, LDKEvent_HTLCIntercepted_class, "<init>", "([BJ[BJJ)V");
14023         CHECK(LDKEvent_HTLCIntercepted_meth != NULL);
14024         LDKEvent_SpendableOutputs_class =
14025                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$SpendableOutputs"));
14026         CHECK(LDKEvent_SpendableOutputs_class != NULL);
14027         LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([JJ)V");
14028         CHECK(LDKEvent_SpendableOutputs_meth != NULL);
14029         LDKEvent_PaymentForwarded_class =
14030                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentForwarded"));
14031         CHECK(LDKEvent_PaymentForwarded_class != NULL);
14032         LDKEvent_PaymentForwarded_meth = (*env)->GetMethodID(env, LDKEvent_PaymentForwarded_class, "<init>", "(JJJZJ)V");
14033         CHECK(LDKEvent_PaymentForwarded_meth != NULL);
14034         LDKEvent_ChannelPending_class =
14035                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelPending"));
14036         CHECK(LDKEvent_ChannelPending_class != NULL);
14037         LDKEvent_ChannelPending_meth = (*env)->GetMethodID(env, LDKEvent_ChannelPending_class, "<init>", "([B[BJ[BJ)V");
14038         CHECK(LDKEvent_ChannelPending_meth != NULL);
14039         LDKEvent_ChannelReady_class =
14040                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelReady"));
14041         CHECK(LDKEvent_ChannelReady_class != NULL);
14042         LDKEvent_ChannelReady_meth = (*env)->GetMethodID(env, LDKEvent_ChannelReady_class, "<init>", "([B[B[BJ)V");
14043         CHECK(LDKEvent_ChannelReady_meth != NULL);
14044         LDKEvent_ChannelClosed_class =
14045                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelClosed"));
14046         CHECK(LDKEvent_ChannelClosed_class != NULL);
14047         LDKEvent_ChannelClosed_meth = (*env)->GetMethodID(env, LDKEvent_ChannelClosed_class, "<init>", "([B[BJ[BJJ)V");
14048         CHECK(LDKEvent_ChannelClosed_meth != NULL);
14049         LDKEvent_DiscardFunding_class =
14050                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$DiscardFunding"));
14051         CHECK(LDKEvent_DiscardFunding_class != NULL);
14052         LDKEvent_DiscardFunding_meth = (*env)->GetMethodID(env, LDKEvent_DiscardFunding_class, "<init>", "([B[B)V");
14053         CHECK(LDKEvent_DiscardFunding_meth != NULL);
14054         LDKEvent_OpenChannelRequest_class =
14055                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$OpenChannelRequest"));
14056         CHECK(LDKEvent_OpenChannelRequest_class != NULL);
14057         LDKEvent_OpenChannelRequest_meth = (*env)->GetMethodID(env, LDKEvent_OpenChannelRequest_class, "<init>", "([B[BJJJ)V");
14058         CHECK(LDKEvent_OpenChannelRequest_meth != NULL);
14059         LDKEvent_HTLCHandlingFailed_class =
14060                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$HTLCHandlingFailed"));
14061         CHECK(LDKEvent_HTLCHandlingFailed_class != NULL);
14062         LDKEvent_HTLCHandlingFailed_meth = (*env)->GetMethodID(env, LDKEvent_HTLCHandlingFailed_class, "<init>", "([BJ)V");
14063         CHECK(LDKEvent_HTLCHandlingFailed_meth != NULL);
14064         LDKEvent_BumpTransaction_class =
14065                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$BumpTransaction"));
14066         CHECK(LDKEvent_BumpTransaction_class != NULL);
14067         LDKEvent_BumpTransaction_meth = (*env)->GetMethodID(env, LDKEvent_BumpTransaction_class, "<init>", "(J)V");
14068         CHECK(LDKEvent_BumpTransaction_meth != NULL);
14069 }
14070 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14071         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
14072         switch(obj->tag) {
14073                 case LDKEvent_FundingGenerationReady: {
14074                         int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
14075                         (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
14076                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
14077                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->funding_generation_ready.counterparty_node_id.compressed_form);
14078                         int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
14079                         LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
14080                         int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
14081                         (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
14082                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
14083                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->funding_generation_ready.user_channel_id.le_bytes);
14084                         return (*env)->NewObject(env, LDKEvent_FundingGenerationReady_class, LDKEvent_FundingGenerationReady_meth, temporary_channel_id_arr, counterparty_node_id_arr, channel_value_satoshis_conv, output_script_arr, user_channel_id_arr);
14085                 }
14086                 case LDKEvent_PaymentClaimable: {
14087                         int8_tArray receiver_node_id_arr = (*env)->NewByteArray(env, 33);
14088                         (*env)->SetByteArrayRegion(env, receiver_node_id_arr, 0, 33, obj->payment_claimable.receiver_node_id.compressed_form);
14089                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
14090                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_claimable.payment_hash.data);
14091                         LDKRecipientOnionFields onion_fields_var = obj->payment_claimable.onion_fields;
14092                         int64_t onion_fields_ref = 0;
14093                         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_var);
14094                         onion_fields_ref = tag_ptr(onion_fields_var.inner, false);
14095                         int64_t amount_msat_conv = obj->payment_claimable.amount_msat;
14096                         int64_t counterparty_skimmed_fee_msat_conv = obj->payment_claimable.counterparty_skimmed_fee_msat;
14097                         int64_t purpose_ref = tag_ptr(&obj->payment_claimable.purpose, false);
14098                         int64_t via_channel_id_ref = tag_ptr(&obj->payment_claimable.via_channel_id, false);
14099                         int64_t via_user_channel_id_ref = tag_ptr(&obj->payment_claimable.via_user_channel_id, false);
14100                         int64_t claim_deadline_ref = tag_ptr(&obj->payment_claimable.claim_deadline, false);
14101                         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);
14102                 }
14103                 case LDKEvent_PaymentClaimed: {
14104                         int8_tArray receiver_node_id_arr = (*env)->NewByteArray(env, 33);
14105                         (*env)->SetByteArrayRegion(env, receiver_node_id_arr, 0, 33, obj->payment_claimed.receiver_node_id.compressed_form);
14106                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
14107                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_claimed.payment_hash.data);
14108                         int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
14109                         int64_t purpose_ref = tag_ptr(&obj->payment_claimed.purpose, false);
14110                         LDKCVec_ClaimedHTLCZ htlcs_var = obj->payment_claimed.htlcs;
14111                         int64_tArray htlcs_arr = NULL;
14112                         htlcs_arr = (*env)->NewLongArray(env, htlcs_var.datalen);
14113                         int64_t *htlcs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, htlcs_arr, NULL);
14114                         for (size_t n = 0; n < htlcs_var.datalen; n++) {
14115                                 LDKClaimedHTLC htlcs_conv_13_var = htlcs_var.data[n];
14116                                 int64_t htlcs_conv_13_ref = 0;
14117                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlcs_conv_13_var);
14118                                 htlcs_conv_13_ref = tag_ptr(htlcs_conv_13_var.inner, false);
14119                                 htlcs_arr_ptr[n] = htlcs_conv_13_ref;
14120                         }
14121                         (*env)->ReleasePrimitiveArrayCritical(env, htlcs_arr, htlcs_arr_ptr, 0);
14122                         int64_t sender_intended_total_msat_ref = tag_ptr(&obj->payment_claimed.sender_intended_total_msat, false);
14123                         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);
14124                 }
14125                 case LDKEvent_ConnectionNeeded: {
14126                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
14127                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->connection_needed.node_id.compressed_form);
14128                         LDKCVec_SocketAddressZ addresses_var = obj->connection_needed.addresses;
14129                         int64_tArray addresses_arr = NULL;
14130                         addresses_arr = (*env)->NewLongArray(env, addresses_var.datalen);
14131                         int64_t *addresses_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, addresses_arr, NULL);
14132                         for (size_t p = 0; p < addresses_var.datalen; p++) {
14133                                 int64_t addresses_conv_15_ref = tag_ptr(&addresses_var.data[p], false);
14134                                 addresses_arr_ptr[p] = addresses_conv_15_ref;
14135                         }
14136                         (*env)->ReleasePrimitiveArrayCritical(env, addresses_arr, addresses_arr_ptr, 0);
14137                         return (*env)->NewObject(env, LDKEvent_ConnectionNeeded_class, LDKEvent_ConnectionNeeded_meth, node_id_arr, addresses_arr);
14138                 }
14139                 case LDKEvent_InvoiceRequestFailed: {
14140                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
14141                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->invoice_request_failed.payment_id.data);
14142                         return (*env)->NewObject(env, LDKEvent_InvoiceRequestFailed_class, LDKEvent_InvoiceRequestFailed_meth, payment_id_arr);
14143                 }
14144                 case LDKEvent_PaymentSent: {
14145                         int64_t payment_id_ref = tag_ptr(&obj->payment_sent.payment_id, false);
14146                         int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
14147                         (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
14148                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
14149                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_sent.payment_hash.data);
14150                         int64_t fee_paid_msat_ref = tag_ptr(&obj->payment_sent.fee_paid_msat, false);
14151                         return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_id_ref, payment_preimage_arr, payment_hash_arr, fee_paid_msat_ref);
14152                 }
14153                 case LDKEvent_PaymentFailed: {
14154                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
14155                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_failed.payment_id.data);
14156                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
14157                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
14158                         int64_t reason_ref = tag_ptr(&obj->payment_failed.reason, false);
14159                         return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_id_arr, payment_hash_arr, reason_ref);
14160                 }
14161                 case LDKEvent_PaymentPathSuccessful: {
14162                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
14163                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_path_successful.payment_id.data);
14164                         int64_t payment_hash_ref = tag_ptr(&obj->payment_path_successful.payment_hash, false);
14165                         LDKPath path_var = obj->payment_path_successful.path;
14166                         int64_t path_ref = 0;
14167                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
14168                         path_ref = tag_ptr(path_var.inner, false);
14169                         return (*env)->NewObject(env, LDKEvent_PaymentPathSuccessful_class, LDKEvent_PaymentPathSuccessful_meth, payment_id_arr, payment_hash_ref, path_ref);
14170                 }
14171                 case LDKEvent_PaymentPathFailed: {
14172                         int64_t payment_id_ref = tag_ptr(&obj->payment_path_failed.payment_id, false);
14173                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
14174                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_failed.payment_hash.data);
14175                         jboolean payment_failed_permanently_conv = obj->payment_path_failed.payment_failed_permanently;
14176                         int64_t failure_ref = tag_ptr(&obj->payment_path_failed.failure, false);
14177                         LDKPath path_var = obj->payment_path_failed.path;
14178                         int64_t path_ref = 0;
14179                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
14180                         path_ref = tag_ptr(path_var.inner, false);
14181                         int64_t short_channel_id_ref = tag_ptr(&obj->payment_path_failed.short_channel_id, false);
14182                         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);
14183                 }
14184                 case LDKEvent_ProbeSuccessful: {
14185                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
14186                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->probe_successful.payment_id.data);
14187                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
14188                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->probe_successful.payment_hash.data);
14189                         LDKPath path_var = obj->probe_successful.path;
14190                         int64_t path_ref = 0;
14191                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
14192                         path_ref = tag_ptr(path_var.inner, false);
14193                         return (*env)->NewObject(env, LDKEvent_ProbeSuccessful_class, LDKEvent_ProbeSuccessful_meth, payment_id_arr, payment_hash_arr, path_ref);
14194                 }
14195                 case LDKEvent_ProbeFailed: {
14196                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
14197                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->probe_failed.payment_id.data);
14198                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
14199                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->probe_failed.payment_hash.data);
14200                         LDKPath path_var = obj->probe_failed.path;
14201                         int64_t path_ref = 0;
14202                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
14203                         path_ref = tag_ptr(path_var.inner, false);
14204                         int64_t short_channel_id_ref = tag_ptr(&obj->probe_failed.short_channel_id, false);
14205                         return (*env)->NewObject(env, LDKEvent_ProbeFailed_class, LDKEvent_ProbeFailed_meth, payment_id_arr, payment_hash_arr, path_ref, short_channel_id_ref);
14206                 }
14207                 case LDKEvent_PendingHTLCsForwardable: {
14208                         int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
14209                         return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, time_forwardable_conv);
14210                 }
14211                 case LDKEvent_HTLCIntercepted: {
14212                         int8_tArray intercept_id_arr = (*env)->NewByteArray(env, 32);
14213                         (*env)->SetByteArrayRegion(env, intercept_id_arr, 0, 32, obj->htlc_intercepted.intercept_id.data);
14214                         int64_t requested_next_hop_scid_conv = obj->htlc_intercepted.requested_next_hop_scid;
14215                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
14216                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->htlc_intercepted.payment_hash.data);
14217                         int64_t inbound_amount_msat_conv = obj->htlc_intercepted.inbound_amount_msat;
14218                         int64_t expected_outbound_amount_msat_conv = obj->htlc_intercepted.expected_outbound_amount_msat;
14219                         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);
14220                 }
14221                 case LDKEvent_SpendableOutputs: {
14222                         LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
14223                         int64_tArray outputs_arr = NULL;
14224                         outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
14225                         int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
14226                         for (size_t b = 0; b < outputs_var.datalen; b++) {
14227                                 int64_t outputs_conv_27_ref = tag_ptr(&outputs_var.data[b], false);
14228                                 outputs_arr_ptr[b] = outputs_conv_27_ref;
14229                         }
14230                         (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
14231                         int64_t channel_id_ref = tag_ptr(&obj->spendable_outputs.channel_id, false);
14232                         return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr, channel_id_ref);
14233                 }
14234                 case LDKEvent_PaymentForwarded: {
14235                         int64_t prev_channel_id_ref = tag_ptr(&obj->payment_forwarded.prev_channel_id, false);
14236                         int64_t next_channel_id_ref = tag_ptr(&obj->payment_forwarded.next_channel_id, false);
14237                         int64_t fee_earned_msat_ref = tag_ptr(&obj->payment_forwarded.fee_earned_msat, false);
14238                         jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
14239                         int64_t outbound_amount_forwarded_msat_ref = tag_ptr(&obj->payment_forwarded.outbound_amount_forwarded_msat, false);
14240                         return (*env)->NewObject(env, LDKEvent_PaymentForwarded_class, LDKEvent_PaymentForwarded_meth, prev_channel_id_ref, next_channel_id_ref, fee_earned_msat_ref, claim_from_onchain_tx_conv, outbound_amount_forwarded_msat_ref);
14241                 }
14242                 case LDKEvent_ChannelPending: {
14243                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
14244                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_pending.channel_id.data);
14245                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
14246                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->channel_pending.user_channel_id.le_bytes);
14247                         int64_t former_temporary_channel_id_ref = tag_ptr(&obj->channel_pending.former_temporary_channel_id, false);
14248                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
14249                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->channel_pending.counterparty_node_id.compressed_form);
14250                         LDKOutPoint funding_txo_var = obj->channel_pending.funding_txo;
14251                         int64_t funding_txo_ref = 0;
14252                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
14253                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
14254                         return (*env)->NewObject(env, LDKEvent_ChannelPending_class, LDKEvent_ChannelPending_meth, channel_id_arr, user_channel_id_arr, former_temporary_channel_id_ref, counterparty_node_id_arr, funding_txo_ref);
14255                 }
14256                 case LDKEvent_ChannelReady: {
14257                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
14258                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_ready.channel_id.data);
14259                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
14260                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->channel_ready.user_channel_id.le_bytes);
14261                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
14262                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->channel_ready.counterparty_node_id.compressed_form);
14263                         LDKChannelTypeFeatures channel_type_var = obj->channel_ready.channel_type;
14264                         int64_t channel_type_ref = 0;
14265                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
14266                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
14267                         return (*env)->NewObject(env, LDKEvent_ChannelReady_class, LDKEvent_ChannelReady_meth, channel_id_arr, user_channel_id_arr, counterparty_node_id_arr, channel_type_ref);
14268                 }
14269                 case LDKEvent_ChannelClosed: {
14270                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
14271                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_closed.channel_id.data);
14272                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
14273                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->channel_closed.user_channel_id.le_bytes);
14274                         int64_t reason_ref = tag_ptr(&obj->channel_closed.reason, false);
14275                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
14276                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->channel_closed.counterparty_node_id.compressed_form);
14277                         int64_t channel_capacity_sats_ref = tag_ptr(&obj->channel_closed.channel_capacity_sats, false);
14278                         LDKOutPoint channel_funding_txo_var = obj->channel_closed.channel_funding_txo;
14279                         int64_t channel_funding_txo_ref = 0;
14280                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_txo_var);
14281                         channel_funding_txo_ref = tag_ptr(channel_funding_txo_var.inner, false);
14282                         return (*env)->NewObject(env, LDKEvent_ChannelClosed_class, LDKEvent_ChannelClosed_meth, channel_id_arr, user_channel_id_arr, reason_ref, counterparty_node_id_arr, channel_capacity_sats_ref, channel_funding_txo_ref);
14283                 }
14284                 case LDKEvent_DiscardFunding: {
14285                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
14286                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->discard_funding.channel_id.data);
14287                         LDKTransaction transaction_var = obj->discard_funding.transaction;
14288                         int8_tArray transaction_arr = (*env)->NewByteArray(env, transaction_var.datalen);
14289                         (*env)->SetByteArrayRegion(env, transaction_arr, 0, transaction_var.datalen, transaction_var.data);
14290                         return (*env)->NewObject(env, LDKEvent_DiscardFunding_class, LDKEvent_DiscardFunding_meth, channel_id_arr, transaction_arr);
14291                 }
14292                 case LDKEvent_OpenChannelRequest: {
14293                         int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
14294                         (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->open_channel_request.temporary_channel_id.data);
14295                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
14296                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->open_channel_request.counterparty_node_id.compressed_form);
14297                         int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
14298                         int64_t push_msat_conv = obj->open_channel_request.push_msat;
14299                         LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
14300                         int64_t channel_type_ref = 0;
14301                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
14302                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
14303                         return (*env)->NewObject(env, LDKEvent_OpenChannelRequest_class, LDKEvent_OpenChannelRequest_meth, temporary_channel_id_arr, counterparty_node_id_arr, funding_satoshis_conv, push_msat_conv, channel_type_ref);
14304                 }
14305                 case LDKEvent_HTLCHandlingFailed: {
14306                         int8_tArray prev_channel_id_arr = (*env)->NewByteArray(env, 32);
14307                         (*env)->SetByteArrayRegion(env, prev_channel_id_arr, 0, 32, obj->htlc_handling_failed.prev_channel_id.data);
14308                         int64_t failed_next_destination_ref = tag_ptr(&obj->htlc_handling_failed.failed_next_destination, false);
14309                         return (*env)->NewObject(env, LDKEvent_HTLCHandlingFailed_class, LDKEvent_HTLCHandlingFailed_meth, prev_channel_id_arr, failed_next_destination_ref);
14310                 }
14311                 case LDKEvent_BumpTransaction: {
14312                         int64_t bump_transaction_ref = tag_ptr(&obj->bump_transaction, false);
14313                         return (*env)->NewObject(env, LDKEvent_BumpTransaction_class, LDKEvent_BumpTransaction_meth, bump_transaction_ref);
14314                 }
14315                 default: abort();
14316         }
14317 }
14318 static jclass LDKCOption_EventZ_Some_class = NULL;
14319 static jmethodID LDKCOption_EventZ_Some_meth = NULL;
14320 static jclass LDKCOption_EventZ_None_class = NULL;
14321 static jmethodID LDKCOption_EventZ_None_meth = NULL;
14322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1EventZ_init (JNIEnv *env, jclass clz) {
14323         LDKCOption_EventZ_Some_class =
14324                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$Some"));
14325         CHECK(LDKCOption_EventZ_Some_class != NULL);
14326         LDKCOption_EventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_Some_class, "<init>", "(J)V");
14327         CHECK(LDKCOption_EventZ_Some_meth != NULL);
14328         LDKCOption_EventZ_None_class =
14329                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$None"));
14330         CHECK(LDKCOption_EventZ_None_class != NULL);
14331         LDKCOption_EventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_None_class, "<init>", "()V");
14332         CHECK(LDKCOption_EventZ_None_meth != NULL);
14333 }
14334 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1EventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14335         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
14336         switch(obj->tag) {
14337                 case LDKCOption_EventZ_Some: {
14338                         int64_t some_ref = tag_ptr(&obj->some, false);
14339                         return (*env)->NewObject(env, LDKCOption_EventZ_Some_class, LDKCOption_EventZ_Some_meth, some_ref);
14340                 }
14341                 case LDKCOption_EventZ_None: {
14342                         return (*env)->NewObject(env, LDKCOption_EventZ_None_class, LDKCOption_EventZ_None_meth);
14343                 }
14344                 default: abort();
14345         }
14346 }
14347 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
14348 CHECK(owner->result_ok);
14349         return COption_EventZ_clone(&*owner->contents.result);
14350 }
14351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14352         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
14353         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
14354         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
14355         int64_t ret_ref = tag_ptr(ret_copy, true);
14356         return ret_ref;
14357 }
14358
14359 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
14360 CHECK(!owner->result_ok);
14361         return DecodeError_clone(&*owner->contents.err);
14362 }
14363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14364         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
14365         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14366         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
14367         int64_t ret_ref = tag_ptr(ret_copy, true);
14368         return ret_ref;
14369 }
14370
14371 static jclass LDKBolt11ParseError_Bech32Error_class = NULL;
14372 static jmethodID LDKBolt11ParseError_Bech32Error_meth = NULL;
14373 static jclass LDKBolt11ParseError_ParseAmountError_class = NULL;
14374 static jmethodID LDKBolt11ParseError_ParseAmountError_meth = NULL;
14375 static jclass LDKBolt11ParseError_MalformedSignature_class = NULL;
14376 static jmethodID LDKBolt11ParseError_MalformedSignature_meth = NULL;
14377 static jclass LDKBolt11ParseError_BadPrefix_class = NULL;
14378 static jmethodID LDKBolt11ParseError_BadPrefix_meth = NULL;
14379 static jclass LDKBolt11ParseError_UnknownCurrency_class = NULL;
14380 static jmethodID LDKBolt11ParseError_UnknownCurrency_meth = NULL;
14381 static jclass LDKBolt11ParseError_UnknownSiPrefix_class = NULL;
14382 static jmethodID LDKBolt11ParseError_UnknownSiPrefix_meth = NULL;
14383 static jclass LDKBolt11ParseError_MalformedHRP_class = NULL;
14384 static jmethodID LDKBolt11ParseError_MalformedHRP_meth = NULL;
14385 static jclass LDKBolt11ParseError_TooShortDataPart_class = NULL;
14386 static jmethodID LDKBolt11ParseError_TooShortDataPart_meth = NULL;
14387 static jclass LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class = NULL;
14388 static jmethodID LDKBolt11ParseError_UnexpectedEndOfTaggedFields_meth = NULL;
14389 static jclass LDKBolt11ParseError_DescriptionDecodeError_class = NULL;
14390 static jmethodID LDKBolt11ParseError_DescriptionDecodeError_meth = NULL;
14391 static jclass LDKBolt11ParseError_PaddingError_class = NULL;
14392 static jmethodID LDKBolt11ParseError_PaddingError_meth = NULL;
14393 static jclass LDKBolt11ParseError_IntegerOverflowError_class = NULL;
14394 static jmethodID LDKBolt11ParseError_IntegerOverflowError_meth = NULL;
14395 static jclass LDKBolt11ParseError_InvalidSegWitProgramLength_class = NULL;
14396 static jmethodID LDKBolt11ParseError_InvalidSegWitProgramLength_meth = NULL;
14397 static jclass LDKBolt11ParseError_InvalidPubKeyHashLength_class = NULL;
14398 static jmethodID LDKBolt11ParseError_InvalidPubKeyHashLength_meth = NULL;
14399 static jclass LDKBolt11ParseError_InvalidScriptHashLength_class = NULL;
14400 static jmethodID LDKBolt11ParseError_InvalidScriptHashLength_meth = NULL;
14401 static jclass LDKBolt11ParseError_InvalidRecoveryId_class = NULL;
14402 static jmethodID LDKBolt11ParseError_InvalidRecoveryId_meth = NULL;
14403 static jclass LDKBolt11ParseError_InvalidSliceLength_class = NULL;
14404 static jmethodID LDKBolt11ParseError_InvalidSliceLength_meth = NULL;
14405 static jclass LDKBolt11ParseError_Skip_class = NULL;
14406 static jmethodID LDKBolt11ParseError_Skip_meth = NULL;
14407 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBolt11ParseError_init (JNIEnv *env, jclass clz) {
14408         LDKBolt11ParseError_Bech32Error_class =
14409                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$Bech32Error"));
14410         CHECK(LDKBolt11ParseError_Bech32Error_class != NULL);
14411         LDKBolt11ParseError_Bech32Error_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_Bech32Error_class, "<init>", "(J)V");
14412         CHECK(LDKBolt11ParseError_Bech32Error_meth != NULL);
14413         LDKBolt11ParseError_ParseAmountError_class =
14414                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$ParseAmountError"));
14415         CHECK(LDKBolt11ParseError_ParseAmountError_class != NULL);
14416         LDKBolt11ParseError_ParseAmountError_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_ParseAmountError_class, "<init>", "(I)V");
14417         CHECK(LDKBolt11ParseError_ParseAmountError_meth != NULL);
14418         LDKBolt11ParseError_MalformedSignature_class =
14419                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$MalformedSignature"));
14420         CHECK(LDKBolt11ParseError_MalformedSignature_class != NULL);
14421         LDKBolt11ParseError_MalformedSignature_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_MalformedSignature_class, "<init>", "(Lorg/ldk/enums/Secp256k1Error;)V");
14422         CHECK(LDKBolt11ParseError_MalformedSignature_meth != NULL);
14423         LDKBolt11ParseError_BadPrefix_class =
14424                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$BadPrefix"));
14425         CHECK(LDKBolt11ParseError_BadPrefix_class != NULL);
14426         LDKBolt11ParseError_BadPrefix_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_BadPrefix_class, "<init>", "()V");
14427         CHECK(LDKBolt11ParseError_BadPrefix_meth != NULL);
14428         LDKBolt11ParseError_UnknownCurrency_class =
14429                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$UnknownCurrency"));
14430         CHECK(LDKBolt11ParseError_UnknownCurrency_class != NULL);
14431         LDKBolt11ParseError_UnknownCurrency_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_UnknownCurrency_class, "<init>", "()V");
14432         CHECK(LDKBolt11ParseError_UnknownCurrency_meth != NULL);
14433         LDKBolt11ParseError_UnknownSiPrefix_class =
14434                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$UnknownSiPrefix"));
14435         CHECK(LDKBolt11ParseError_UnknownSiPrefix_class != NULL);
14436         LDKBolt11ParseError_UnknownSiPrefix_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_UnknownSiPrefix_class, "<init>", "()V");
14437         CHECK(LDKBolt11ParseError_UnknownSiPrefix_meth != NULL);
14438         LDKBolt11ParseError_MalformedHRP_class =
14439                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$MalformedHRP"));
14440         CHECK(LDKBolt11ParseError_MalformedHRP_class != NULL);
14441         LDKBolt11ParseError_MalformedHRP_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_MalformedHRP_class, "<init>", "()V");
14442         CHECK(LDKBolt11ParseError_MalformedHRP_meth != NULL);
14443         LDKBolt11ParseError_TooShortDataPart_class =
14444                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$TooShortDataPart"));
14445         CHECK(LDKBolt11ParseError_TooShortDataPart_class != NULL);
14446         LDKBolt11ParseError_TooShortDataPart_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_TooShortDataPart_class, "<init>", "()V");
14447         CHECK(LDKBolt11ParseError_TooShortDataPart_meth != NULL);
14448         LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class =
14449                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$UnexpectedEndOfTaggedFields"));
14450         CHECK(LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class != NULL);
14451         LDKBolt11ParseError_UnexpectedEndOfTaggedFields_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class, "<init>", "()V");
14452         CHECK(LDKBolt11ParseError_UnexpectedEndOfTaggedFields_meth != NULL);
14453         LDKBolt11ParseError_DescriptionDecodeError_class =
14454                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$DescriptionDecodeError"));
14455         CHECK(LDKBolt11ParseError_DescriptionDecodeError_class != NULL);
14456         LDKBolt11ParseError_DescriptionDecodeError_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_DescriptionDecodeError_class, "<init>", "(I)V");
14457         CHECK(LDKBolt11ParseError_DescriptionDecodeError_meth != NULL);
14458         LDKBolt11ParseError_PaddingError_class =
14459                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$PaddingError"));
14460         CHECK(LDKBolt11ParseError_PaddingError_class != NULL);
14461         LDKBolt11ParseError_PaddingError_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_PaddingError_class, "<init>", "()V");
14462         CHECK(LDKBolt11ParseError_PaddingError_meth != NULL);
14463         LDKBolt11ParseError_IntegerOverflowError_class =
14464                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$IntegerOverflowError"));
14465         CHECK(LDKBolt11ParseError_IntegerOverflowError_class != NULL);
14466         LDKBolt11ParseError_IntegerOverflowError_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_IntegerOverflowError_class, "<init>", "()V");
14467         CHECK(LDKBolt11ParseError_IntegerOverflowError_meth != NULL);
14468         LDKBolt11ParseError_InvalidSegWitProgramLength_class =
14469                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidSegWitProgramLength"));
14470         CHECK(LDKBolt11ParseError_InvalidSegWitProgramLength_class != NULL);
14471         LDKBolt11ParseError_InvalidSegWitProgramLength_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidSegWitProgramLength_class, "<init>", "()V");
14472         CHECK(LDKBolt11ParseError_InvalidSegWitProgramLength_meth != NULL);
14473         LDKBolt11ParseError_InvalidPubKeyHashLength_class =
14474                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidPubKeyHashLength"));
14475         CHECK(LDKBolt11ParseError_InvalidPubKeyHashLength_class != NULL);
14476         LDKBolt11ParseError_InvalidPubKeyHashLength_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidPubKeyHashLength_class, "<init>", "()V");
14477         CHECK(LDKBolt11ParseError_InvalidPubKeyHashLength_meth != NULL);
14478         LDKBolt11ParseError_InvalidScriptHashLength_class =
14479                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidScriptHashLength"));
14480         CHECK(LDKBolt11ParseError_InvalidScriptHashLength_class != NULL);
14481         LDKBolt11ParseError_InvalidScriptHashLength_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidScriptHashLength_class, "<init>", "()V");
14482         CHECK(LDKBolt11ParseError_InvalidScriptHashLength_meth != NULL);
14483         LDKBolt11ParseError_InvalidRecoveryId_class =
14484                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidRecoveryId"));
14485         CHECK(LDKBolt11ParseError_InvalidRecoveryId_class != NULL);
14486         LDKBolt11ParseError_InvalidRecoveryId_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidRecoveryId_class, "<init>", "()V");
14487         CHECK(LDKBolt11ParseError_InvalidRecoveryId_meth != NULL);
14488         LDKBolt11ParseError_InvalidSliceLength_class =
14489                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidSliceLength"));
14490         CHECK(LDKBolt11ParseError_InvalidSliceLength_class != NULL);
14491         LDKBolt11ParseError_InvalidSliceLength_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidSliceLength_class, "<init>", "(Ljava/lang/String;)V");
14492         CHECK(LDKBolt11ParseError_InvalidSliceLength_meth != NULL);
14493         LDKBolt11ParseError_Skip_class =
14494                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$Skip"));
14495         CHECK(LDKBolt11ParseError_Skip_class != NULL);
14496         LDKBolt11ParseError_Skip_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_Skip_class, "<init>", "()V");
14497         CHECK(LDKBolt11ParseError_Skip_meth != NULL);
14498 }
14499 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBolt11ParseError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14500         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
14501         switch(obj->tag) {
14502                 case LDKBolt11ParseError_Bech32Error: {
14503                         int64_t bech32_error_ref = tag_ptr(&obj->bech32_error, false);
14504                         return (*env)->NewObject(env, LDKBolt11ParseError_Bech32Error_class, LDKBolt11ParseError_Bech32Error_meth, bech32_error_ref);
14505                 }
14506                 case LDKBolt11ParseError_ParseAmountError: {
14507                         /*obj->parse_amount_error*/
14508                         return (*env)->NewObject(env, LDKBolt11ParseError_ParseAmountError_class, LDKBolt11ParseError_ParseAmountError_meth, 0);
14509                 }
14510                 case LDKBolt11ParseError_MalformedSignature: {
14511                         jclass malformed_signature_conv = LDKSecp256k1Error_to_java(env, obj->malformed_signature);
14512                         return (*env)->NewObject(env, LDKBolt11ParseError_MalformedSignature_class, LDKBolt11ParseError_MalformedSignature_meth, malformed_signature_conv);
14513                 }
14514                 case LDKBolt11ParseError_BadPrefix: {
14515                         return (*env)->NewObject(env, LDKBolt11ParseError_BadPrefix_class, LDKBolt11ParseError_BadPrefix_meth);
14516                 }
14517                 case LDKBolt11ParseError_UnknownCurrency: {
14518                         return (*env)->NewObject(env, LDKBolt11ParseError_UnknownCurrency_class, LDKBolt11ParseError_UnknownCurrency_meth);
14519                 }
14520                 case LDKBolt11ParseError_UnknownSiPrefix: {
14521                         return (*env)->NewObject(env, LDKBolt11ParseError_UnknownSiPrefix_class, LDKBolt11ParseError_UnknownSiPrefix_meth);
14522                 }
14523                 case LDKBolt11ParseError_MalformedHRP: {
14524                         return (*env)->NewObject(env, LDKBolt11ParseError_MalformedHRP_class, LDKBolt11ParseError_MalformedHRP_meth);
14525                 }
14526                 case LDKBolt11ParseError_TooShortDataPart: {
14527                         return (*env)->NewObject(env, LDKBolt11ParseError_TooShortDataPart_class, LDKBolt11ParseError_TooShortDataPart_meth);
14528                 }
14529                 case LDKBolt11ParseError_UnexpectedEndOfTaggedFields: {
14530                         return (*env)->NewObject(env, LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class, LDKBolt11ParseError_UnexpectedEndOfTaggedFields_meth);
14531                 }
14532                 case LDKBolt11ParseError_DescriptionDecodeError: {
14533                         /*obj->description_decode_error*/
14534                         return (*env)->NewObject(env, LDKBolt11ParseError_DescriptionDecodeError_class, LDKBolt11ParseError_DescriptionDecodeError_meth, 0);
14535                 }
14536                 case LDKBolt11ParseError_PaddingError: {
14537                         return (*env)->NewObject(env, LDKBolt11ParseError_PaddingError_class, LDKBolt11ParseError_PaddingError_meth);
14538                 }
14539                 case LDKBolt11ParseError_IntegerOverflowError: {
14540                         return (*env)->NewObject(env, LDKBolt11ParseError_IntegerOverflowError_class, LDKBolt11ParseError_IntegerOverflowError_meth);
14541                 }
14542                 case LDKBolt11ParseError_InvalidSegWitProgramLength: {
14543                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidSegWitProgramLength_class, LDKBolt11ParseError_InvalidSegWitProgramLength_meth);
14544                 }
14545                 case LDKBolt11ParseError_InvalidPubKeyHashLength: {
14546                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidPubKeyHashLength_class, LDKBolt11ParseError_InvalidPubKeyHashLength_meth);
14547                 }
14548                 case LDKBolt11ParseError_InvalidScriptHashLength: {
14549                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidScriptHashLength_class, LDKBolt11ParseError_InvalidScriptHashLength_meth);
14550                 }
14551                 case LDKBolt11ParseError_InvalidRecoveryId: {
14552                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidRecoveryId_class, LDKBolt11ParseError_InvalidRecoveryId_meth);
14553                 }
14554                 case LDKBolt11ParseError_InvalidSliceLength: {
14555                         LDKStr invalid_slice_length_str = obj->invalid_slice_length;
14556                         jstring invalid_slice_length_conv = str_ref_to_java(env, invalid_slice_length_str.chars, invalid_slice_length_str.len);
14557                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidSliceLength_class, LDKBolt11ParseError_InvalidSliceLength_meth, invalid_slice_length_conv);
14558                 }
14559                 case LDKBolt11ParseError_Skip: {
14560                         return (*env)->NewObject(env, LDKBolt11ParseError_Skip_class, LDKBolt11ParseError_Skip_meth);
14561                 }
14562                 default: abort();
14563         }
14564 }
14565 static inline enum LDKSiPrefix CResult_SiPrefixBolt11ParseErrorZ_get_ok(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
14566 CHECK(owner->result_ok);
14567         return SiPrefix_clone(&*owner->contents.result);
14568 }
14569 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14570         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
14571         jclass ret_conv = LDKSiPrefix_to_java(env, CResult_SiPrefixBolt11ParseErrorZ_get_ok(owner_conv));
14572         return ret_conv;
14573 }
14574
14575 static inline struct LDKBolt11ParseError CResult_SiPrefixBolt11ParseErrorZ_get_err(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
14576 CHECK(!owner->result_ok);
14577         return Bolt11ParseError_clone(&*owner->contents.err);
14578 }
14579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14580         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
14581         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
14582         *ret_copy = CResult_SiPrefixBolt11ParseErrorZ_get_err(owner_conv);
14583         int64_t ret_ref = tag_ptr(ret_copy, true);
14584         return ret_ref;
14585 }
14586
14587 static jclass LDKParseOrSemanticError_ParseError_class = NULL;
14588 static jmethodID LDKParseOrSemanticError_ParseError_meth = NULL;
14589 static jclass LDKParseOrSemanticError_SemanticError_class = NULL;
14590 static jmethodID LDKParseOrSemanticError_SemanticError_meth = NULL;
14591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKParseOrSemanticError_init (JNIEnv *env, jclass clz) {
14592         LDKParseOrSemanticError_ParseError_class =
14593                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$ParseError"));
14594         CHECK(LDKParseOrSemanticError_ParseError_class != NULL);
14595         LDKParseOrSemanticError_ParseError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_ParseError_class, "<init>", "(J)V");
14596         CHECK(LDKParseOrSemanticError_ParseError_meth != NULL);
14597         LDKParseOrSemanticError_SemanticError_class =
14598                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$SemanticError"));
14599         CHECK(LDKParseOrSemanticError_SemanticError_class != NULL);
14600         LDKParseOrSemanticError_SemanticError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_SemanticError_class, "<init>", "(Lorg/ldk/enums/Bolt11SemanticError;)V");
14601         CHECK(LDKParseOrSemanticError_SemanticError_meth != NULL);
14602 }
14603 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParseOrSemanticError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14604         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
14605         switch(obj->tag) {
14606                 case LDKParseOrSemanticError_ParseError: {
14607                         int64_t parse_error_ref = tag_ptr(&obj->parse_error, false);
14608                         return (*env)->NewObject(env, LDKParseOrSemanticError_ParseError_class, LDKParseOrSemanticError_ParseError_meth, parse_error_ref);
14609                 }
14610                 case LDKParseOrSemanticError_SemanticError: {
14611                         jclass semantic_error_conv = LDKBolt11SemanticError_to_java(env, obj->semantic_error);
14612                         return (*env)->NewObject(env, LDKParseOrSemanticError_SemanticError_class, LDKParseOrSemanticError_SemanticError_meth, semantic_error_conv);
14613                 }
14614                 default: abort();
14615         }
14616 }
14617 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
14618         LDKBolt11Invoice ret = *owner->contents.result;
14619         ret.is_owned = false;
14620         return ret;
14621 }
14622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14623         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
14624         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
14625         int64_t ret_ref = 0;
14626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14628         return ret_ref;
14629 }
14630
14631 static inline struct LDKParseOrSemanticError CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
14632 CHECK(!owner->result_ok);
14633         return ParseOrSemanticError_clone(&*owner->contents.err);
14634 }
14635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14636         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
14637         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
14638         *ret_copy = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
14639         int64_t ret_ref = tag_ptr(ret_copy, true);
14640         return ret_ref;
14641 }
14642
14643 static inline struct LDKSignedRawBolt11Invoice CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
14644         LDKSignedRawBolt11Invoice ret = *owner->contents.result;
14645         ret.is_owned = false;
14646         return ret;
14647 }
14648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14649         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
14650         LDKSignedRawBolt11Invoice ret_var = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(owner_conv);
14651         int64_t ret_ref = 0;
14652         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14653         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14654         return ret_ref;
14655 }
14656
14657 static inline struct LDKBolt11ParseError CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
14658 CHECK(!owner->result_ok);
14659         return Bolt11ParseError_clone(&*owner->contents.err);
14660 }
14661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14662         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
14663         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
14664         *ret_copy = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(owner_conv);
14665         int64_t ret_ref = tag_ptr(ret_copy, true);
14666         return ret_ref;
14667 }
14668
14669 static inline struct LDKRawBolt11Invoice C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
14670         LDKRawBolt11Invoice ret = owner->a;
14671         ret.is_owned = false;
14672         return ret;
14673 }
14674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
14675         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
14676         LDKRawBolt11Invoice ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(owner_conv);
14677         int64_t ret_ref = 0;
14678         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14679         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14680         return ret_ref;
14681 }
14682
14683 static inline struct LDKThirtyTwoBytes C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
14684         return ThirtyTwoBytes_clone(&owner->b);
14685 }
14686 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
14687         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
14688         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14689         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(owner_conv).data);
14690         return ret_arr;
14691 }
14692
14693 static inline struct LDKBolt11InvoiceSignature C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
14694         LDKBolt11InvoiceSignature ret = owner->c;
14695         ret.is_owned = false;
14696         return ret;
14697 }
14698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
14699         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
14700         LDKBolt11InvoiceSignature ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(owner_conv);
14701         int64_t ret_ref = 0;
14702         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14703         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14704         return ret_ref;
14705 }
14706
14707 static inline struct LDKPayeePubKey CResult_PayeePubKeySecp256k1ErrorZ_get_ok(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR owner){
14708         LDKPayeePubKey ret = *owner->contents.result;
14709         ret.is_owned = false;
14710         return ret;
14711 }
14712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14713         LDKCResult_PayeePubKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(owner);
14714         LDKPayeePubKey ret_var = CResult_PayeePubKeySecp256k1ErrorZ_get_ok(owner_conv);
14715         int64_t ret_ref = 0;
14716         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14717         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14718         return ret_ref;
14719 }
14720
14721 static inline enum LDKSecp256k1Error CResult_PayeePubKeySecp256k1ErrorZ_get_err(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR owner){
14722 CHECK(!owner->result_ok);
14723         return *owner->contents.err;
14724 }
14725 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14726         LDKCResult_PayeePubKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(owner);
14727         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PayeePubKeySecp256k1ErrorZ_get_err(owner_conv));
14728         return ret_conv;
14729 }
14730
14731 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
14732         LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
14733         for (size_t i = 0; i < ret.datalen; i++) {
14734                 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
14735         }
14736         return ret;
14737 }
14738 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
14739         LDKPositiveTimestamp ret = *owner->contents.result;
14740         ret.is_owned = false;
14741         return ret;
14742 }
14743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14744         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
14745         LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
14746         int64_t ret_ref = 0;
14747         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14748         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14749         return ret_ref;
14750 }
14751
14752 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
14753 CHECK(!owner->result_ok);
14754         return CreationError_clone(&*owner->contents.err);
14755 }
14756 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14757         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
14758         jclass ret_conv = LDKCreationError_to_java(env, CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
14759         return ret_conv;
14760 }
14761
14762 static inline void CResult_NoneBolt11SemanticErrorZ_get_ok(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
14763 CHECK(owner->result_ok);
14764         return *owner->contents.result;
14765 }
14766 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14767         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
14768         CResult_NoneBolt11SemanticErrorZ_get_ok(owner_conv);
14769 }
14770
14771 static inline enum LDKBolt11SemanticError CResult_NoneBolt11SemanticErrorZ_get_err(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
14772 CHECK(!owner->result_ok);
14773         return Bolt11SemanticError_clone(&*owner->contents.err);
14774 }
14775 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14776         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
14777         jclass ret_conv = LDKBolt11SemanticError_to_java(env, CResult_NoneBolt11SemanticErrorZ_get_err(owner_conv));
14778         return ret_conv;
14779 }
14780
14781 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
14782         LDKBolt11Invoice ret = *owner->contents.result;
14783         ret.is_owned = false;
14784         return ret;
14785 }
14786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14787         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
14788         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(owner_conv);
14789         int64_t ret_ref = 0;
14790         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14791         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14792         return ret_ref;
14793 }
14794
14795 static inline enum LDKBolt11SemanticError CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
14796 CHECK(!owner->result_ok);
14797         return Bolt11SemanticError_clone(&*owner->contents.err);
14798 }
14799 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14800         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
14801         jclass ret_conv = LDKBolt11SemanticError_to_java(env, CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(owner_conv));
14802         return ret_conv;
14803 }
14804
14805 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
14806         LDKDescription ret = *owner->contents.result;
14807         ret.is_owned = false;
14808         return ret;
14809 }
14810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14811         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
14812         LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
14813         int64_t ret_ref = 0;
14814         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14815         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14816         return ret_ref;
14817 }
14818
14819 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
14820 CHECK(!owner->result_ok);
14821         return CreationError_clone(&*owner->contents.err);
14822 }
14823 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14824         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
14825         jclass ret_conv = LDKCreationError_to_java(env, CResult_DescriptionCreationErrorZ_get_err(owner_conv));
14826         return ret_conv;
14827 }
14828
14829 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
14830         LDKPrivateRoute ret = *owner->contents.result;
14831         ret.is_owned = false;
14832         return ret;
14833 }
14834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14835         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
14836         LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
14837         int64_t ret_ref = 0;
14838         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14839         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14840         return ret_ref;
14841 }
14842
14843 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
14844 CHECK(!owner->result_ok);
14845         return CreationError_clone(&*owner->contents.err);
14846 }
14847 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14848         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
14849         jclass ret_conv = LDKCreationError_to_java(env, CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
14850         return ret_conv;
14851 }
14852
14853 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
14854         LDKOutPoint ret = *owner->contents.result;
14855         ret.is_owned = false;
14856         return ret;
14857 }
14858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14859         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
14860         LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
14861         int64_t ret_ref = 0;
14862         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14863         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14864         return ret_ref;
14865 }
14866
14867 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
14868 CHECK(!owner->result_ok);
14869         return DecodeError_clone(&*owner->contents.err);
14870 }
14871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14872         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
14873         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14874         *ret_copy = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
14875         int64_t ret_ref = tag_ptr(ret_copy, true);
14876         return ret_ref;
14877 }
14878
14879 static inline struct LDKBigSize CResult_BigSizeDecodeErrorZ_get_ok(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
14880         LDKBigSize ret = *owner->contents.result;
14881         ret.is_owned = false;
14882         return ret;
14883 }
14884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14885         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
14886         LDKBigSize ret_var = CResult_BigSizeDecodeErrorZ_get_ok(owner_conv);
14887         int64_t ret_ref = 0;
14888         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14889         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14890         return ret_ref;
14891 }
14892
14893 static inline struct LDKDecodeError CResult_BigSizeDecodeErrorZ_get_err(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
14894 CHECK(!owner->result_ok);
14895         return DecodeError_clone(&*owner->contents.err);
14896 }
14897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14898         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
14899         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14900         *ret_copy = CResult_BigSizeDecodeErrorZ_get_err(owner_conv);
14901         int64_t ret_ref = tag_ptr(ret_copy, true);
14902         return ret_ref;
14903 }
14904
14905 static inline struct LDKHostname CResult_HostnameDecodeErrorZ_get_ok(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
14906         LDKHostname ret = *owner->contents.result;
14907         ret.is_owned = false;
14908         return ret;
14909 }
14910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14911         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
14912         LDKHostname ret_var = CResult_HostnameDecodeErrorZ_get_ok(owner_conv);
14913         int64_t ret_ref = 0;
14914         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14915         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14916         return ret_ref;
14917 }
14918
14919 static inline struct LDKDecodeError CResult_HostnameDecodeErrorZ_get_err(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
14920 CHECK(!owner->result_ok);
14921         return DecodeError_clone(&*owner->contents.err);
14922 }
14923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14924         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
14925         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14926         *ret_copy = CResult_HostnameDecodeErrorZ_get_err(owner_conv);
14927         int64_t ret_ref = tag_ptr(ret_copy, true);
14928         return ret_ref;
14929 }
14930
14931 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedNoneZ_get_ok(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
14932         LDKTransactionU16LenLimited ret = *owner->contents.result;
14933         ret.is_owned = false;
14934         return ret;
14935 }
14936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14937         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
14938         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedNoneZ_get_ok(owner_conv);
14939         int64_t ret_ref = 0;
14940         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14941         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14942         return ret_ref;
14943 }
14944
14945 static inline void CResult_TransactionU16LenLimitedNoneZ_get_err(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
14946 CHECK(!owner->result_ok);
14947         return *owner->contents.err;
14948 }
14949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14950         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
14951         CResult_TransactionU16LenLimitedNoneZ_get_err(owner_conv);
14952 }
14953
14954 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
14955         LDKTransactionU16LenLimited ret = *owner->contents.result;
14956         ret.is_owned = false;
14957         return ret;
14958 }
14959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14960         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
14961         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(owner_conv);
14962         int64_t ret_ref = 0;
14963         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14964         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14965         return ret_ref;
14966 }
14967
14968 static inline struct LDKDecodeError CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
14969 CHECK(!owner->result_ok);
14970         return DecodeError_clone(&*owner->contents.err);
14971 }
14972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14973         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
14974         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14975         *ret_copy = CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(owner_conv);
14976         int64_t ret_ref = tag_ptr(ret_copy, true);
14977         return ret_ref;
14978 }
14979
14980 static inline struct LDKUntrustedString CResult_UntrustedStringDecodeErrorZ_get_ok(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
14981         LDKUntrustedString ret = *owner->contents.result;
14982         ret.is_owned = false;
14983         return ret;
14984 }
14985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14986         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
14987         LDKUntrustedString ret_var = CResult_UntrustedStringDecodeErrorZ_get_ok(owner_conv);
14988         int64_t ret_ref = 0;
14989         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14990         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14991         return ret_ref;
14992 }
14993
14994 static inline struct LDKDecodeError CResult_UntrustedStringDecodeErrorZ_get_err(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
14995 CHECK(!owner->result_ok);
14996         return DecodeError_clone(&*owner->contents.err);
14997 }
14998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14999         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
15000         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
15001         *ret_copy = CResult_UntrustedStringDecodeErrorZ_get_err(owner_conv);
15002         int64_t ret_ref = tag_ptr(ret_copy, true);
15003         return ret_ref;
15004 }
15005
15006 static inline struct LDKThirtyTwoBytes C2Tuple__u832u16Z_get_a(LDKC2Tuple__u832u16Z *NONNULL_PTR owner){
15007         return ThirtyTwoBytes_clone(&owner->a);
15008 }
15009 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u832u16Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
15010         LDKC2Tuple__u832u16Z* owner_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(owner);
15011         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15012         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple__u832u16Z_get_a(owner_conv).data);
15013         return ret_arr;
15014 }
15015
15016 static inline uint16_t C2Tuple__u832u16Z_get_b(LDKC2Tuple__u832u16Z *NONNULL_PTR owner){
15017         return owner->b;
15018 }
15019 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u832u16Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
15020         LDKC2Tuple__u832u16Z* owner_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(owner);
15021         int16_t ret_conv = C2Tuple__u832u16Z_get_b(owner_conv);
15022         return ret_conv;
15023 }
15024
15025 static inline struct LDKPaymentRelay CResult_PaymentRelayDecodeErrorZ_get_ok(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR owner){
15026         LDKPaymentRelay ret = *owner->contents.result;
15027         ret.is_owned = false;
15028         return ret;
15029 }
15030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15031         LDKCResult_PaymentRelayDecodeErrorZ* owner_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(owner);
15032         LDKPaymentRelay ret_var = CResult_PaymentRelayDecodeErrorZ_get_ok(owner_conv);
15033         int64_t ret_ref = 0;
15034         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15035         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15036         return ret_ref;
15037 }
15038
15039 static inline struct LDKDecodeError CResult_PaymentRelayDecodeErrorZ_get_err(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR owner){
15040 CHECK(!owner->result_ok);
15041         return DecodeError_clone(&*owner->contents.err);
15042 }
15043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15044         LDKCResult_PaymentRelayDecodeErrorZ* owner_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(owner);
15045         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
15046         *ret_copy = CResult_PaymentRelayDecodeErrorZ_get_err(owner_conv);
15047         int64_t ret_ref = tag_ptr(ret_copy, true);
15048         return ret_ref;
15049 }
15050
15051 static inline struct LDKPaymentConstraints CResult_PaymentConstraintsDecodeErrorZ_get_ok(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR owner){
15052         LDKPaymentConstraints ret = *owner->contents.result;
15053         ret.is_owned = false;
15054         return ret;
15055 }
15056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15057         LDKCResult_PaymentConstraintsDecodeErrorZ* owner_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(owner);
15058         LDKPaymentConstraints ret_var = CResult_PaymentConstraintsDecodeErrorZ_get_ok(owner_conv);
15059         int64_t ret_ref = 0;
15060         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15061         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15062         return ret_ref;
15063 }
15064
15065 static inline struct LDKDecodeError CResult_PaymentConstraintsDecodeErrorZ_get_err(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR owner){
15066 CHECK(!owner->result_ok);
15067         return DecodeError_clone(&*owner->contents.err);
15068 }
15069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15070         LDKCResult_PaymentConstraintsDecodeErrorZ* owner_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(owner);
15071         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
15072         *ret_copy = CResult_PaymentConstraintsDecodeErrorZ_get_err(owner_conv);
15073         int64_t ret_ref = tag_ptr(ret_copy, true);
15074         return ret_ref;
15075 }
15076
15077 static inline struct LDKThirtyTwoBytes C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_a(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR owner){
15078         return ThirtyTwoBytes_clone(&owner->a);
15079 }
15080 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
15081         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(owner);
15082         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15083         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_a(owner_conv).data);
15084         return ret_arr;
15085 }
15086
15087 static inline struct LDKRecipientOnionFields C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_b(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR owner){
15088         LDKRecipientOnionFields ret = owner->b;
15089         ret.is_owned = false;
15090         return ret;
15091 }
15092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
15093         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(owner);
15094         LDKRecipientOnionFields ret_var = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_b(owner_conv);
15095         int64_t ret_ref = 0;
15096         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15097         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15098         return ret_ref;
15099 }
15100
15101 static inline struct LDKRouteParameters C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_c(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR owner){
15102         LDKRouteParameters ret = owner->c;
15103         ret.is_owned = false;
15104         return ret;
15105 }
15106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
15107         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(owner);
15108         LDKRouteParameters ret_var = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_c(owner_conv);
15109         int64_t ret_ref = 0;
15110         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15111         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15112         return ret_ref;
15113 }
15114
15115 static inline struct LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_ok(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR owner){
15116 CHECK(owner->result_ok);
15117         return C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(&*owner->contents.result);
15118 }
15119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15120         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* owner_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(owner);
15121         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
15122         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_ok(owner_conv);
15123         return tag_ptr(ret_conv, true);
15124 }
15125
15126 static inline void CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_err(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR owner){
15127 CHECK(!owner->result_ok);
15128         return *owner->contents.err;
15129 }
15130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15131         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* owner_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(owner);
15132         CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_err(owner_conv);
15133 }
15134
15135 static inline struct LDKStr CResult_StrSecp256k1ErrorZ_get_ok(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR owner){
15136 CHECK(owner->result_ok);
15137         return *owner->contents.result;
15138 }
15139 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15140         LDKCResult_StrSecp256k1ErrorZ* owner_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(owner);
15141         LDKStr ret_str = CResult_StrSecp256k1ErrorZ_get_ok(owner_conv);
15142         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
15143         return ret_conv;
15144 }
15145
15146 static inline enum LDKSecp256k1Error CResult_StrSecp256k1ErrorZ_get_err(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR owner){
15147 CHECK(!owner->result_ok);
15148         return *owner->contents.err;
15149 }
15150 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15151         LDKCResult_StrSecp256k1ErrorZ* owner_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(owner);
15152         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_StrSecp256k1ErrorZ_get_err(owner_conv));
15153         return ret_conv;
15154 }
15155
15156 static inline struct LDKPublicKey C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_a(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR owner){
15157         return owner->a;
15158 }
15159 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
15160         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* owner_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(owner);
15161         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
15162         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_a(owner_conv).compressed_form);
15163         return ret_arr;
15164 }
15165
15166 static inline struct LDKOnionMessage C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_b(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR owner){
15167         LDKOnionMessage ret = owner->b;
15168         ret.is_owned = false;
15169         return ret;
15170 }
15171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
15172         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* owner_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(owner);
15173         LDKOnionMessage ret_var = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_b(owner_conv);
15174         int64_t ret_ref = 0;
15175         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15176         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15177         return ret_ref;
15178 }
15179
15180 static inline struct LDKCOption_CVec_SocketAddressZZ C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_c(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR owner){
15181         return COption_CVec_SocketAddressZZ_clone(&owner->c);
15182 }
15183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
15184         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* owner_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(owner);
15185         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
15186         *ret_copy = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_c(owner_conv);
15187         int64_t ret_ref = tag_ptr(ret_copy, true);
15188         return ret_ref;
15189 }
15190
15191 static jclass LDKSendError_Secp256k1_class = NULL;
15192 static jmethodID LDKSendError_Secp256k1_meth = NULL;
15193 static jclass LDKSendError_TooBigPacket_class = NULL;
15194 static jmethodID LDKSendError_TooBigPacket_meth = NULL;
15195 static jclass LDKSendError_TooFewBlindedHops_class = NULL;
15196 static jmethodID LDKSendError_TooFewBlindedHops_meth = NULL;
15197 static jclass LDKSendError_InvalidFirstHop_class = NULL;
15198 static jmethodID LDKSendError_InvalidFirstHop_meth = NULL;
15199 static jclass LDKSendError_PathNotFound_class = NULL;
15200 static jmethodID LDKSendError_PathNotFound_meth = NULL;
15201 static jclass LDKSendError_InvalidMessage_class = NULL;
15202 static jmethodID LDKSendError_InvalidMessage_meth = NULL;
15203 static jclass LDKSendError_BufferFull_class = NULL;
15204 static jmethodID LDKSendError_BufferFull_meth = NULL;
15205 static jclass LDKSendError_GetNodeIdFailed_class = NULL;
15206 static jmethodID LDKSendError_GetNodeIdFailed_meth = NULL;
15207 static jclass LDKSendError_BlindedPathAdvanceFailed_class = NULL;
15208 static jmethodID LDKSendError_BlindedPathAdvanceFailed_meth = NULL;
15209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSendError_init (JNIEnv *env, jclass clz) {
15210         LDKSendError_Secp256k1_class =
15211                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$Secp256k1"));
15212         CHECK(LDKSendError_Secp256k1_class != NULL);
15213         LDKSendError_Secp256k1_meth = (*env)->GetMethodID(env, LDKSendError_Secp256k1_class, "<init>", "(Lorg/ldk/enums/Secp256k1Error;)V");
15214         CHECK(LDKSendError_Secp256k1_meth != NULL);
15215         LDKSendError_TooBigPacket_class =
15216                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$TooBigPacket"));
15217         CHECK(LDKSendError_TooBigPacket_class != NULL);
15218         LDKSendError_TooBigPacket_meth = (*env)->GetMethodID(env, LDKSendError_TooBigPacket_class, "<init>", "()V");
15219         CHECK(LDKSendError_TooBigPacket_meth != NULL);
15220         LDKSendError_TooFewBlindedHops_class =
15221                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$TooFewBlindedHops"));
15222         CHECK(LDKSendError_TooFewBlindedHops_class != NULL);
15223         LDKSendError_TooFewBlindedHops_meth = (*env)->GetMethodID(env, LDKSendError_TooFewBlindedHops_class, "<init>", "()V");
15224         CHECK(LDKSendError_TooFewBlindedHops_meth != NULL);
15225         LDKSendError_InvalidFirstHop_class =
15226                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$InvalidFirstHop"));
15227         CHECK(LDKSendError_InvalidFirstHop_class != NULL);
15228         LDKSendError_InvalidFirstHop_meth = (*env)->GetMethodID(env, LDKSendError_InvalidFirstHop_class, "<init>", "([B)V");
15229         CHECK(LDKSendError_InvalidFirstHop_meth != NULL);
15230         LDKSendError_PathNotFound_class =
15231                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$PathNotFound"));
15232         CHECK(LDKSendError_PathNotFound_class != NULL);
15233         LDKSendError_PathNotFound_meth = (*env)->GetMethodID(env, LDKSendError_PathNotFound_class, "<init>", "()V");
15234         CHECK(LDKSendError_PathNotFound_meth != NULL);
15235         LDKSendError_InvalidMessage_class =
15236                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$InvalidMessage"));
15237         CHECK(LDKSendError_InvalidMessage_class != NULL);
15238         LDKSendError_InvalidMessage_meth = (*env)->GetMethodID(env, LDKSendError_InvalidMessage_class, "<init>", "()V");
15239         CHECK(LDKSendError_InvalidMessage_meth != NULL);
15240         LDKSendError_BufferFull_class =
15241                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$BufferFull"));
15242         CHECK(LDKSendError_BufferFull_class != NULL);
15243         LDKSendError_BufferFull_meth = (*env)->GetMethodID(env, LDKSendError_BufferFull_class, "<init>", "()V");
15244         CHECK(LDKSendError_BufferFull_meth != NULL);
15245         LDKSendError_GetNodeIdFailed_class =
15246                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$GetNodeIdFailed"));
15247         CHECK(LDKSendError_GetNodeIdFailed_class != NULL);
15248         LDKSendError_GetNodeIdFailed_meth = (*env)->GetMethodID(env, LDKSendError_GetNodeIdFailed_class, "<init>", "()V");
15249         CHECK(LDKSendError_GetNodeIdFailed_meth != NULL);
15250         LDKSendError_BlindedPathAdvanceFailed_class =
15251                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$BlindedPathAdvanceFailed"));
15252         CHECK(LDKSendError_BlindedPathAdvanceFailed_class != NULL);
15253         LDKSendError_BlindedPathAdvanceFailed_meth = (*env)->GetMethodID(env, LDKSendError_BlindedPathAdvanceFailed_class, "<init>", "()V");
15254         CHECK(LDKSendError_BlindedPathAdvanceFailed_meth != NULL);
15255 }
15256 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSendError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
15257         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
15258         switch(obj->tag) {
15259                 case LDKSendError_Secp256k1: {
15260                         jclass secp256k1_conv = LDKSecp256k1Error_to_java(env, obj->secp256k1);
15261                         return (*env)->NewObject(env, LDKSendError_Secp256k1_class, LDKSendError_Secp256k1_meth, secp256k1_conv);
15262                 }
15263                 case LDKSendError_TooBigPacket: {
15264                         return (*env)->NewObject(env, LDKSendError_TooBigPacket_class, LDKSendError_TooBigPacket_meth);
15265                 }
15266                 case LDKSendError_TooFewBlindedHops: {
15267                         return (*env)->NewObject(env, LDKSendError_TooFewBlindedHops_class, LDKSendError_TooFewBlindedHops_meth);
15268                 }
15269                 case LDKSendError_InvalidFirstHop: {
15270                         int8_tArray invalid_first_hop_arr = (*env)->NewByteArray(env, 33);
15271                         (*env)->SetByteArrayRegion(env, invalid_first_hop_arr, 0, 33, obj->invalid_first_hop.compressed_form);
15272                         return (*env)->NewObject(env, LDKSendError_InvalidFirstHop_class, LDKSendError_InvalidFirstHop_meth, invalid_first_hop_arr);
15273                 }
15274                 case LDKSendError_PathNotFound: {
15275                         return (*env)->NewObject(env, LDKSendError_PathNotFound_class, LDKSendError_PathNotFound_meth);
15276                 }
15277                 case LDKSendError_InvalidMessage: {
15278                         return (*env)->NewObject(env, LDKSendError_InvalidMessage_class, LDKSendError_InvalidMessage_meth);
15279                 }
15280                 case LDKSendError_BufferFull: {
15281                         return (*env)->NewObject(env, LDKSendError_BufferFull_class, LDKSendError_BufferFull_meth);
15282                 }
15283                 case LDKSendError_GetNodeIdFailed: {
15284                         return (*env)->NewObject(env, LDKSendError_GetNodeIdFailed_class, LDKSendError_GetNodeIdFailed_meth);
15285                 }
15286                 case LDKSendError_BlindedPathAdvanceFailed: {
15287                         return (*env)->NewObject(env, LDKSendError_BlindedPathAdvanceFailed_class, LDKSendError_BlindedPathAdvanceFailed_meth);
15288                 }
15289                 default: abort();
15290         }
15291 }
15292 static inline struct LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_ok(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ *NONNULL_PTR owner){
15293 CHECK(owner->result_ok);
15294         return C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(&*owner->contents.result);
15295 }
15296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZSendErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15297         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* owner_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(owner);
15298         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
15299         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_ok(owner_conv);
15300         return tag_ptr(ret_conv, true);
15301 }
15302
15303 static inline struct LDKSendError CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_err(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ *NONNULL_PTR owner){
15304 CHECK(!owner->result_ok);
15305         return SendError_clone(&*owner->contents.err);
15306 }
15307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZSendErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15308         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* owner_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(owner);
15309         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
15310         *ret_copy = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_err(owner_conv);
15311         int64_t ret_ref = tag_ptr(ret_copy, true);
15312         return ret_ref;
15313 }
15314
15315 static jclass LDKParsedOnionMessageContents_Offers_class = NULL;
15316 static jmethodID LDKParsedOnionMessageContents_Offers_meth = NULL;
15317 static jclass LDKParsedOnionMessageContents_Custom_class = NULL;
15318 static jmethodID LDKParsedOnionMessageContents_Custom_meth = NULL;
15319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKParsedOnionMessageContents_init (JNIEnv *env, jclass clz) {
15320         LDKParsedOnionMessageContents_Offers_class =
15321                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParsedOnionMessageContents$Offers"));
15322         CHECK(LDKParsedOnionMessageContents_Offers_class != NULL);
15323         LDKParsedOnionMessageContents_Offers_meth = (*env)->GetMethodID(env, LDKParsedOnionMessageContents_Offers_class, "<init>", "(J)V");
15324         CHECK(LDKParsedOnionMessageContents_Offers_meth != NULL);
15325         LDKParsedOnionMessageContents_Custom_class =
15326                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParsedOnionMessageContents$Custom"));
15327         CHECK(LDKParsedOnionMessageContents_Custom_class != NULL);
15328         LDKParsedOnionMessageContents_Custom_meth = (*env)->GetMethodID(env, LDKParsedOnionMessageContents_Custom_class, "<init>", "(J)V");
15329         CHECK(LDKParsedOnionMessageContents_Custom_meth != NULL);
15330 }
15331 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParsedOnionMessageContents_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
15332         LDKParsedOnionMessageContents *obj = (LDKParsedOnionMessageContents*)untag_ptr(ptr);
15333         switch(obj->tag) {
15334                 case LDKParsedOnionMessageContents_Offers: {
15335                         int64_t offers_ref = tag_ptr(&obj->offers, false);
15336                         return (*env)->NewObject(env, LDKParsedOnionMessageContents_Offers_class, LDKParsedOnionMessageContents_Offers_meth, offers_ref);
15337                 }
15338                 case LDKParsedOnionMessageContents_Custom: {
15339                         LDKOnionMessageContents* custom_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
15340                         *custom_ret = OnionMessageContents_clone(&obj->custom);
15341                         return (*env)->NewObject(env, LDKParsedOnionMessageContents_Custom_class, LDKParsedOnionMessageContents_Custom_meth, tag_ptr(custom_ret, true));
15342                 }
15343                 default: abort();
15344         }
15345 }
15346 static jclass LDKPeeledOnion_Forward_class = NULL;
15347 static jmethodID LDKPeeledOnion_Forward_meth = NULL;
15348 static jclass LDKPeeledOnion_Receive_class = NULL;
15349 static jmethodID LDKPeeledOnion_Receive_meth = NULL;
15350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPeeledOnion_init (JNIEnv *env, jclass clz) {
15351         LDKPeeledOnion_Forward_class =
15352                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPeeledOnion$Forward"));
15353         CHECK(LDKPeeledOnion_Forward_class != NULL);
15354         LDKPeeledOnion_Forward_meth = (*env)->GetMethodID(env, LDKPeeledOnion_Forward_class, "<init>", "([BJ)V");
15355         CHECK(LDKPeeledOnion_Forward_meth != NULL);
15356         LDKPeeledOnion_Receive_class =
15357                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPeeledOnion$Receive"));
15358         CHECK(LDKPeeledOnion_Receive_class != NULL);
15359         LDKPeeledOnion_Receive_meth = (*env)->GetMethodID(env, LDKPeeledOnion_Receive_class, "<init>", "(J[BJ)V");
15360         CHECK(LDKPeeledOnion_Receive_meth != NULL);
15361 }
15362 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPeeledOnion_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
15363         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
15364         switch(obj->tag) {
15365                 case LDKPeeledOnion_Forward: {
15366                         int8_tArray _0_arr = (*env)->NewByteArray(env, 33);
15367                         (*env)->SetByteArrayRegion(env, _0_arr, 0, 33, obj->forward._0.compressed_form);
15368                         LDKOnionMessage _1_var = obj->forward._1;
15369                         int64_t _1_ref = 0;
15370                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_1_var);
15371                         _1_ref = tag_ptr(_1_var.inner, false);
15372                         return (*env)->NewObject(env, LDKPeeledOnion_Forward_class, LDKPeeledOnion_Forward_meth, _0_arr, _1_ref);
15373                 }
15374                 case LDKPeeledOnion_Receive: {
15375                         int64_t _0_ref = tag_ptr(&obj->receive._0, false);
15376                         int8_tArray _1_arr = (*env)->NewByteArray(env, 32);
15377                         (*env)->SetByteArrayRegion(env, _1_arr, 0, 32, obj->receive._1.data);
15378                         LDKBlindedPath _2_var = obj->receive._2;
15379                         int64_t _2_ref = 0;
15380                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_2_var);
15381                         _2_ref = tag_ptr(_2_var.inner, false);
15382                         return (*env)->NewObject(env, LDKPeeledOnion_Receive_class, LDKPeeledOnion_Receive_meth, _0_ref, _1_arr, _2_ref);
15383                 }
15384                 default: abort();
15385         }
15386 }
15387 static inline struct LDKPeeledOnion CResult_PeeledOnionNoneZ_get_ok(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR owner){
15388 CHECK(owner->result_ok);
15389         return PeeledOnion_clone(&*owner->contents.result);
15390 }
15391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15392         LDKCResult_PeeledOnionNoneZ* owner_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(owner);
15393         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
15394         *ret_copy = CResult_PeeledOnionNoneZ_get_ok(owner_conv);
15395         int64_t ret_ref = tag_ptr(ret_copy, true);
15396         return ret_ref;
15397 }
15398
15399 static inline void CResult_PeeledOnionNoneZ_get_err(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR owner){
15400 CHECK(!owner->result_ok);
15401         return *owner->contents.err;
15402 }
15403 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15404         LDKCResult_PeeledOnionNoneZ* owner_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(owner);
15405         CResult_PeeledOnionNoneZ_get_err(owner_conv);
15406 }
15407
15408 static jclass LDKSendSuccess_Buffered_class = NULL;
15409 static jmethodID LDKSendSuccess_Buffered_meth = NULL;
15410 static jclass LDKSendSuccess_BufferedAwaitingConnection_class = NULL;
15411 static jmethodID LDKSendSuccess_BufferedAwaitingConnection_meth = NULL;
15412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSendSuccess_init (JNIEnv *env, jclass clz) {
15413         LDKSendSuccess_Buffered_class =
15414                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendSuccess$Buffered"));
15415         CHECK(LDKSendSuccess_Buffered_class != NULL);
15416         LDKSendSuccess_Buffered_meth = (*env)->GetMethodID(env, LDKSendSuccess_Buffered_class, "<init>", "()V");
15417         CHECK(LDKSendSuccess_Buffered_meth != NULL);
15418         LDKSendSuccess_BufferedAwaitingConnection_class =
15419                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendSuccess$BufferedAwaitingConnection"));
15420         CHECK(LDKSendSuccess_BufferedAwaitingConnection_class != NULL);
15421         LDKSendSuccess_BufferedAwaitingConnection_meth = (*env)->GetMethodID(env, LDKSendSuccess_BufferedAwaitingConnection_class, "<init>", "([B)V");
15422         CHECK(LDKSendSuccess_BufferedAwaitingConnection_meth != NULL);
15423 }
15424 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSendSuccess_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
15425         LDKSendSuccess *obj = (LDKSendSuccess*)untag_ptr(ptr);
15426         switch(obj->tag) {
15427                 case LDKSendSuccess_Buffered: {
15428                         return (*env)->NewObject(env, LDKSendSuccess_Buffered_class, LDKSendSuccess_Buffered_meth);
15429                 }
15430                 case LDKSendSuccess_BufferedAwaitingConnection: {
15431                         int8_tArray buffered_awaiting_connection_arr = (*env)->NewByteArray(env, 33);
15432                         (*env)->SetByteArrayRegion(env, buffered_awaiting_connection_arr, 0, 33, obj->buffered_awaiting_connection.compressed_form);
15433                         return (*env)->NewObject(env, LDKSendSuccess_BufferedAwaitingConnection_class, LDKSendSuccess_BufferedAwaitingConnection_meth, buffered_awaiting_connection_arr);
15434                 }
15435                 default: abort();
15436         }
15437 }
15438 static inline struct LDKSendSuccess CResult_SendSuccessSendErrorZ_get_ok(LDKCResult_SendSuccessSendErrorZ *NONNULL_PTR owner){
15439 CHECK(owner->result_ok);
15440         return SendSuccess_clone(&*owner->contents.result);
15441 }
15442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SendSuccessSendErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15443         LDKCResult_SendSuccessSendErrorZ* owner_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(owner);
15444         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
15445         *ret_copy = CResult_SendSuccessSendErrorZ_get_ok(owner_conv);
15446         int64_t ret_ref = tag_ptr(ret_copy, true);
15447         return ret_ref;
15448 }
15449
15450 static inline struct LDKSendError CResult_SendSuccessSendErrorZ_get_err(LDKCResult_SendSuccessSendErrorZ *NONNULL_PTR owner){
15451 CHECK(!owner->result_ok);
15452         return SendError_clone(&*owner->contents.err);
15453 }
15454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SendSuccessSendErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15455         LDKCResult_SendSuccessSendErrorZ* owner_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(owner);
15456         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
15457         *ret_copy = CResult_SendSuccessSendErrorZ_get_err(owner_conv);
15458         int64_t ret_ref = tag_ptr(ret_copy, true);
15459         return ret_ref;
15460 }
15461
15462 static inline struct LDKBlindedPath CResult_BlindedPathNoneZ_get_ok(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
15463         LDKBlindedPath ret = *owner->contents.result;
15464         ret.is_owned = false;
15465         return ret;
15466 }
15467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15468         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
15469         LDKBlindedPath ret_var = CResult_BlindedPathNoneZ_get_ok(owner_conv);
15470         int64_t ret_ref = 0;
15471         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15472         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15473         return ret_ref;
15474 }
15475
15476 static inline void CResult_BlindedPathNoneZ_get_err(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
15477 CHECK(!owner->result_ok);
15478         return *owner->contents.err;
15479 }
15480 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15481         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
15482         CResult_BlindedPathNoneZ_get_err(owner_conv);
15483 }
15484
15485 static inline struct LDKC2Tuple_BlindedPayInfoBlindedPathZ CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR owner){
15486 CHECK(owner->result_ok);
15487         return C2Tuple_BlindedPayInfoBlindedPathZ_clone(&*owner->contents.result);
15488 }
15489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15490         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* owner_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(owner);
15491         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
15492         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(owner_conv);
15493         return tag_ptr(ret_conv, true);
15494 }
15495
15496 static inline void CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR owner){
15497 CHECK(!owner->result_ok);
15498         return *owner->contents.err;
15499 }
15500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15501         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* owner_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(owner);
15502         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(owner_conv);
15503 }
15504
15505 static inline LDKCVec_ForwardNodeZ CVec_ForwardNodeZ_clone(const LDKCVec_ForwardNodeZ *orig) {
15506         LDKCVec_ForwardNodeZ ret = { .data = MALLOC(sizeof(LDKForwardNode) * orig->datalen, "LDKCVec_ForwardNodeZ clone bytes"), .datalen = orig->datalen };
15507         for (size_t i = 0; i < ret.datalen; i++) {
15508                 ret.data[i] = ForwardNode_clone(&orig->data[i]);
15509         }
15510         return ret;
15511 }
15512 static inline struct LDKBlindedPath CResult_BlindedPathDecodeErrorZ_get_ok(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
15513         LDKBlindedPath ret = *owner->contents.result;
15514         ret.is_owned = false;
15515         return ret;
15516 }
15517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15518         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
15519         LDKBlindedPath ret_var = CResult_BlindedPathDecodeErrorZ_get_ok(owner_conv);
15520         int64_t ret_ref = 0;
15521         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15522         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15523         return ret_ref;
15524 }
15525
15526 static inline struct LDKDecodeError CResult_BlindedPathDecodeErrorZ_get_err(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
15527 CHECK(!owner->result_ok);
15528         return DecodeError_clone(&*owner->contents.err);
15529 }
15530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15531         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
15532         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
15533         *ret_copy = CResult_BlindedPathDecodeErrorZ_get_err(owner_conv);
15534         int64_t ret_ref = tag_ptr(ret_copy, true);
15535         return ret_ref;
15536 }
15537
15538 static inline struct LDKBlindedHop CResult_BlindedHopDecodeErrorZ_get_ok(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
15539         LDKBlindedHop ret = *owner->contents.result;
15540         ret.is_owned = false;
15541         return ret;
15542 }
15543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15544         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
15545         LDKBlindedHop ret_var = CResult_BlindedHopDecodeErrorZ_get_ok(owner_conv);
15546         int64_t ret_ref = 0;
15547         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15548         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15549         return ret_ref;
15550 }
15551
15552 static inline struct LDKDecodeError CResult_BlindedHopDecodeErrorZ_get_err(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
15553 CHECK(!owner->result_ok);
15554         return DecodeError_clone(&*owner->contents.err);
15555 }
15556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15557         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
15558         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
15559         *ret_copy = CResult_BlindedHopDecodeErrorZ_get_err(owner_conv);
15560         int64_t ret_ref = tag_ptr(ret_copy, true);
15561         return ret_ref;
15562 }
15563
15564 static inline struct LDKInvoiceError CResult_InvoiceErrorDecodeErrorZ_get_ok(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
15565         LDKInvoiceError ret = *owner->contents.result;
15566         ret.is_owned = false;
15567         return ret;
15568 }
15569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15570         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
15571         LDKInvoiceError ret_var = CResult_InvoiceErrorDecodeErrorZ_get_ok(owner_conv);
15572         int64_t ret_ref = 0;
15573         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15574         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15575         return ret_ref;
15576 }
15577
15578 static inline struct LDKDecodeError CResult_InvoiceErrorDecodeErrorZ_get_err(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
15579 CHECK(!owner->result_ok);
15580         return DecodeError_clone(&*owner->contents.err);
15581 }
15582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15583         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
15584         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
15585         *ret_copy = CResult_InvoiceErrorDecodeErrorZ_get_err(owner_conv);
15586         int64_t ret_ref = tag_ptr(ret_copy, true);
15587         return ret_ref;
15588 }
15589
15590 static inline struct LDKDelayedPaymentBasepoint CResult_DelayedPaymentBasepointDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR owner){
15591         LDKDelayedPaymentBasepoint ret = *owner->contents.result;
15592         ret.is_owned = false;
15593         return ret;
15594 }
15595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentBasepointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15596         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(owner);
15597         LDKDelayedPaymentBasepoint ret_var = CResult_DelayedPaymentBasepointDecodeErrorZ_get_ok(owner_conv);
15598         int64_t ret_ref = 0;
15599         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15600         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15601         return ret_ref;
15602 }
15603
15604 static inline struct LDKDecodeError CResult_DelayedPaymentBasepointDecodeErrorZ_get_err(LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR owner){
15605 CHECK(!owner->result_ok);
15606         return DecodeError_clone(&*owner->contents.err);
15607 }
15608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentBasepointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15609         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(owner);
15610         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
15611         *ret_copy = CResult_DelayedPaymentBasepointDecodeErrorZ_get_err(owner_conv);
15612         int64_t ret_ref = tag_ptr(ret_copy, true);
15613         return ret_ref;
15614 }
15615
15616 static inline struct LDKDelayedPaymentKey CResult_DelayedPaymentKeyDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR owner){
15617         LDKDelayedPaymentKey ret = *owner->contents.result;
15618         ret.is_owned = false;
15619         return ret;
15620 }
15621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentKeyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15622         LDKCResult_DelayedPaymentKeyDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(owner);
15623         LDKDelayedPaymentKey ret_var = CResult_DelayedPaymentKeyDecodeErrorZ_get_ok(owner_conv);
15624         int64_t ret_ref = 0;
15625         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15626         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15627         return ret_ref;
15628 }
15629
15630 static inline struct LDKDecodeError CResult_DelayedPaymentKeyDecodeErrorZ_get_err(LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR owner){
15631 CHECK(!owner->result_ok);
15632         return DecodeError_clone(&*owner->contents.err);
15633 }
15634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentKeyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15635         LDKCResult_DelayedPaymentKeyDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(owner);
15636         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
15637         *ret_copy = CResult_DelayedPaymentKeyDecodeErrorZ_get_err(owner_conv);
15638         int64_t ret_ref = tag_ptr(ret_copy, true);
15639         return ret_ref;
15640 }
15641
15642 static inline struct LDKHtlcBasepoint CResult_HtlcBasepointDecodeErrorZ_get_ok(LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR owner){
15643         LDKHtlcBasepoint ret = *owner->contents.result;
15644         ret.is_owned = false;
15645         return ret;
15646 }
15647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcBasepointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15648         LDKCResult_HtlcBasepointDecodeErrorZ* owner_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(owner);
15649         LDKHtlcBasepoint ret_var = CResult_HtlcBasepointDecodeErrorZ_get_ok(owner_conv);
15650         int64_t ret_ref = 0;
15651         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15652         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15653         return ret_ref;
15654 }
15655
15656 static inline struct LDKDecodeError CResult_HtlcBasepointDecodeErrorZ_get_err(LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR owner){
15657 CHECK(!owner->result_ok);
15658         return DecodeError_clone(&*owner->contents.err);
15659 }
15660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcBasepointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15661         LDKCResult_HtlcBasepointDecodeErrorZ* owner_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(owner);
15662         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
15663         *ret_copy = CResult_HtlcBasepointDecodeErrorZ_get_err(owner_conv);
15664         int64_t ret_ref = tag_ptr(ret_copy, true);
15665         return ret_ref;
15666 }
15667
15668 static inline struct LDKHtlcKey CResult_HtlcKeyDecodeErrorZ_get_ok(LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR owner){
15669         LDKHtlcKey ret = *owner->contents.result;
15670         ret.is_owned = false;
15671         return ret;
15672 }
15673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcKeyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15674         LDKCResult_HtlcKeyDecodeErrorZ* owner_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(owner);
15675         LDKHtlcKey ret_var = CResult_HtlcKeyDecodeErrorZ_get_ok(owner_conv);
15676         int64_t ret_ref = 0;
15677         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15678         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15679         return ret_ref;
15680 }
15681
15682 static inline struct LDKDecodeError CResult_HtlcKeyDecodeErrorZ_get_err(LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR owner){
15683 CHECK(!owner->result_ok);
15684         return DecodeError_clone(&*owner->contents.err);
15685 }
15686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcKeyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15687         LDKCResult_HtlcKeyDecodeErrorZ* owner_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(owner);
15688         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
15689         *ret_copy = CResult_HtlcKeyDecodeErrorZ_get_err(owner_conv);
15690         int64_t ret_ref = tag_ptr(ret_copy, true);
15691         return ret_ref;
15692 }
15693
15694 static inline struct LDKRevocationBasepoint CResult_RevocationBasepointDecodeErrorZ_get_ok(LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR owner){
15695         LDKRevocationBasepoint ret = *owner->contents.result;
15696         ret.is_owned = false;
15697         return ret;
15698 }
15699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationBasepointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15700         LDKCResult_RevocationBasepointDecodeErrorZ* owner_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(owner);
15701         LDKRevocationBasepoint ret_var = CResult_RevocationBasepointDecodeErrorZ_get_ok(owner_conv);
15702         int64_t ret_ref = 0;
15703         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15704         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15705         return ret_ref;
15706 }
15707
15708 static inline struct LDKDecodeError CResult_RevocationBasepointDecodeErrorZ_get_err(LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR owner){
15709 CHECK(!owner->result_ok);
15710         return DecodeError_clone(&*owner->contents.err);
15711 }
15712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationBasepointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15713         LDKCResult_RevocationBasepointDecodeErrorZ* owner_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(owner);
15714         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
15715         *ret_copy = CResult_RevocationBasepointDecodeErrorZ_get_err(owner_conv);
15716         int64_t ret_ref = tag_ptr(ret_copy, true);
15717         return ret_ref;
15718 }
15719
15720 static inline struct LDKRevocationKey CResult_RevocationKeyDecodeErrorZ_get_ok(LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR owner){
15721         LDKRevocationKey ret = *owner->contents.result;
15722         ret.is_owned = false;
15723         return ret;
15724 }
15725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationKeyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15726         LDKCResult_RevocationKeyDecodeErrorZ* owner_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(owner);
15727         LDKRevocationKey ret_var = CResult_RevocationKeyDecodeErrorZ_get_ok(owner_conv);
15728         int64_t ret_ref = 0;
15729         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15730         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15731         return ret_ref;
15732 }
15733
15734 static inline struct LDKDecodeError CResult_RevocationKeyDecodeErrorZ_get_err(LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR owner){
15735 CHECK(!owner->result_ok);
15736         return DecodeError_clone(&*owner->contents.err);
15737 }
15738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationKeyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15739         LDKCResult_RevocationKeyDecodeErrorZ* owner_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(owner);
15740         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
15741         *ret_copy = CResult_RevocationKeyDecodeErrorZ_get_err(owner_conv);
15742         int64_t ret_ref = tag_ptr(ret_copy, true);
15743         return ret_ref;
15744 }
15745
15746 typedef struct LDKFilter_JCalls {
15747         atomic_size_t refcnt;
15748         JavaVM *vm;
15749         jweak o;
15750         jmethodID register_tx_meth;
15751         jmethodID register_output_meth;
15752 } LDKFilter_JCalls;
15753 static void LDKFilter_JCalls_free(void* this_arg) {
15754         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
15755         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15756                 JNIEnv *env;
15757                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15758                 if (get_jenv_res == JNI_EDETACHED) {
15759                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15760                 } else {
15761                         DO_ASSERT(get_jenv_res == JNI_OK);
15762                 }
15763                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
15764                 if (get_jenv_res == JNI_EDETACHED) {
15765                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15766                 }
15767                 FREE(j_calls);
15768         }
15769 }
15770 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
15771         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
15772         JNIEnv *env;
15773         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15774         if (get_jenv_res == JNI_EDETACHED) {
15775                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15776         } else {
15777                 DO_ASSERT(get_jenv_res == JNI_OK);
15778         }
15779         int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
15780         (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
15781         LDKu8slice script_pubkey_var = script_pubkey;
15782         int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
15783         (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
15784         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15785         CHECK(obj != NULL);
15786         (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
15787         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15788                 (*env)->ExceptionDescribe(env);
15789                 (*env)->FatalError(env, "A call to register_tx in LDKFilter from rust threw an exception.");
15790         }
15791         if (get_jenv_res == JNI_EDETACHED) {
15792                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15793         }
15794 }
15795 void register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
15796         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
15797         JNIEnv *env;
15798         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15799         if (get_jenv_res == JNI_EDETACHED) {
15800                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15801         } else {
15802                 DO_ASSERT(get_jenv_res == JNI_OK);
15803         }
15804         LDKWatchedOutput output_var = output;
15805         int64_t output_ref = 0;
15806         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
15807         output_ref = tag_ptr(output_var.inner, output_var.is_owned);
15808         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15809         CHECK(obj != NULL);
15810         (*env)->CallVoidMethod(env, obj, j_calls->register_output_meth, output_ref);
15811         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15812                 (*env)->ExceptionDescribe(env);
15813                 (*env)->FatalError(env, "A call to register_output in LDKFilter from rust threw an exception.");
15814         }
15815         if (get_jenv_res == JNI_EDETACHED) {
15816                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15817         }
15818 }
15819 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
15820         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
15821         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15822 }
15823 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
15824         jclass c = (*env)->GetObjectClass(env, o);
15825         CHECK(c != NULL);
15826         LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
15827         atomic_init(&calls->refcnt, 1);
15828         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
15829         calls->o = (*env)->NewWeakGlobalRef(env, o);
15830         calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
15831         CHECK(calls->register_tx_meth != NULL);
15832         calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J)V");
15833         CHECK(calls->register_output_meth != NULL);
15834
15835         LDKFilter ret = {
15836                 .this_arg = (void*) calls,
15837                 .register_tx = register_tx_LDKFilter_jcall,
15838                 .register_output = register_output_LDKFilter_jcall,
15839                 .free = LDKFilter_JCalls_free,
15840         };
15841         return ret;
15842 }
15843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
15844         LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
15845         *res_ptr = LDKFilter_init(env, clz, o);
15846         return tag_ptr(res_ptr, true);
15847 }
15848 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) {
15849         void* this_arg_ptr = untag_ptr(this_arg);
15850         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15851         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
15852         uint8_t txid_arr[32];
15853         CHECK((*env)->GetArrayLength(env, txid) == 32);
15854         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
15855         uint8_t (*txid_ref)[32] = &txid_arr;
15856         LDKu8slice script_pubkey_ref;
15857         script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
15858         script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
15859         (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
15860         (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
15861 }
15862
15863 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t output) {
15864         void* this_arg_ptr = untag_ptr(this_arg);
15865         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15866         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
15867         LDKWatchedOutput output_conv;
15868         output_conv.inner = untag_ptr(output);
15869         output_conv.is_owned = ptr_is_owned(output);
15870         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
15871         output_conv = WatchedOutput_clone(&output_conv);
15872         (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
15873 }
15874
15875 static jclass LDKCOption_FilterZ_Some_class = NULL;
15876 static jmethodID LDKCOption_FilterZ_Some_meth = NULL;
15877 static jclass LDKCOption_FilterZ_None_class = NULL;
15878 static jmethodID LDKCOption_FilterZ_None_meth = NULL;
15879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1FilterZ_init (JNIEnv *env, jclass clz) {
15880         LDKCOption_FilterZ_Some_class =
15881                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$Some"));
15882         CHECK(LDKCOption_FilterZ_Some_class != NULL);
15883         LDKCOption_FilterZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_Some_class, "<init>", "(J)V");
15884         CHECK(LDKCOption_FilterZ_Some_meth != NULL);
15885         LDKCOption_FilterZ_None_class =
15886                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$None"));
15887         CHECK(LDKCOption_FilterZ_None_class != NULL);
15888         LDKCOption_FilterZ_None_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_None_class, "<init>", "()V");
15889         CHECK(LDKCOption_FilterZ_None_meth != NULL);
15890 }
15891 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1FilterZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
15892         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
15893         switch(obj->tag) {
15894                 case LDKCOption_FilterZ_Some: {
15895                         LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
15896                         *some_ret = obj->some;
15897                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
15898                         if ((*some_ret).free == LDKFilter_JCalls_free) {
15899                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15900                                 LDKFilter_JCalls_cloned(&(*some_ret));
15901                         }
15902                         return (*env)->NewObject(env, LDKCOption_FilterZ_Some_class, LDKCOption_FilterZ_Some_meth, tag_ptr(some_ret, true));
15903                 }
15904                 case LDKCOption_FilterZ_None: {
15905                         return (*env)->NewObject(env, LDKCOption_FilterZ_None_class, LDKCOption_FilterZ_None_meth);
15906                 }
15907                 default: abort();
15908         }
15909 }
15910 static inline struct LDKLockedChannelMonitor CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
15911         LDKLockedChannelMonitor ret = *owner->contents.result;
15912         ret.is_owned = false;
15913         return ret;
15914 }
15915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15916         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
15917         LDKLockedChannelMonitor ret_var = CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
15918         int64_t ret_ref = 0;
15919         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15920         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15921         return ret_ref;
15922 }
15923
15924 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
15925 CHECK(!owner->result_ok);
15926         return *owner->contents.err;
15927 }
15928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15929         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
15930         CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
15931 }
15932
15933 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
15934         LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
15935         for (size_t i = 0; i < ret.datalen; i++) {
15936                 ret.data[i] = OutPoint_clone(&orig->data[i]);
15937         }
15938         return ret;
15939 }
15940 static inline LDKCVec_MonitorUpdateIdZ CVec_MonitorUpdateIdZ_clone(const LDKCVec_MonitorUpdateIdZ *orig) {
15941         LDKCVec_MonitorUpdateIdZ ret = { .data = MALLOC(sizeof(LDKMonitorUpdateId) * orig->datalen, "LDKCVec_MonitorUpdateIdZ clone bytes"), .datalen = orig->datalen };
15942         for (size_t i = 0; i < ret.datalen; i++) {
15943                 ret.data[i] = MonitorUpdateId_clone(&orig->data[i]);
15944         }
15945         return ret;
15946 }
15947 static inline struct LDKOutPoint C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
15948         LDKOutPoint ret = owner->a;
15949         ret.is_owned = false;
15950         return ret;
15951 }
15952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
15953         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
15954         LDKOutPoint ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(owner_conv);
15955         int64_t ret_ref = 0;
15956         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15957         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15958         return ret_ref;
15959 }
15960
15961 static inline struct LDKCVec_MonitorUpdateIdZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
15962         return CVec_MonitorUpdateIdZ_clone(&owner->b);
15963 }
15964 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
15965         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
15966         LDKCVec_MonitorUpdateIdZ ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(owner_conv);
15967         int64_tArray ret_arr = NULL;
15968         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
15969         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
15970         for (size_t r = 0; r < ret_var.datalen; r++) {
15971                 LDKMonitorUpdateId ret_conv_17_var = ret_var.data[r];
15972                 int64_t ret_conv_17_ref = 0;
15973                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_17_var);
15974                 ret_conv_17_ref = tag_ptr(ret_conv_17_var.inner, ret_conv_17_var.is_owned);
15975                 ret_arr_ptr[r] = ret_conv_17_ref;
15976         }
15977         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
15978         FREE(ret_var.data);
15979         return ret_arr;
15980 }
15981
15982 static inline LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_clone(const LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ *orig) {
15983         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ clone bytes"), .datalen = orig->datalen };
15984         for (size_t i = 0; i < ret.datalen; i++) {
15985                 ret.data[i] = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(&orig->data[i]);
15986         }
15987         return ret;
15988 }
15989 typedef struct LDKKVStore_JCalls {
15990         atomic_size_t refcnt;
15991         JavaVM *vm;
15992         jweak o;
15993         jmethodID read_meth;
15994         jmethodID write_meth;
15995         jmethodID remove_meth;
15996         jmethodID list_meth;
15997 } LDKKVStore_JCalls;
15998 static void LDKKVStore_JCalls_free(void* this_arg) {
15999         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
16000         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16001                 JNIEnv *env;
16002                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16003                 if (get_jenv_res == JNI_EDETACHED) {
16004                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16005                 } else {
16006                         DO_ASSERT(get_jenv_res == JNI_OK);
16007                 }
16008                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
16009                 if (get_jenv_res == JNI_EDETACHED) {
16010                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16011                 }
16012                 FREE(j_calls);
16013         }
16014 }
16015 LDKCResult_CVec_u8ZIOErrorZ read_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key) {
16016         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
16017         JNIEnv *env;
16018         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16019         if (get_jenv_res == JNI_EDETACHED) {
16020                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16021         } else {
16022                 DO_ASSERT(get_jenv_res == JNI_OK);
16023         }
16024         LDKStr primary_namespace_str = primary_namespace;
16025         jstring primary_namespace_conv = str_ref_to_java(env, primary_namespace_str.chars, primary_namespace_str.len);
16026         Str_free(primary_namespace_str);
16027         LDKStr secondary_namespace_str = secondary_namespace;
16028         jstring secondary_namespace_conv = str_ref_to_java(env, secondary_namespace_str.chars, secondary_namespace_str.len);
16029         Str_free(secondary_namespace_str);
16030         LDKStr key_str = key;
16031         jstring key_conv = str_ref_to_java(env, key_str.chars, key_str.len);
16032         Str_free(key_str);
16033         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16034         CHECK(obj != NULL);
16035         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_meth, primary_namespace_conv, secondary_namespace_conv, key_conv);
16036         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16037                 (*env)->ExceptionDescribe(env);
16038                 (*env)->FatalError(env, "A call to read in LDKKVStore from rust threw an exception.");
16039         }
16040         void* ret_ptr = untag_ptr(ret);
16041         CHECK_ACCESS(ret_ptr);
16042         LDKCResult_CVec_u8ZIOErrorZ ret_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(ret_ptr);
16043         FREE(untag_ptr(ret));
16044         if (get_jenv_res == JNI_EDETACHED) {
16045                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16046         }
16047         return ret_conv;
16048 }
16049 LDKCResult_NoneIOErrorZ write_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key, LDKu8slice buf) {
16050         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
16051         JNIEnv *env;
16052         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16053         if (get_jenv_res == JNI_EDETACHED) {
16054                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16055         } else {
16056                 DO_ASSERT(get_jenv_res == JNI_OK);
16057         }
16058         LDKStr primary_namespace_str = primary_namespace;
16059         jstring primary_namespace_conv = str_ref_to_java(env, primary_namespace_str.chars, primary_namespace_str.len);
16060         Str_free(primary_namespace_str);
16061         LDKStr secondary_namespace_str = secondary_namespace;
16062         jstring secondary_namespace_conv = str_ref_to_java(env, secondary_namespace_str.chars, secondary_namespace_str.len);
16063         Str_free(secondary_namespace_str);
16064         LDKStr key_str = key;
16065         jstring key_conv = str_ref_to_java(env, key_str.chars, key_str.len);
16066         Str_free(key_str);
16067         LDKu8slice buf_var = buf;
16068         int8_tArray buf_arr = (*env)->NewByteArray(env, buf_var.datalen);
16069         (*env)->SetByteArrayRegion(env, buf_arr, 0, buf_var.datalen, buf_var.data);
16070         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16071         CHECK(obj != NULL);
16072         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->write_meth, primary_namespace_conv, secondary_namespace_conv, key_conv, buf_arr);
16073         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16074                 (*env)->ExceptionDescribe(env);
16075                 (*env)->FatalError(env, "A call to write in LDKKVStore from rust threw an exception.");
16076         }
16077         void* ret_ptr = untag_ptr(ret);
16078         CHECK_ACCESS(ret_ptr);
16079         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
16080         FREE(untag_ptr(ret));
16081         if (get_jenv_res == JNI_EDETACHED) {
16082                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16083         }
16084         return ret_conv;
16085 }
16086 LDKCResult_NoneIOErrorZ remove_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key, bool lazy) {
16087         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
16088         JNIEnv *env;
16089         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16090         if (get_jenv_res == JNI_EDETACHED) {
16091                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16092         } else {
16093                 DO_ASSERT(get_jenv_res == JNI_OK);
16094         }
16095         LDKStr primary_namespace_str = primary_namespace;
16096         jstring primary_namespace_conv = str_ref_to_java(env, primary_namespace_str.chars, primary_namespace_str.len);
16097         Str_free(primary_namespace_str);
16098         LDKStr secondary_namespace_str = secondary_namespace;
16099         jstring secondary_namespace_conv = str_ref_to_java(env, secondary_namespace_str.chars, secondary_namespace_str.len);
16100         Str_free(secondary_namespace_str);
16101         LDKStr key_str = key;
16102         jstring key_conv = str_ref_to_java(env, key_str.chars, key_str.len);
16103         Str_free(key_str);
16104         jboolean lazy_conv = lazy;
16105         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16106         CHECK(obj != NULL);
16107         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->remove_meth, primary_namespace_conv, secondary_namespace_conv, key_conv, lazy_conv);
16108         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16109                 (*env)->ExceptionDescribe(env);
16110                 (*env)->FatalError(env, "A call to remove in LDKKVStore from rust threw an exception.");
16111         }
16112         void* ret_ptr = untag_ptr(ret);
16113         CHECK_ACCESS(ret_ptr);
16114         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
16115         FREE(untag_ptr(ret));
16116         if (get_jenv_res == JNI_EDETACHED) {
16117                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16118         }
16119         return ret_conv;
16120 }
16121 LDKCResult_CVec_StrZIOErrorZ list_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace) {
16122         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
16123         JNIEnv *env;
16124         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16125         if (get_jenv_res == JNI_EDETACHED) {
16126                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16127         } else {
16128                 DO_ASSERT(get_jenv_res == JNI_OK);
16129         }
16130         LDKStr primary_namespace_str = primary_namespace;
16131         jstring primary_namespace_conv = str_ref_to_java(env, primary_namespace_str.chars, primary_namespace_str.len);
16132         Str_free(primary_namespace_str);
16133         LDKStr secondary_namespace_str = secondary_namespace;
16134         jstring secondary_namespace_conv = str_ref_to_java(env, secondary_namespace_str.chars, secondary_namespace_str.len);
16135         Str_free(secondary_namespace_str);
16136         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16137         CHECK(obj != NULL);
16138         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->list_meth, primary_namespace_conv, secondary_namespace_conv);
16139         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16140                 (*env)->ExceptionDescribe(env);
16141                 (*env)->FatalError(env, "A call to list in LDKKVStore from rust threw an exception.");
16142         }
16143         void* ret_ptr = untag_ptr(ret);
16144         CHECK_ACCESS(ret_ptr);
16145         LDKCResult_CVec_StrZIOErrorZ ret_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(ret_ptr);
16146         FREE(untag_ptr(ret));
16147         if (get_jenv_res == JNI_EDETACHED) {
16148                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16149         }
16150         return ret_conv;
16151 }
16152 static void LDKKVStore_JCalls_cloned(LDKKVStore* new_obj) {
16153         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) new_obj->this_arg;
16154         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16155 }
16156 static inline LDKKVStore LDKKVStore_init (JNIEnv *env, jclass clz, jobject o) {
16157         jclass c = (*env)->GetObjectClass(env, o);
16158         CHECK(c != NULL);
16159         LDKKVStore_JCalls *calls = MALLOC(sizeof(LDKKVStore_JCalls), "LDKKVStore_JCalls");
16160         atomic_init(&calls->refcnt, 1);
16161         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
16162         calls->o = (*env)->NewWeakGlobalRef(env, o);
16163         calls->read_meth = (*env)->GetMethodID(env, c, "read", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)J");
16164         CHECK(calls->read_meth != NULL);
16165         calls->write_meth = (*env)->GetMethodID(env, c, "write", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[B)J");
16166         CHECK(calls->write_meth != NULL);
16167         calls->remove_meth = (*env)->GetMethodID(env, c, "remove", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Z)J");
16168         CHECK(calls->remove_meth != NULL);
16169         calls->list_meth = (*env)->GetMethodID(env, c, "list", "(Ljava/lang/String;Ljava/lang/String;)J");
16170         CHECK(calls->list_meth != NULL);
16171
16172         LDKKVStore ret = {
16173                 .this_arg = (void*) calls,
16174                 .read = read_LDKKVStore_jcall,
16175                 .write = write_LDKKVStore_jcall,
16176                 .remove = remove_LDKKVStore_jcall,
16177                 .list = list_LDKKVStore_jcall,
16178                 .free = LDKKVStore_JCalls_free,
16179         };
16180         return ret;
16181 }
16182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKVStore_1new(JNIEnv *env, jclass clz, jobject o) {
16183         LDKKVStore *res_ptr = MALLOC(sizeof(LDKKVStore), "LDKKVStore");
16184         *res_ptr = LDKKVStore_init(env, clz, o);
16185         return tag_ptr(res_ptr, true);
16186 }
16187 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) {
16188         void* this_arg_ptr = untag_ptr(this_arg);
16189         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16190         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
16191         LDKStr primary_namespace_conv = java_to_owned_str(env, primary_namespace);
16192         LDKStr secondary_namespace_conv = java_to_owned_str(env, secondary_namespace);
16193         LDKStr key_conv = java_to_owned_str(env, key);
16194         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
16195         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv);
16196         return tag_ptr(ret_conv, true);
16197 }
16198
16199 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) {
16200         void* this_arg_ptr = untag_ptr(this_arg);
16201         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16202         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
16203         LDKStr primary_namespace_conv = java_to_owned_str(env, primary_namespace);
16204         LDKStr secondary_namespace_conv = java_to_owned_str(env, secondary_namespace);
16205         LDKStr key_conv = java_to_owned_str(env, key);
16206         LDKu8slice buf_ref;
16207         buf_ref.datalen = (*env)->GetArrayLength(env, buf);
16208         buf_ref.data = (*env)->GetByteArrayElements (env, buf, NULL);
16209         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
16210         *ret_conv = (this_arg_conv->write)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv, buf_ref);
16211         (*env)->ReleaseByteArrayElements(env, buf, (int8_t*)buf_ref.data, 0);
16212         return tag_ptr(ret_conv, true);
16213 }
16214
16215 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) {
16216         void* this_arg_ptr = untag_ptr(this_arg);
16217         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16218         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
16219         LDKStr primary_namespace_conv = java_to_owned_str(env, primary_namespace);
16220         LDKStr secondary_namespace_conv = java_to_owned_str(env, secondary_namespace);
16221         LDKStr key_conv = java_to_owned_str(env, key);
16222         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
16223         *ret_conv = (this_arg_conv->remove)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv, lazy);
16224         return tag_ptr(ret_conv, true);
16225 }
16226
16227 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) {
16228         void* this_arg_ptr = untag_ptr(this_arg);
16229         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16230         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
16231         LDKStr primary_namespace_conv = java_to_owned_str(env, primary_namespace);
16232         LDKStr secondary_namespace_conv = java_to_owned_str(env, secondary_namespace);
16233         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
16234         *ret_conv = (this_arg_conv->list)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv);
16235         return tag_ptr(ret_conv, true);
16236 }
16237
16238 typedef struct LDKPersister_JCalls {
16239         atomic_size_t refcnt;
16240         JavaVM *vm;
16241         jweak o;
16242         jmethodID persist_manager_meth;
16243         jmethodID persist_graph_meth;
16244         jmethodID persist_scorer_meth;
16245 } LDKPersister_JCalls;
16246 static void LDKPersister_JCalls_free(void* this_arg) {
16247         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
16248         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16249                 JNIEnv *env;
16250                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16251                 if (get_jenv_res == JNI_EDETACHED) {
16252                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16253                 } else {
16254                         DO_ASSERT(get_jenv_res == JNI_OK);
16255                 }
16256                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
16257                 if (get_jenv_res == JNI_EDETACHED) {
16258                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16259                 }
16260                 FREE(j_calls);
16261         }
16262 }
16263 LDKCResult_NoneIOErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
16264         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
16265         JNIEnv *env;
16266         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16267         if (get_jenv_res == JNI_EDETACHED) {
16268                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16269         } else {
16270                 DO_ASSERT(get_jenv_res == JNI_OK);
16271         }
16272         LDKChannelManager channel_manager_var = *channel_manager;
16273         int64_t channel_manager_ref = 0;
16274         // WARNING: we may need a move here but no clone is available for LDKChannelManager
16275         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
16276         channel_manager_ref = tag_ptr(channel_manager_var.inner, channel_manager_var.is_owned);
16277         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16278         CHECK(obj != NULL);
16279         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
16280         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16281                 (*env)->ExceptionDescribe(env);
16282                 (*env)->FatalError(env, "A call to persist_manager in LDKPersister from rust threw an exception.");
16283         }
16284         void* ret_ptr = untag_ptr(ret);
16285         CHECK_ACCESS(ret_ptr);
16286         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
16287         FREE(untag_ptr(ret));
16288         if (get_jenv_res == JNI_EDETACHED) {
16289                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16290         }
16291         return ret_conv;
16292 }
16293 LDKCResult_NoneIOErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
16294         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
16295         JNIEnv *env;
16296         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16297         if (get_jenv_res == JNI_EDETACHED) {
16298                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16299         } else {
16300                 DO_ASSERT(get_jenv_res == JNI_OK);
16301         }
16302         LDKNetworkGraph network_graph_var = *network_graph;
16303         int64_t network_graph_ref = 0;
16304         // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
16305         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
16306         network_graph_ref = tag_ptr(network_graph_var.inner, network_graph_var.is_owned);
16307         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16308         CHECK(obj != NULL);
16309         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_graph_meth, network_graph_ref);
16310         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16311                 (*env)->ExceptionDescribe(env);
16312                 (*env)->FatalError(env, "A call to persist_graph in LDKPersister from rust threw an exception.");
16313         }
16314         void* ret_ptr = untag_ptr(ret);
16315         CHECK_ACCESS(ret_ptr);
16316         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
16317         FREE(untag_ptr(ret));
16318         if (get_jenv_res == JNI_EDETACHED) {
16319                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16320         }
16321         return ret_conv;
16322 }
16323 LDKCResult_NoneIOErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKWriteableScore * scorer) {
16324         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
16325         JNIEnv *env;
16326         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16327         if (get_jenv_res == JNI_EDETACHED) {
16328                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16329         } else {
16330                 DO_ASSERT(get_jenv_res == JNI_OK);
16331         }
16332         // WARNING: This object doesn't live past this scope, needs clone!
16333         int64_t ret_scorer = tag_ptr(scorer, false);
16334         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16335         CHECK(obj != NULL);
16336         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_scorer_meth, ret_scorer);
16337         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16338                 (*env)->ExceptionDescribe(env);
16339                 (*env)->FatalError(env, "A call to persist_scorer in LDKPersister from rust threw an exception.");
16340         }
16341         void* ret_ptr = untag_ptr(ret);
16342         CHECK_ACCESS(ret_ptr);
16343         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
16344         FREE(untag_ptr(ret));
16345         if (get_jenv_res == JNI_EDETACHED) {
16346                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16347         }
16348         return ret_conv;
16349 }
16350 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
16351         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
16352         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16353 }
16354 static inline LDKPersister LDKPersister_init (JNIEnv *env, jclass clz, jobject o) {
16355         jclass c = (*env)->GetObjectClass(env, o);
16356         CHECK(c != NULL);
16357         LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
16358         atomic_init(&calls->refcnt, 1);
16359         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
16360         calls->o = (*env)->NewWeakGlobalRef(env, o);
16361         calls->persist_manager_meth = (*env)->GetMethodID(env, c, "persist_manager", "(J)J");
16362         CHECK(calls->persist_manager_meth != NULL);
16363         calls->persist_graph_meth = (*env)->GetMethodID(env, c, "persist_graph", "(J)J");
16364         CHECK(calls->persist_graph_meth != NULL);
16365         calls->persist_scorer_meth = (*env)->GetMethodID(env, c, "persist_scorer", "(J)J");
16366         CHECK(calls->persist_scorer_meth != NULL);
16367
16368         LDKPersister ret = {
16369                 .this_arg = (void*) calls,
16370                 .persist_manager = persist_manager_LDKPersister_jcall,
16371                 .persist_graph = persist_graph_LDKPersister_jcall,
16372                 .persist_scorer = persist_scorer_LDKPersister_jcall,
16373                 .free = LDKPersister_JCalls_free,
16374         };
16375         return ret;
16376 }
16377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersister_1new(JNIEnv *env, jclass clz, jobject o) {
16378         LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
16379         *res_ptr = LDKPersister_init(env, clz, o);
16380         return tag_ptr(res_ptr, true);
16381 }
16382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1manager(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_manager) {
16383         void* this_arg_ptr = untag_ptr(this_arg);
16384         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16385         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
16386         LDKChannelManager channel_manager_conv;
16387         channel_manager_conv.inner = untag_ptr(channel_manager);
16388         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
16389         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
16390         channel_manager_conv.is_owned = false;
16391         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
16392         *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
16393         return tag_ptr(ret_conv, true);
16394 }
16395
16396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1graph(JNIEnv *env, jclass clz, int64_t this_arg, int64_t network_graph) {
16397         void* this_arg_ptr = untag_ptr(this_arg);
16398         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16399         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
16400         LDKNetworkGraph network_graph_conv;
16401         network_graph_conv.inner = untag_ptr(network_graph);
16402         network_graph_conv.is_owned = ptr_is_owned(network_graph);
16403         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
16404         network_graph_conv.is_owned = false;
16405         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
16406         *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
16407         return tag_ptr(ret_conv, true);
16408 }
16409
16410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1scorer(JNIEnv *env, jclass clz, int64_t this_arg, int64_t scorer) {
16411         void* this_arg_ptr = untag_ptr(this_arg);
16412         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16413         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
16414         void* scorer_ptr = untag_ptr(scorer);
16415         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
16416         LDKWriteableScore* scorer_conv = (LDKWriteableScore*)scorer_ptr;
16417         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
16418         *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, scorer_conv);
16419         return tag_ptr(ret_conv, true);
16420 }
16421
16422 typedef struct LDKPersist_JCalls {
16423         atomic_size_t refcnt;
16424         JavaVM *vm;
16425         jweak o;
16426         jmethodID persist_new_channel_meth;
16427         jmethodID update_persisted_channel_meth;
16428 } LDKPersist_JCalls;
16429 static void LDKPersist_JCalls_free(void* this_arg) {
16430         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
16431         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16432                 JNIEnv *env;
16433                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16434                 if (get_jenv_res == JNI_EDETACHED) {
16435                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16436                 } else {
16437                         DO_ASSERT(get_jenv_res == JNI_OK);
16438                 }
16439                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
16440                 if (get_jenv_res == JNI_EDETACHED) {
16441                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16442                 }
16443                 FREE(j_calls);
16444         }
16445 }
16446 LDKChannelMonitorUpdateStatus persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
16447         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
16448         JNIEnv *env;
16449         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16450         if (get_jenv_res == JNI_EDETACHED) {
16451                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16452         } else {
16453                 DO_ASSERT(get_jenv_res == JNI_OK);
16454         }
16455         LDKOutPoint channel_id_var = channel_id;
16456         int64_t channel_id_ref = 0;
16457         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
16458         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
16459         LDKChannelMonitor data_var = *data;
16460         int64_t data_ref = 0;
16461         data_var = ChannelMonitor_clone(&data_var);
16462         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
16463         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
16464         LDKMonitorUpdateId update_id_var = update_id;
16465         int64_t update_id_ref = 0;
16466         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
16467         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
16468         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16469         CHECK(obj != NULL);
16470         jclass ret = (*env)->CallObjectMethod(env, obj, j_calls->persist_new_channel_meth, channel_id_ref, data_ref, update_id_ref);
16471         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16472                 (*env)->ExceptionDescribe(env);
16473                 (*env)->FatalError(env, "A call to persist_new_channel in LDKPersist from rust threw an exception.");
16474         }
16475         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_java(env, ret);
16476         if (get_jenv_res == JNI_EDETACHED) {
16477                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16478         }
16479         return ret_conv;
16480 }
16481 LDKChannelMonitorUpdateStatus update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, LDKChannelMonitorUpdate update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
16482         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
16483         JNIEnv *env;
16484         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16485         if (get_jenv_res == JNI_EDETACHED) {
16486                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16487         } else {
16488                 DO_ASSERT(get_jenv_res == JNI_OK);
16489         }
16490         LDKOutPoint channel_id_var = channel_id;
16491         int64_t channel_id_ref = 0;
16492         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
16493         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
16494         LDKChannelMonitorUpdate update_var = update;
16495         int64_t update_ref = 0;
16496         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
16497         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
16498         LDKChannelMonitor data_var = *data;
16499         int64_t data_ref = 0;
16500         data_var = ChannelMonitor_clone(&data_var);
16501         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
16502         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
16503         LDKMonitorUpdateId update_id_var = update_id;
16504         int64_t update_id_ref = 0;
16505         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
16506         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
16507         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16508         CHECK(obj != NULL);
16509         jclass ret = (*env)->CallObjectMethod(env, obj, j_calls->update_persisted_channel_meth, channel_id_ref, update_ref, data_ref, update_id_ref);
16510         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16511                 (*env)->ExceptionDescribe(env);
16512                 (*env)->FatalError(env, "A call to update_persisted_channel in LDKPersist from rust threw an exception.");
16513         }
16514         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_java(env, ret);
16515         if (get_jenv_res == JNI_EDETACHED) {
16516                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16517         }
16518         return ret_conv;
16519 }
16520 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
16521         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
16522         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16523 }
16524 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
16525         jclass c = (*env)->GetObjectClass(env, o);
16526         CHECK(c != NULL);
16527         LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
16528         atomic_init(&calls->refcnt, 1);
16529         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
16530         calls->o = (*env)->NewWeakGlobalRef(env, o);
16531         calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJJ)Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
16532         CHECK(calls->persist_new_channel_meth != NULL);
16533         calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJJ)Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
16534         CHECK(calls->update_persisted_channel_meth != NULL);
16535
16536         LDKPersist ret = {
16537                 .this_arg = (void*) calls,
16538                 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
16539                 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
16540                 .free = LDKPersist_JCalls_free,
16541         };
16542         return ret;
16543 }
16544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
16545         LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
16546         *res_ptr = LDKPersist_init(env, clz, o);
16547         return tag_ptr(res_ptr, true);
16548 }
16549 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Persist_1persist_1new_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_id, int64_t data, int64_t update_id) {
16550         void* this_arg_ptr = untag_ptr(this_arg);
16551         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16552         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
16553         LDKOutPoint channel_id_conv;
16554         channel_id_conv.inner = untag_ptr(channel_id);
16555         channel_id_conv.is_owned = ptr_is_owned(channel_id);
16556         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
16557         channel_id_conv = OutPoint_clone(&channel_id_conv);
16558         LDKChannelMonitor data_conv;
16559         data_conv.inner = untag_ptr(data);
16560         data_conv.is_owned = ptr_is_owned(data);
16561         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
16562         data_conv.is_owned = false;
16563         LDKMonitorUpdateId update_id_conv;
16564         update_id_conv.inner = untag_ptr(update_id);
16565         update_id_conv.is_owned = ptr_is_owned(update_id);
16566         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
16567         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
16568         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_id_conv, &data_conv, update_id_conv));
16569         return ret_conv;
16570 }
16571
16572 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Persist_1update_1persisted_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_id, int64_t update, int64_t data, int64_t update_id) {
16573         void* this_arg_ptr = untag_ptr(this_arg);
16574         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16575         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
16576         LDKOutPoint channel_id_conv;
16577         channel_id_conv.inner = untag_ptr(channel_id);
16578         channel_id_conv.is_owned = ptr_is_owned(channel_id);
16579         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
16580         channel_id_conv = OutPoint_clone(&channel_id_conv);
16581         LDKChannelMonitorUpdate update_conv;
16582         update_conv.inner = untag_ptr(update);
16583         update_conv.is_owned = ptr_is_owned(update);
16584         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
16585         update_conv = ChannelMonitorUpdate_clone(&update_conv);
16586         LDKChannelMonitor data_conv;
16587         data_conv.inner = untag_ptr(data);
16588         data_conv.is_owned = ptr_is_owned(data);
16589         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
16590         data_conv.is_owned = false;
16591         LDKMonitorUpdateId update_id_conv;
16592         update_id_conv.inner = untag_ptr(update_id);
16593         update_id_conv.is_owned = ptr_is_owned(update_id);
16594         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
16595         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
16596         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, update_conv, &data_conv, update_id_conv));
16597         return ret_conv;
16598 }
16599
16600 typedef struct LDKFutureCallback_JCalls {
16601         atomic_size_t refcnt;
16602         JavaVM *vm;
16603         jweak o;
16604         jmethodID call_meth;
16605 } LDKFutureCallback_JCalls;
16606 static void LDKFutureCallback_JCalls_free(void* this_arg) {
16607         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
16608         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16609                 JNIEnv *env;
16610                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16611                 if (get_jenv_res == JNI_EDETACHED) {
16612                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16613                 } else {
16614                         DO_ASSERT(get_jenv_res == JNI_OK);
16615                 }
16616                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
16617                 if (get_jenv_res == JNI_EDETACHED) {
16618                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16619                 }
16620                 FREE(j_calls);
16621         }
16622 }
16623 void call_LDKFutureCallback_jcall(const void* this_arg) {
16624         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
16625         JNIEnv *env;
16626         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16627         if (get_jenv_res == JNI_EDETACHED) {
16628                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16629         } else {
16630                 DO_ASSERT(get_jenv_res == JNI_OK);
16631         }
16632         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16633         CHECK(obj != NULL);
16634         (*env)->CallVoidMethod(env, obj, j_calls->call_meth);
16635         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16636                 (*env)->ExceptionDescribe(env);
16637                 (*env)->FatalError(env, "A call to call in LDKFutureCallback from rust threw an exception.");
16638         }
16639         if (get_jenv_res == JNI_EDETACHED) {
16640                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16641         }
16642 }
16643 static void LDKFutureCallback_JCalls_cloned(LDKFutureCallback* new_obj) {
16644         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) new_obj->this_arg;
16645         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16646 }
16647 static inline LDKFutureCallback LDKFutureCallback_init (JNIEnv *env, jclass clz, jobject o) {
16648         jclass c = (*env)->GetObjectClass(env, o);
16649         CHECK(c != NULL);
16650         LDKFutureCallback_JCalls *calls = MALLOC(sizeof(LDKFutureCallback_JCalls), "LDKFutureCallback_JCalls");
16651         atomic_init(&calls->refcnt, 1);
16652         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
16653         calls->o = (*env)->NewWeakGlobalRef(env, o);
16654         calls->call_meth = (*env)->GetMethodID(env, c, "call", "()V");
16655         CHECK(calls->call_meth != NULL);
16656
16657         LDKFutureCallback ret = {
16658                 .this_arg = (void*) calls,
16659                 .call = call_LDKFutureCallback_jcall,
16660                 .free = LDKFutureCallback_JCalls_free,
16661         };
16662         return ret;
16663 }
16664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFutureCallback_1new(JNIEnv *env, jclass clz, jobject o) {
16665         LDKFutureCallback *res_ptr = MALLOC(sizeof(LDKFutureCallback), "LDKFutureCallback");
16666         *res_ptr = LDKFutureCallback_init(env, clz, o);
16667         return tag_ptr(res_ptr, true);
16668 }
16669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FutureCallback_1call(JNIEnv *env, jclass clz, int64_t this_arg) {
16670         void* this_arg_ptr = untag_ptr(this_arg);
16671         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16672         LDKFutureCallback* this_arg_conv = (LDKFutureCallback*)this_arg_ptr;
16673         (this_arg_conv->call)(this_arg_conv->this_arg);
16674 }
16675
16676 typedef struct LDKListen_JCalls {
16677         atomic_size_t refcnt;
16678         JavaVM *vm;
16679         jweak o;
16680         jmethodID filtered_block_connected_meth;
16681         jmethodID block_connected_meth;
16682         jmethodID block_disconnected_meth;
16683 } LDKListen_JCalls;
16684 static void LDKListen_JCalls_free(void* this_arg) {
16685         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
16686         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16687                 JNIEnv *env;
16688                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16689                 if (get_jenv_res == JNI_EDETACHED) {
16690                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16691                 } else {
16692                         DO_ASSERT(get_jenv_res == JNI_OK);
16693                 }
16694                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
16695                 if (get_jenv_res == JNI_EDETACHED) {
16696                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16697                 }
16698                 FREE(j_calls);
16699         }
16700 }
16701 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
16702         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
16703         JNIEnv *env;
16704         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16705         if (get_jenv_res == JNI_EDETACHED) {
16706                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16707         } else {
16708                 DO_ASSERT(get_jenv_res == JNI_OK);
16709         }
16710         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
16711         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
16712         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
16713         int64_tArray txdata_arr = NULL;
16714         txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
16715         int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
16716         for (size_t c = 0; c < txdata_var.datalen; c++) {
16717                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
16718                 *txdata_conv_28_conv = txdata_var.data[c];
16719                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
16720         }
16721         (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
16722         FREE(txdata_var.data);
16723         int32_t height_conv = height;
16724         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16725         CHECK(obj != NULL);
16726         (*env)->CallVoidMethod(env, obj, j_calls->filtered_block_connected_meth, header_arr, txdata_arr, height_conv);
16727         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16728                 (*env)->ExceptionDescribe(env);
16729                 (*env)->FatalError(env, "A call to filtered_block_connected in LDKListen from rust threw an exception.");
16730         }
16731         if (get_jenv_res == JNI_EDETACHED) {
16732                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16733         }
16734 }
16735 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
16736         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
16737         JNIEnv *env;
16738         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16739         if (get_jenv_res == JNI_EDETACHED) {
16740                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16741         } else {
16742                 DO_ASSERT(get_jenv_res == JNI_OK);
16743         }
16744         LDKu8slice block_var = block;
16745         int8_tArray block_arr = (*env)->NewByteArray(env, block_var.datalen);
16746         (*env)->SetByteArrayRegion(env, block_arr, 0, block_var.datalen, block_var.data);
16747         int32_t height_conv = height;
16748         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16749         CHECK(obj != NULL);
16750         (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height_conv);
16751         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16752                 (*env)->ExceptionDescribe(env);
16753                 (*env)->FatalError(env, "A call to block_connected in LDKListen from rust threw an exception.");
16754         }
16755         if (get_jenv_res == JNI_EDETACHED) {
16756                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16757         }
16758 }
16759 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
16760         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
16761         JNIEnv *env;
16762         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16763         if (get_jenv_res == JNI_EDETACHED) {
16764                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16765         } else {
16766                 DO_ASSERT(get_jenv_res == JNI_OK);
16767         }
16768         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
16769         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
16770         int32_t height_conv = height;
16771         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16772         CHECK(obj != NULL);
16773         (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height_conv);
16774         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16775                 (*env)->ExceptionDescribe(env);
16776                 (*env)->FatalError(env, "A call to block_disconnected in LDKListen from rust threw an exception.");
16777         }
16778         if (get_jenv_res == JNI_EDETACHED) {
16779                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16780         }
16781 }
16782 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
16783         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
16784         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16785 }
16786 static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) {
16787         jclass c = (*env)->GetObjectClass(env, o);
16788         CHECK(c != NULL);
16789         LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
16790         atomic_init(&calls->refcnt, 1);
16791         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
16792         calls->o = (*env)->NewWeakGlobalRef(env, o);
16793         calls->filtered_block_connected_meth = (*env)->GetMethodID(env, c, "filtered_block_connected", "([B[JI)V");
16794         CHECK(calls->filtered_block_connected_meth != NULL);
16795         calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BI)V");
16796         CHECK(calls->block_connected_meth != NULL);
16797         calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
16798         CHECK(calls->block_disconnected_meth != NULL);
16799
16800         LDKListen ret = {
16801                 .this_arg = (void*) calls,
16802                 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
16803                 .block_connected = block_connected_LDKListen_jcall,
16804                 .block_disconnected = block_disconnected_LDKListen_jcall,
16805                 .free = LDKListen_JCalls_free,
16806         };
16807         return ret;
16808 }
16809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKListen_1new(JNIEnv *env, jclass clz, jobject o) {
16810         LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
16811         *res_ptr = LDKListen_init(env, clz, o);
16812         return tag_ptr(res_ptr, true);
16813 }
16814 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) {
16815         void* this_arg_ptr = untag_ptr(this_arg);
16816         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16817         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
16818         uint8_t header_arr[80];
16819         CHECK((*env)->GetArrayLength(env, header) == 80);
16820         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
16821         uint8_t (*header_ref)[80] = &header_arr;
16822         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
16823         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
16824         if (txdata_constr.datalen > 0)
16825                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
16826         else
16827                 txdata_constr.data = NULL;
16828         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
16829         for (size_t c = 0; c < txdata_constr.datalen; c++) {
16830                 int64_t txdata_conv_28 = txdata_vals[c];
16831                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
16832                 CHECK_ACCESS(txdata_conv_28_ptr);
16833                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
16834                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
16835                 txdata_constr.data[c] = txdata_conv_28_conv;
16836         }
16837         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
16838         (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
16839 }
16840
16841 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) {
16842         void* this_arg_ptr = untag_ptr(this_arg);
16843         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16844         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
16845         LDKu8slice block_ref;
16846         block_ref.datalen = (*env)->GetArrayLength(env, block);
16847         block_ref.data = (*env)->GetByteArrayElements (env, block, NULL);
16848         (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
16849         (*env)->ReleaseByteArrayElements(env, block, (int8_t*)block_ref.data, 0);
16850 }
16851
16852 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) {
16853         void* this_arg_ptr = untag_ptr(this_arg);
16854         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16855         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
16856         uint8_t header_arr[80];
16857         CHECK((*env)->GetArrayLength(env, header) == 80);
16858         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
16859         uint8_t (*header_ref)[80] = &header_arr;
16860         (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
16861 }
16862
16863 typedef struct LDKConfirm_JCalls {
16864         atomic_size_t refcnt;
16865         JavaVM *vm;
16866         jweak o;
16867         jmethodID transactions_confirmed_meth;
16868         jmethodID transaction_unconfirmed_meth;
16869         jmethodID best_block_updated_meth;
16870         jmethodID get_relevant_txids_meth;
16871 } LDKConfirm_JCalls;
16872 static void LDKConfirm_JCalls_free(void* this_arg) {
16873         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
16874         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16875                 JNIEnv *env;
16876                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16877                 if (get_jenv_res == JNI_EDETACHED) {
16878                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16879                 } else {
16880                         DO_ASSERT(get_jenv_res == JNI_OK);
16881                 }
16882                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
16883                 if (get_jenv_res == JNI_EDETACHED) {
16884                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16885                 }
16886                 FREE(j_calls);
16887         }
16888 }
16889 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
16890         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
16891         JNIEnv *env;
16892         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16893         if (get_jenv_res == JNI_EDETACHED) {
16894                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16895         } else {
16896                 DO_ASSERT(get_jenv_res == JNI_OK);
16897         }
16898         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
16899         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
16900         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
16901         int64_tArray txdata_arr = NULL;
16902         txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
16903         int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
16904         for (size_t c = 0; c < txdata_var.datalen; c++) {
16905                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
16906                 *txdata_conv_28_conv = txdata_var.data[c];
16907                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
16908         }
16909         (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
16910         FREE(txdata_var.data);
16911         int32_t height_conv = height;
16912         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16913         CHECK(obj != NULL);
16914         (*env)->CallVoidMethod(env, obj, j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height_conv);
16915         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16916                 (*env)->ExceptionDescribe(env);
16917                 (*env)->FatalError(env, "A call to transactions_confirmed in LDKConfirm from rust threw an exception.");
16918         }
16919         if (get_jenv_res == JNI_EDETACHED) {
16920                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16921         }
16922 }
16923 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
16924         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
16925         JNIEnv *env;
16926         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16927         if (get_jenv_res == JNI_EDETACHED) {
16928                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16929         } else {
16930                 DO_ASSERT(get_jenv_res == JNI_OK);
16931         }
16932         int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
16933         (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
16934         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16935         CHECK(obj != NULL);
16936         (*env)->CallVoidMethod(env, obj, j_calls->transaction_unconfirmed_meth, txid_arr);
16937         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16938                 (*env)->ExceptionDescribe(env);
16939                 (*env)->FatalError(env, "A call to transaction_unconfirmed in LDKConfirm from rust threw an exception.");
16940         }
16941         if (get_jenv_res == JNI_EDETACHED) {
16942                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16943         }
16944 }
16945 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
16946         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
16947         JNIEnv *env;
16948         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16949         if (get_jenv_res == JNI_EDETACHED) {
16950                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16951         } else {
16952                 DO_ASSERT(get_jenv_res == JNI_OK);
16953         }
16954         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
16955         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
16956         int32_t height_conv = height;
16957         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16958         CHECK(obj != NULL);
16959         (*env)->CallVoidMethod(env, obj, j_calls->best_block_updated_meth, header_arr, height_conv);
16960         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16961                 (*env)->ExceptionDescribe(env);
16962                 (*env)->FatalError(env, "A call to best_block_updated in LDKConfirm from rust threw an exception.");
16963         }
16964         if (get_jenv_res == JNI_EDETACHED) {
16965                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16966         }
16967 }
16968 LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
16969         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
16970         JNIEnv *env;
16971         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16972         if (get_jenv_res == JNI_EDETACHED) {
16973                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16974         } else {
16975                 DO_ASSERT(get_jenv_res == JNI_OK);
16976         }
16977         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16978         CHECK(obj != NULL);
16979         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_relevant_txids_meth);
16980         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16981                 (*env)->ExceptionDescribe(env);
16982                 (*env)->FatalError(env, "A call to get_relevant_txids in LDKConfirm from rust threw an exception.");
16983         }
16984         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret_constr;
16985         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
16986         if (ret_constr.datalen > 0)
16987                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ Elements");
16988         else
16989                 ret_constr.data = NULL;
16990         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
16991         for (size_t c = 0; c < ret_constr.datalen; c++) {
16992                 int64_t ret_conv_54 = ret_vals[c];
16993                 void* ret_conv_54_ptr = untag_ptr(ret_conv_54);
16994                 CHECK_ACCESS(ret_conv_54_ptr);
16995                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ ret_conv_54_conv = *(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)(ret_conv_54_ptr);
16996                 FREE(untag_ptr(ret_conv_54));
16997                 ret_constr.data[c] = ret_conv_54_conv;
16998         }
16999         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
17000         if (get_jenv_res == JNI_EDETACHED) {
17001                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17002         }
17003         return ret_constr;
17004 }
17005 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
17006         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
17007         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17008 }
17009 static inline LDKConfirm LDKConfirm_init (JNIEnv *env, jclass clz, jobject o) {
17010         jclass c = (*env)->GetObjectClass(env, o);
17011         CHECK(c != NULL);
17012         LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
17013         atomic_init(&calls->refcnt, 1);
17014         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
17015         calls->o = (*env)->NewWeakGlobalRef(env, o);
17016         calls->transactions_confirmed_meth = (*env)->GetMethodID(env, c, "transactions_confirmed", "([B[JI)V");
17017         CHECK(calls->transactions_confirmed_meth != NULL);
17018         calls->transaction_unconfirmed_meth = (*env)->GetMethodID(env, c, "transaction_unconfirmed", "([B)V");
17019         CHECK(calls->transaction_unconfirmed_meth != NULL);
17020         calls->best_block_updated_meth = (*env)->GetMethodID(env, c, "best_block_updated", "([BI)V");
17021         CHECK(calls->best_block_updated_meth != NULL);
17022         calls->get_relevant_txids_meth = (*env)->GetMethodID(env, c, "get_relevant_txids", "()[J");
17023         CHECK(calls->get_relevant_txids_meth != NULL);
17024
17025         LDKConfirm ret = {
17026                 .this_arg = (void*) calls,
17027                 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
17028                 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
17029                 .best_block_updated = best_block_updated_LDKConfirm_jcall,
17030                 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
17031                 .free = LDKConfirm_JCalls_free,
17032         };
17033         return ret;
17034 }
17035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKConfirm_1new(JNIEnv *env, jclass clz, jobject o) {
17036         LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
17037         *res_ptr = LDKConfirm_init(env, clz, o);
17038         return tag_ptr(res_ptr, true);
17039 }
17040 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) {
17041         void* this_arg_ptr = untag_ptr(this_arg);
17042         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17043         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
17044         uint8_t header_arr[80];
17045         CHECK((*env)->GetArrayLength(env, header) == 80);
17046         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
17047         uint8_t (*header_ref)[80] = &header_arr;
17048         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
17049         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
17050         if (txdata_constr.datalen > 0)
17051                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
17052         else
17053                 txdata_constr.data = NULL;
17054         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
17055         for (size_t c = 0; c < txdata_constr.datalen; c++) {
17056                 int64_t txdata_conv_28 = txdata_vals[c];
17057                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
17058                 CHECK_ACCESS(txdata_conv_28_ptr);
17059                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
17060                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
17061                 txdata_constr.data[c] = txdata_conv_28_conv;
17062         }
17063         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
17064         (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
17065 }
17066
17067 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid) {
17068         void* this_arg_ptr = untag_ptr(this_arg);
17069         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17070         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
17071         uint8_t txid_arr[32];
17072         CHECK((*env)->GetArrayLength(env, txid) == 32);
17073         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
17074         uint8_t (*txid_ref)[32] = &txid_arr;
17075         (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
17076 }
17077
17078 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) {
17079         void* this_arg_ptr = untag_ptr(this_arg);
17080         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17081         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
17082         uint8_t header_arr[80];
17083         CHECK((*env)->GetArrayLength(env, header) == 80);
17084         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
17085         uint8_t (*header_ref)[80] = &header_arr;
17086         (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
17087 }
17088
17089 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
17090         void* this_arg_ptr = untag_ptr(this_arg);
17091         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17092         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
17093         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
17094         int64_tArray ret_arr = NULL;
17095         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
17096         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
17097         for (size_t c = 0; c < ret_var.datalen; c++) {
17098                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv_54_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
17099                 *ret_conv_54_conv = ret_var.data[c];
17100                 ret_arr_ptr[c] = tag_ptr(ret_conv_54_conv, true);
17101         }
17102         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
17103         FREE(ret_var.data);
17104         return ret_arr;
17105 }
17106
17107 typedef struct LDKEventHandler_JCalls {
17108         atomic_size_t refcnt;
17109         JavaVM *vm;
17110         jweak o;
17111         jmethodID handle_event_meth;
17112 } LDKEventHandler_JCalls;
17113 static void LDKEventHandler_JCalls_free(void* this_arg) {
17114         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
17115         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17116                 JNIEnv *env;
17117                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17118                 if (get_jenv_res == JNI_EDETACHED) {
17119                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17120                 } else {
17121                         DO_ASSERT(get_jenv_res == JNI_OK);
17122                 }
17123                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
17124                 if (get_jenv_res == JNI_EDETACHED) {
17125                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17126                 }
17127                 FREE(j_calls);
17128         }
17129 }
17130 void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
17131         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
17132         JNIEnv *env;
17133         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17134         if (get_jenv_res == JNI_EDETACHED) {
17135                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17136         } else {
17137                 DO_ASSERT(get_jenv_res == JNI_OK);
17138         }
17139         LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
17140         *event_copy = event;
17141         int64_t event_ref = tag_ptr(event_copy, true);
17142         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17143         CHECK(obj != NULL);
17144         (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, event_ref);
17145         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17146                 (*env)->ExceptionDescribe(env);
17147                 (*env)->FatalError(env, "A call to handle_event in LDKEventHandler from rust threw an exception.");
17148         }
17149         if (get_jenv_res == JNI_EDETACHED) {
17150                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17151         }
17152 }
17153 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
17154         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
17155         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17156 }
17157 static inline LDKEventHandler LDKEventHandler_init (JNIEnv *env, jclass clz, jobject o) {
17158         jclass c = (*env)->GetObjectClass(env, o);
17159         CHECK(c != NULL);
17160         LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
17161         atomic_init(&calls->refcnt, 1);
17162         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
17163         calls->o = (*env)->NewWeakGlobalRef(env, o);
17164         calls->handle_event_meth = (*env)->GetMethodID(env, c, "handle_event", "(J)V");
17165         CHECK(calls->handle_event_meth != NULL);
17166
17167         LDKEventHandler ret = {
17168                 .this_arg = (void*) calls,
17169                 .handle_event = handle_event_LDKEventHandler_jcall,
17170                 .free = LDKEventHandler_JCalls_free,
17171         };
17172         return ret;
17173 }
17174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventHandler_1new(JNIEnv *env, jclass clz, jobject o) {
17175         LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
17176         *res_ptr = LDKEventHandler_init(env, clz, o);
17177         return tag_ptr(res_ptr, true);
17178 }
17179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
17180         void* this_arg_ptr = untag_ptr(this_arg);
17181         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17182         LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
17183         void* event_ptr = untag_ptr(event);
17184         CHECK_ACCESS(event_ptr);
17185         LDKEvent event_conv = *(LDKEvent*)(event_ptr);
17186         event_conv = Event_clone((LDKEvent*)untag_ptr(event));
17187         (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
17188 }
17189
17190 typedef struct LDKEventsProvider_JCalls {
17191         atomic_size_t refcnt;
17192         JavaVM *vm;
17193         jweak o;
17194         jmethodID process_pending_events_meth;
17195 } LDKEventsProvider_JCalls;
17196 static void LDKEventsProvider_JCalls_free(void* this_arg) {
17197         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
17198         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17199                 JNIEnv *env;
17200                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17201                 if (get_jenv_res == JNI_EDETACHED) {
17202                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17203                 } else {
17204                         DO_ASSERT(get_jenv_res == JNI_OK);
17205                 }
17206                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
17207                 if (get_jenv_res == JNI_EDETACHED) {
17208                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17209                 }
17210                 FREE(j_calls);
17211         }
17212 }
17213 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
17214         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
17215         JNIEnv *env;
17216         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17217         if (get_jenv_res == JNI_EDETACHED) {
17218                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17219         } else {
17220                 DO_ASSERT(get_jenv_res == JNI_OK);
17221         }
17222         LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
17223         *handler_ret = handler;
17224         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17225         CHECK(obj != NULL);
17226         (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, tag_ptr(handler_ret, true));
17227         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17228                 (*env)->ExceptionDescribe(env);
17229                 (*env)->FatalError(env, "A call to process_pending_events in LDKEventsProvider from rust threw an exception.");
17230         }
17231         if (get_jenv_res == JNI_EDETACHED) {
17232                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17233         }
17234 }
17235 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
17236         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
17237         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17238 }
17239 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
17240         jclass c = (*env)->GetObjectClass(env, o);
17241         CHECK(c != NULL);
17242         LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
17243         atomic_init(&calls->refcnt, 1);
17244         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
17245         calls->o = (*env)->NewWeakGlobalRef(env, o);
17246         calls->process_pending_events_meth = (*env)->GetMethodID(env, c, "process_pending_events", "(J)V");
17247         CHECK(calls->process_pending_events_meth != NULL);
17248
17249         LDKEventsProvider ret = {
17250                 .this_arg = (void*) calls,
17251                 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
17252                 .free = LDKEventsProvider_JCalls_free,
17253         };
17254         return ret;
17255 }
17256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
17257         LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
17258         *res_ptr = LDKEventsProvider_init(env, clz, o);
17259         return tag_ptr(res_ptr, true);
17260 }
17261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
17262         void* this_arg_ptr = untag_ptr(this_arg);
17263         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17264         LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
17265         void* handler_ptr = untag_ptr(handler);
17266         CHECK_ACCESS(handler_ptr);
17267         LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
17268         if (handler_conv.free == LDKEventHandler_JCalls_free) {
17269                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17270                 LDKEventHandler_JCalls_cloned(&handler_conv);
17271         }
17272         (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
17273 }
17274
17275 static jclass LDKFailureCode_TemporaryNodeFailure_class = NULL;
17276 static jmethodID LDKFailureCode_TemporaryNodeFailure_meth = NULL;
17277 static jclass LDKFailureCode_RequiredNodeFeatureMissing_class = NULL;
17278 static jmethodID LDKFailureCode_RequiredNodeFeatureMissing_meth = NULL;
17279 static jclass LDKFailureCode_IncorrectOrUnknownPaymentDetails_class = NULL;
17280 static jmethodID LDKFailureCode_IncorrectOrUnknownPaymentDetails_meth = NULL;
17281 static jclass LDKFailureCode_InvalidOnionPayload_class = NULL;
17282 static jmethodID LDKFailureCode_InvalidOnionPayload_meth = NULL;
17283 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFailureCode_init (JNIEnv *env, jclass clz) {
17284         LDKFailureCode_TemporaryNodeFailure_class =
17285                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFailureCode$TemporaryNodeFailure"));
17286         CHECK(LDKFailureCode_TemporaryNodeFailure_class != NULL);
17287         LDKFailureCode_TemporaryNodeFailure_meth = (*env)->GetMethodID(env, LDKFailureCode_TemporaryNodeFailure_class, "<init>", "()V");
17288         CHECK(LDKFailureCode_TemporaryNodeFailure_meth != NULL);
17289         LDKFailureCode_RequiredNodeFeatureMissing_class =
17290                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFailureCode$RequiredNodeFeatureMissing"));
17291         CHECK(LDKFailureCode_RequiredNodeFeatureMissing_class != NULL);
17292         LDKFailureCode_RequiredNodeFeatureMissing_meth = (*env)->GetMethodID(env, LDKFailureCode_RequiredNodeFeatureMissing_class, "<init>", "()V");
17293         CHECK(LDKFailureCode_RequiredNodeFeatureMissing_meth != NULL);
17294         LDKFailureCode_IncorrectOrUnknownPaymentDetails_class =
17295                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFailureCode$IncorrectOrUnknownPaymentDetails"));
17296         CHECK(LDKFailureCode_IncorrectOrUnknownPaymentDetails_class != NULL);
17297         LDKFailureCode_IncorrectOrUnknownPaymentDetails_meth = (*env)->GetMethodID(env, LDKFailureCode_IncorrectOrUnknownPaymentDetails_class, "<init>", "()V");
17298         CHECK(LDKFailureCode_IncorrectOrUnknownPaymentDetails_meth != NULL);
17299         LDKFailureCode_InvalidOnionPayload_class =
17300                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFailureCode$InvalidOnionPayload"));
17301         CHECK(LDKFailureCode_InvalidOnionPayload_class != NULL);
17302         LDKFailureCode_InvalidOnionPayload_meth = (*env)->GetMethodID(env, LDKFailureCode_InvalidOnionPayload_class, "<init>", "(J)V");
17303         CHECK(LDKFailureCode_InvalidOnionPayload_meth != NULL);
17304 }
17305 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFailureCode_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
17306         LDKFailureCode *obj = (LDKFailureCode*)untag_ptr(ptr);
17307         switch(obj->tag) {
17308                 case LDKFailureCode_TemporaryNodeFailure: {
17309                         return (*env)->NewObject(env, LDKFailureCode_TemporaryNodeFailure_class, LDKFailureCode_TemporaryNodeFailure_meth);
17310                 }
17311                 case LDKFailureCode_RequiredNodeFeatureMissing: {
17312                         return (*env)->NewObject(env, LDKFailureCode_RequiredNodeFeatureMissing_class, LDKFailureCode_RequiredNodeFeatureMissing_meth);
17313                 }
17314                 case LDKFailureCode_IncorrectOrUnknownPaymentDetails: {
17315                         return (*env)->NewObject(env, LDKFailureCode_IncorrectOrUnknownPaymentDetails_class, LDKFailureCode_IncorrectOrUnknownPaymentDetails_meth);
17316                 }
17317                 case LDKFailureCode_InvalidOnionPayload: {
17318                         int64_t invalid_onion_payload_ref = tag_ptr(&obj->invalid_onion_payload, false);
17319                         return (*env)->NewObject(env, LDKFailureCode_InvalidOnionPayload_class, LDKFailureCode_InvalidOnionPayload_meth, invalid_onion_payload_ref);
17320                 }
17321                 default: abort();
17322         }
17323 }
17324 typedef struct LDKMessageSendEventsProvider_JCalls {
17325         atomic_size_t refcnt;
17326         JavaVM *vm;
17327         jweak o;
17328         jmethodID get_and_clear_pending_msg_events_meth;
17329 } LDKMessageSendEventsProvider_JCalls;
17330 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
17331         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
17332         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17333                 JNIEnv *env;
17334                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17335                 if (get_jenv_res == JNI_EDETACHED) {
17336                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17337                 } else {
17338                         DO_ASSERT(get_jenv_res == JNI_OK);
17339                 }
17340                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
17341                 if (get_jenv_res == JNI_EDETACHED) {
17342                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17343                 }
17344                 FREE(j_calls);
17345         }
17346 }
17347 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
17348         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
17349         JNIEnv *env;
17350         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17351         if (get_jenv_res == JNI_EDETACHED) {
17352                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17353         } else {
17354                 DO_ASSERT(get_jenv_res == JNI_OK);
17355         }
17356         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17357         CHECK(obj != NULL);
17358         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
17359         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17360                 (*env)->ExceptionDescribe(env);
17361                 (*env)->FatalError(env, "A call to get_and_clear_pending_msg_events in LDKMessageSendEventsProvider from rust threw an exception.");
17362         }
17363         LDKCVec_MessageSendEventZ ret_constr;
17364         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
17365         if (ret_constr.datalen > 0)
17366                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
17367         else
17368                 ret_constr.data = NULL;
17369         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
17370         for (size_t s = 0; s < ret_constr.datalen; s++) {
17371                 int64_t ret_conv_18 = ret_vals[s];
17372                 void* ret_conv_18_ptr = untag_ptr(ret_conv_18);
17373                 CHECK_ACCESS(ret_conv_18_ptr);
17374                 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
17375                 FREE(untag_ptr(ret_conv_18));
17376                 ret_constr.data[s] = ret_conv_18_conv;
17377         }
17378         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
17379         if (get_jenv_res == JNI_EDETACHED) {
17380                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17381         }
17382         return ret_constr;
17383 }
17384 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
17385         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
17386         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17387 }
17388 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
17389         jclass c = (*env)->GetObjectClass(env, o);
17390         CHECK(c != NULL);
17391         LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
17392         atomic_init(&calls->refcnt, 1);
17393         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
17394         calls->o = (*env)->NewWeakGlobalRef(env, o);
17395         calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
17396         CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
17397
17398         LDKMessageSendEventsProvider ret = {
17399                 .this_arg = (void*) calls,
17400                 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
17401                 .free = LDKMessageSendEventsProvider_JCalls_free,
17402         };
17403         return ret;
17404 }
17405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
17406         LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
17407         *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
17408         return tag_ptr(res_ptr, true);
17409 }
17410 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
17411         void* this_arg_ptr = untag_ptr(this_arg);
17412         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17413         LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
17414         LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
17415         int64_tArray ret_arr = NULL;
17416         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
17417         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
17418         for (size_t s = 0; s < ret_var.datalen; s++) {
17419                 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
17420                 *ret_conv_18_copy = ret_var.data[s];
17421                 int64_t ret_conv_18_ref = tag_ptr(ret_conv_18_copy, true);
17422                 ret_arr_ptr[s] = ret_conv_18_ref;
17423         }
17424         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
17425         FREE(ret_var.data);
17426         return ret_arr;
17427 }
17428
17429 typedef struct LDKChannelMessageHandler_JCalls {
17430         atomic_size_t refcnt;
17431         JavaVM *vm;
17432         jweak o;
17433         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
17434         jmethodID handle_open_channel_meth;
17435         jmethodID handle_open_channel_v2_meth;
17436         jmethodID handle_accept_channel_meth;
17437         jmethodID handle_accept_channel_v2_meth;
17438         jmethodID handle_funding_created_meth;
17439         jmethodID handle_funding_signed_meth;
17440         jmethodID handle_channel_ready_meth;
17441         jmethodID handle_shutdown_meth;
17442         jmethodID handle_closing_signed_meth;
17443         jmethodID handle_stfu_meth;
17444         jmethodID handle_splice_meth;
17445         jmethodID handle_splice_ack_meth;
17446         jmethodID handle_splice_locked_meth;
17447         jmethodID handle_tx_add_input_meth;
17448         jmethodID handle_tx_add_output_meth;
17449         jmethodID handle_tx_remove_input_meth;
17450         jmethodID handle_tx_remove_output_meth;
17451         jmethodID handle_tx_complete_meth;
17452         jmethodID handle_tx_signatures_meth;
17453         jmethodID handle_tx_init_rbf_meth;
17454         jmethodID handle_tx_ack_rbf_meth;
17455         jmethodID handle_tx_abort_meth;
17456         jmethodID handle_update_add_htlc_meth;
17457         jmethodID handle_update_fulfill_htlc_meth;
17458         jmethodID handle_update_fail_htlc_meth;
17459         jmethodID handle_update_fail_malformed_htlc_meth;
17460         jmethodID handle_commitment_signed_meth;
17461         jmethodID handle_revoke_and_ack_meth;
17462         jmethodID handle_update_fee_meth;
17463         jmethodID handle_announcement_signatures_meth;
17464         jmethodID peer_disconnected_meth;
17465         jmethodID peer_connected_meth;
17466         jmethodID handle_channel_reestablish_meth;
17467         jmethodID handle_channel_update_meth;
17468         jmethodID handle_error_meth;
17469         jmethodID provided_node_features_meth;
17470         jmethodID provided_init_features_meth;
17471         jmethodID get_chain_hashes_meth;
17472 } LDKChannelMessageHandler_JCalls;
17473 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
17474         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17475         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17476                 JNIEnv *env;
17477                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17478                 if (get_jenv_res == JNI_EDETACHED) {
17479                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17480                 } else {
17481                         DO_ASSERT(get_jenv_res == JNI_OK);
17482                 }
17483                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
17484                 if (get_jenv_res == JNI_EDETACHED) {
17485                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17486                 }
17487                 FREE(j_calls);
17488         }
17489 }
17490 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannel * msg) {
17491         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17492         JNIEnv *env;
17493         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17494         if (get_jenv_res == JNI_EDETACHED) {
17495                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17496         } else {
17497                 DO_ASSERT(get_jenv_res == JNI_OK);
17498         }
17499         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17500         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17501         LDKOpenChannel msg_var = *msg;
17502         int64_t msg_ref = 0;
17503         msg_var = OpenChannel_clone(&msg_var);
17504         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17505         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17506         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17507         CHECK(obj != NULL);
17508         (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, msg_ref);
17509         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17510                 (*env)->ExceptionDescribe(env);
17511                 (*env)->FatalError(env, "A call to handle_open_channel in LDKChannelMessageHandler from rust threw an exception.");
17512         }
17513         if (get_jenv_res == JNI_EDETACHED) {
17514                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17515         }
17516 }
17517 void handle_open_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannelV2 * msg) {
17518         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17519         JNIEnv *env;
17520         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17521         if (get_jenv_res == JNI_EDETACHED) {
17522                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17523         } else {
17524                 DO_ASSERT(get_jenv_res == JNI_OK);
17525         }
17526         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17527         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17528         LDKOpenChannelV2 msg_var = *msg;
17529         int64_t msg_ref = 0;
17530         msg_var = OpenChannelV2_clone(&msg_var);
17531         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17532         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17533         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17534         CHECK(obj != NULL);
17535         (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_v2_meth, their_node_id_arr, msg_ref);
17536         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17537                 (*env)->ExceptionDescribe(env);
17538                 (*env)->FatalError(env, "A call to handle_open_channel_v2 in LDKChannelMessageHandler from rust threw an exception.");
17539         }
17540         if (get_jenv_res == JNI_EDETACHED) {
17541                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17542         }
17543 }
17544 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannel * msg) {
17545         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17546         JNIEnv *env;
17547         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17548         if (get_jenv_res == JNI_EDETACHED) {
17549                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17550         } else {
17551                 DO_ASSERT(get_jenv_res == JNI_OK);
17552         }
17553         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17554         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17555         LDKAcceptChannel msg_var = *msg;
17556         int64_t msg_ref = 0;
17557         msg_var = AcceptChannel_clone(&msg_var);
17558         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17559         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17560         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17561         CHECK(obj != NULL);
17562         (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, msg_ref);
17563         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17564                 (*env)->ExceptionDescribe(env);
17565                 (*env)->FatalError(env, "A call to handle_accept_channel in LDKChannelMessageHandler from rust threw an exception.");
17566         }
17567         if (get_jenv_res == JNI_EDETACHED) {
17568                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17569         }
17570 }
17571 void handle_accept_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannelV2 * msg) {
17572         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17573         JNIEnv *env;
17574         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17575         if (get_jenv_res == JNI_EDETACHED) {
17576                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17577         } else {
17578                 DO_ASSERT(get_jenv_res == JNI_OK);
17579         }
17580         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17581         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17582         LDKAcceptChannelV2 msg_var = *msg;
17583         int64_t msg_ref = 0;
17584         msg_var = AcceptChannelV2_clone(&msg_var);
17585         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17586         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17587         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17588         CHECK(obj != NULL);
17589         (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_v2_meth, their_node_id_arr, msg_ref);
17590         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17591                 (*env)->ExceptionDescribe(env);
17592                 (*env)->FatalError(env, "A call to handle_accept_channel_v2 in LDKChannelMessageHandler from rust threw an exception.");
17593         }
17594         if (get_jenv_res == JNI_EDETACHED) {
17595                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17596         }
17597 }
17598 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
17599         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17600         JNIEnv *env;
17601         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17602         if (get_jenv_res == JNI_EDETACHED) {
17603                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17604         } else {
17605                 DO_ASSERT(get_jenv_res == JNI_OK);
17606         }
17607         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17608         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17609         LDKFundingCreated msg_var = *msg;
17610         int64_t msg_ref = 0;
17611         msg_var = FundingCreated_clone(&msg_var);
17612         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17613         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17614         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17615         CHECK(obj != NULL);
17616         (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
17617         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17618                 (*env)->ExceptionDescribe(env);
17619                 (*env)->FatalError(env, "A call to handle_funding_created in LDKChannelMessageHandler from rust threw an exception.");
17620         }
17621         if (get_jenv_res == JNI_EDETACHED) {
17622                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17623         }
17624 }
17625 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
17626         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17627         JNIEnv *env;
17628         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17629         if (get_jenv_res == JNI_EDETACHED) {
17630                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17631         } else {
17632                 DO_ASSERT(get_jenv_res == JNI_OK);
17633         }
17634         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17635         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17636         LDKFundingSigned msg_var = *msg;
17637         int64_t msg_ref = 0;
17638         msg_var = FundingSigned_clone(&msg_var);
17639         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17640         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17641         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17642         CHECK(obj != NULL);
17643         (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
17644         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17645                 (*env)->ExceptionDescribe(env);
17646                 (*env)->FatalError(env, "A call to handle_funding_signed in LDKChannelMessageHandler from rust threw an exception.");
17647         }
17648         if (get_jenv_res == JNI_EDETACHED) {
17649                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17650         }
17651 }
17652 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
17653         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17654         JNIEnv *env;
17655         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17656         if (get_jenv_res == JNI_EDETACHED) {
17657                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17658         } else {
17659                 DO_ASSERT(get_jenv_res == JNI_OK);
17660         }
17661         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17662         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17663         LDKChannelReady msg_var = *msg;
17664         int64_t msg_ref = 0;
17665         msg_var = ChannelReady_clone(&msg_var);
17666         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17667         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17668         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17669         CHECK(obj != NULL);
17670         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_ready_meth, their_node_id_arr, msg_ref);
17671         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17672                 (*env)->ExceptionDescribe(env);
17673                 (*env)->FatalError(env, "A call to handle_channel_ready in LDKChannelMessageHandler from rust threw an exception.");
17674         }
17675         if (get_jenv_res == JNI_EDETACHED) {
17676                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17677         }
17678 }
17679 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown * msg) {
17680         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17681         JNIEnv *env;
17682         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17683         if (get_jenv_res == JNI_EDETACHED) {
17684                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17685         } else {
17686                 DO_ASSERT(get_jenv_res == JNI_OK);
17687         }
17688         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17689         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17690         LDKShutdown msg_var = *msg;
17691         int64_t msg_ref = 0;
17692         msg_var = Shutdown_clone(&msg_var);
17693         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17694         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17695         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17696         CHECK(obj != NULL);
17697         (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, msg_ref);
17698         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17699                 (*env)->ExceptionDescribe(env);
17700                 (*env)->FatalError(env, "A call to handle_shutdown in LDKChannelMessageHandler from rust threw an exception.");
17701         }
17702         if (get_jenv_res == JNI_EDETACHED) {
17703                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17704         }
17705 }
17706 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
17707         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17708         JNIEnv *env;
17709         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17710         if (get_jenv_res == JNI_EDETACHED) {
17711                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17712         } else {
17713                 DO_ASSERT(get_jenv_res == JNI_OK);
17714         }
17715         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17716         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17717         LDKClosingSigned msg_var = *msg;
17718         int64_t msg_ref = 0;
17719         msg_var = ClosingSigned_clone(&msg_var);
17720         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17721         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17722         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17723         CHECK(obj != NULL);
17724         (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
17725         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17726                 (*env)->ExceptionDescribe(env);
17727                 (*env)->FatalError(env, "A call to handle_closing_signed in LDKChannelMessageHandler from rust threw an exception.");
17728         }
17729         if (get_jenv_res == JNI_EDETACHED) {
17730                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17731         }
17732 }
17733 void handle_stfu_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKStfu * msg) {
17734         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17735         JNIEnv *env;
17736         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17737         if (get_jenv_res == JNI_EDETACHED) {
17738                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17739         } else {
17740                 DO_ASSERT(get_jenv_res == JNI_OK);
17741         }
17742         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17743         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17744         LDKStfu msg_var = *msg;
17745         int64_t msg_ref = 0;
17746         msg_var = Stfu_clone(&msg_var);
17747         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17748         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17749         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17750         CHECK(obj != NULL);
17751         (*env)->CallVoidMethod(env, obj, j_calls->handle_stfu_meth, their_node_id_arr, msg_ref);
17752         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17753                 (*env)->ExceptionDescribe(env);
17754                 (*env)->FatalError(env, "A call to handle_stfu in LDKChannelMessageHandler from rust threw an exception.");
17755         }
17756         if (get_jenv_res == JNI_EDETACHED) {
17757                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17758         }
17759 }
17760 void handle_splice_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKSplice * msg) {
17761         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17762         JNIEnv *env;
17763         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17764         if (get_jenv_res == JNI_EDETACHED) {
17765                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17766         } else {
17767                 DO_ASSERT(get_jenv_res == JNI_OK);
17768         }
17769         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17770         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17771         LDKSplice msg_var = *msg;
17772         int64_t msg_ref = 0;
17773         msg_var = Splice_clone(&msg_var);
17774         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17775         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17776         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17777         CHECK(obj != NULL);
17778         (*env)->CallVoidMethod(env, obj, j_calls->handle_splice_meth, their_node_id_arr, msg_ref);
17779         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17780                 (*env)->ExceptionDescribe(env);
17781                 (*env)->FatalError(env, "A call to handle_splice in LDKChannelMessageHandler from rust threw an exception.");
17782         }
17783         if (get_jenv_res == JNI_EDETACHED) {
17784                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17785         }
17786 }
17787 void handle_splice_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKSpliceAck * msg) {
17788         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17789         JNIEnv *env;
17790         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17791         if (get_jenv_res == JNI_EDETACHED) {
17792                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17793         } else {
17794                 DO_ASSERT(get_jenv_res == JNI_OK);
17795         }
17796         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17797         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17798         LDKSpliceAck msg_var = *msg;
17799         int64_t msg_ref = 0;
17800         msg_var = SpliceAck_clone(&msg_var);
17801         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17802         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17803         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17804         CHECK(obj != NULL);
17805         (*env)->CallVoidMethod(env, obj, j_calls->handle_splice_ack_meth, their_node_id_arr, msg_ref);
17806         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17807                 (*env)->ExceptionDescribe(env);
17808                 (*env)->FatalError(env, "A call to handle_splice_ack in LDKChannelMessageHandler from rust threw an exception.");
17809         }
17810         if (get_jenv_res == JNI_EDETACHED) {
17811                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17812         }
17813 }
17814 void handle_splice_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKSpliceLocked * msg) {
17815         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17816         JNIEnv *env;
17817         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17818         if (get_jenv_res == JNI_EDETACHED) {
17819                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17820         } else {
17821                 DO_ASSERT(get_jenv_res == JNI_OK);
17822         }
17823         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17824         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17825         LDKSpliceLocked msg_var = *msg;
17826         int64_t msg_ref = 0;
17827         msg_var = SpliceLocked_clone(&msg_var);
17828         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17829         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17830         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17831         CHECK(obj != NULL);
17832         (*env)->CallVoidMethod(env, obj, j_calls->handle_splice_locked_meth, their_node_id_arr, msg_ref);
17833         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17834                 (*env)->ExceptionDescribe(env);
17835                 (*env)->FatalError(env, "A call to handle_splice_locked in LDKChannelMessageHandler from rust threw an exception.");
17836         }
17837         if (get_jenv_res == JNI_EDETACHED) {
17838                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17839         }
17840 }
17841 void handle_tx_add_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddInput * msg) {
17842         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17843         JNIEnv *env;
17844         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17845         if (get_jenv_res == JNI_EDETACHED) {
17846                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17847         } else {
17848                 DO_ASSERT(get_jenv_res == JNI_OK);
17849         }
17850         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17851         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17852         LDKTxAddInput msg_var = *msg;
17853         int64_t msg_ref = 0;
17854         msg_var = TxAddInput_clone(&msg_var);
17855         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17856         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17857         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17858         CHECK(obj != NULL);
17859         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_add_input_meth, their_node_id_arr, msg_ref);
17860         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17861                 (*env)->ExceptionDescribe(env);
17862                 (*env)->FatalError(env, "A call to handle_tx_add_input in LDKChannelMessageHandler from rust threw an exception.");
17863         }
17864         if (get_jenv_res == JNI_EDETACHED) {
17865                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17866         }
17867 }
17868 void handle_tx_add_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddOutput * msg) {
17869         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17870         JNIEnv *env;
17871         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17872         if (get_jenv_res == JNI_EDETACHED) {
17873                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17874         } else {
17875                 DO_ASSERT(get_jenv_res == JNI_OK);
17876         }
17877         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17878         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17879         LDKTxAddOutput msg_var = *msg;
17880         int64_t msg_ref = 0;
17881         msg_var = TxAddOutput_clone(&msg_var);
17882         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17883         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17884         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17885         CHECK(obj != NULL);
17886         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_add_output_meth, their_node_id_arr, msg_ref);
17887         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17888                 (*env)->ExceptionDescribe(env);
17889                 (*env)->FatalError(env, "A call to handle_tx_add_output in LDKChannelMessageHandler from rust threw an exception.");
17890         }
17891         if (get_jenv_res == JNI_EDETACHED) {
17892                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17893         }
17894 }
17895 void handle_tx_remove_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveInput * msg) {
17896         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17897         JNIEnv *env;
17898         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17899         if (get_jenv_res == JNI_EDETACHED) {
17900                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17901         } else {
17902                 DO_ASSERT(get_jenv_res == JNI_OK);
17903         }
17904         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17905         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17906         LDKTxRemoveInput msg_var = *msg;
17907         int64_t msg_ref = 0;
17908         msg_var = TxRemoveInput_clone(&msg_var);
17909         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17910         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17911         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17912         CHECK(obj != NULL);
17913         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_remove_input_meth, their_node_id_arr, msg_ref);
17914         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17915                 (*env)->ExceptionDescribe(env);
17916                 (*env)->FatalError(env, "A call to handle_tx_remove_input in LDKChannelMessageHandler from rust threw an exception.");
17917         }
17918         if (get_jenv_res == JNI_EDETACHED) {
17919                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17920         }
17921 }
17922 void handle_tx_remove_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveOutput * msg) {
17923         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17924         JNIEnv *env;
17925         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17926         if (get_jenv_res == JNI_EDETACHED) {
17927                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17928         } else {
17929                 DO_ASSERT(get_jenv_res == JNI_OK);
17930         }
17931         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17932         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17933         LDKTxRemoveOutput msg_var = *msg;
17934         int64_t msg_ref = 0;
17935         msg_var = TxRemoveOutput_clone(&msg_var);
17936         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17937         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17938         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17939         CHECK(obj != NULL);
17940         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_remove_output_meth, their_node_id_arr, msg_ref);
17941         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17942                 (*env)->ExceptionDescribe(env);
17943                 (*env)->FatalError(env, "A call to handle_tx_remove_output in LDKChannelMessageHandler from rust threw an exception.");
17944         }
17945         if (get_jenv_res == JNI_EDETACHED) {
17946                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17947         }
17948 }
17949 void handle_tx_complete_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxComplete * msg) {
17950         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17951         JNIEnv *env;
17952         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17953         if (get_jenv_res == JNI_EDETACHED) {
17954                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17955         } else {
17956                 DO_ASSERT(get_jenv_res == JNI_OK);
17957         }
17958         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17959         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17960         LDKTxComplete msg_var = *msg;
17961         int64_t msg_ref = 0;
17962         msg_var = TxComplete_clone(&msg_var);
17963         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17964         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17965         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17966         CHECK(obj != NULL);
17967         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_complete_meth, their_node_id_arr, msg_ref);
17968         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17969                 (*env)->ExceptionDescribe(env);
17970                 (*env)->FatalError(env, "A call to handle_tx_complete in LDKChannelMessageHandler from rust threw an exception.");
17971         }
17972         if (get_jenv_res == JNI_EDETACHED) {
17973                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17974         }
17975 }
17976 void handle_tx_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxSignatures * msg) {
17977         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17978         JNIEnv *env;
17979         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17980         if (get_jenv_res == JNI_EDETACHED) {
17981                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17982         } else {
17983                 DO_ASSERT(get_jenv_res == JNI_OK);
17984         }
17985         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17986         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17987         LDKTxSignatures msg_var = *msg;
17988         int64_t msg_ref = 0;
17989         msg_var = TxSignatures_clone(&msg_var);
17990         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17991         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17992         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17993         CHECK(obj != NULL);
17994         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_signatures_meth, their_node_id_arr, msg_ref);
17995         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17996                 (*env)->ExceptionDescribe(env);
17997                 (*env)->FatalError(env, "A call to handle_tx_signatures in LDKChannelMessageHandler from rust threw an exception.");
17998         }
17999         if (get_jenv_res == JNI_EDETACHED) {
18000                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18001         }
18002 }
18003 void handle_tx_init_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxInitRbf * msg) {
18004         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
18005         JNIEnv *env;
18006         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18007         if (get_jenv_res == JNI_EDETACHED) {
18008                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18009         } else {
18010                 DO_ASSERT(get_jenv_res == JNI_OK);
18011         }
18012         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18013         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18014         LDKTxInitRbf msg_var = *msg;
18015         int64_t msg_ref = 0;
18016         msg_var = TxInitRbf_clone(&msg_var);
18017         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18018         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18019         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18020         CHECK(obj != NULL);
18021         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_init_rbf_meth, their_node_id_arr, msg_ref);
18022         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18023                 (*env)->ExceptionDescribe(env);
18024                 (*env)->FatalError(env, "A call to handle_tx_init_rbf in LDKChannelMessageHandler from rust threw an exception.");
18025         }
18026         if (get_jenv_res == JNI_EDETACHED) {
18027                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18028         }
18029 }
18030 void handle_tx_ack_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAckRbf * msg) {
18031         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
18032         JNIEnv *env;
18033         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18034         if (get_jenv_res == JNI_EDETACHED) {
18035                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18036         } else {
18037                 DO_ASSERT(get_jenv_res == JNI_OK);
18038         }
18039         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18040         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18041         LDKTxAckRbf msg_var = *msg;
18042         int64_t msg_ref = 0;
18043         msg_var = TxAckRbf_clone(&msg_var);
18044         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18045         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18046         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18047         CHECK(obj != NULL);
18048         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_ack_rbf_meth, their_node_id_arr, msg_ref);
18049         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18050                 (*env)->ExceptionDescribe(env);
18051                 (*env)->FatalError(env, "A call to handle_tx_ack_rbf in LDKChannelMessageHandler from rust threw an exception.");
18052         }
18053         if (get_jenv_res == JNI_EDETACHED) {
18054                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18055         }
18056 }
18057 void handle_tx_abort_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAbort * msg) {
18058         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
18059         JNIEnv *env;
18060         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18061         if (get_jenv_res == JNI_EDETACHED) {
18062                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18063         } else {
18064                 DO_ASSERT(get_jenv_res == JNI_OK);
18065         }
18066         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18067         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18068         LDKTxAbort msg_var = *msg;
18069         int64_t msg_ref = 0;
18070         msg_var = TxAbort_clone(&msg_var);
18071         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18072         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18073         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18074         CHECK(obj != NULL);
18075         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_abort_meth, their_node_id_arr, msg_ref);
18076         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18077                 (*env)->ExceptionDescribe(env);
18078                 (*env)->FatalError(env, "A call to handle_tx_abort in LDKChannelMessageHandler from rust threw an exception.");
18079         }
18080         if (get_jenv_res == JNI_EDETACHED) {
18081                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18082         }
18083 }
18084 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
18085         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
18086         JNIEnv *env;
18087         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18088         if (get_jenv_res == JNI_EDETACHED) {
18089                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18090         } else {
18091                 DO_ASSERT(get_jenv_res == JNI_OK);
18092         }
18093         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18094         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18095         LDKUpdateAddHTLC msg_var = *msg;
18096         int64_t msg_ref = 0;
18097         msg_var = UpdateAddHTLC_clone(&msg_var);
18098         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18099         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18100         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18101         CHECK(obj != NULL);
18102         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
18103         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18104                 (*env)->ExceptionDescribe(env);
18105                 (*env)->FatalError(env, "A call to handle_update_add_htlc in LDKChannelMessageHandler from rust threw an exception.");
18106         }
18107         if (get_jenv_res == JNI_EDETACHED) {
18108                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18109         }
18110 }
18111 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
18112         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
18113         JNIEnv *env;
18114         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18115         if (get_jenv_res == JNI_EDETACHED) {
18116                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18117         } else {
18118                 DO_ASSERT(get_jenv_res == JNI_OK);
18119         }
18120         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18121         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18122         LDKUpdateFulfillHTLC msg_var = *msg;
18123         int64_t msg_ref = 0;
18124         msg_var = UpdateFulfillHTLC_clone(&msg_var);
18125         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18126         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18127         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18128         CHECK(obj != NULL);
18129         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
18130         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18131                 (*env)->ExceptionDescribe(env);
18132                 (*env)->FatalError(env, "A call to handle_update_fulfill_htlc in LDKChannelMessageHandler from rust threw an exception.");
18133         }
18134         if (get_jenv_res == JNI_EDETACHED) {
18135                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18136         }
18137 }
18138 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
18139         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
18140         JNIEnv *env;
18141         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18142         if (get_jenv_res == JNI_EDETACHED) {
18143                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18144         } else {
18145                 DO_ASSERT(get_jenv_res == JNI_OK);
18146         }
18147         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18148         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18149         LDKUpdateFailHTLC msg_var = *msg;
18150         int64_t msg_ref = 0;
18151         msg_var = UpdateFailHTLC_clone(&msg_var);
18152         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18153         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18154         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18155         CHECK(obj != NULL);
18156         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
18157         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18158                 (*env)->ExceptionDescribe(env);
18159                 (*env)->FatalError(env, "A call to handle_update_fail_htlc in LDKChannelMessageHandler from rust threw an exception.");
18160         }
18161         if (get_jenv_res == JNI_EDETACHED) {
18162                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18163         }
18164 }
18165 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
18166         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
18167         JNIEnv *env;
18168         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18169         if (get_jenv_res == JNI_EDETACHED) {
18170                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18171         } else {
18172                 DO_ASSERT(get_jenv_res == JNI_OK);
18173         }
18174         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18175         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18176         LDKUpdateFailMalformedHTLC msg_var = *msg;
18177         int64_t msg_ref = 0;
18178         msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
18179         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18180         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18181         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18182         CHECK(obj != NULL);
18183         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
18184         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18185                 (*env)->ExceptionDescribe(env);
18186                 (*env)->FatalError(env, "A call to handle_update_fail_malformed_htlc in LDKChannelMessageHandler from rust threw an exception.");
18187         }
18188         if (get_jenv_res == JNI_EDETACHED) {
18189                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18190         }
18191 }
18192 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
18193         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
18194         JNIEnv *env;
18195         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18196         if (get_jenv_res == JNI_EDETACHED) {
18197                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18198         } else {
18199                 DO_ASSERT(get_jenv_res == JNI_OK);
18200         }
18201         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18202         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18203         LDKCommitmentSigned msg_var = *msg;
18204         int64_t msg_ref = 0;
18205         msg_var = CommitmentSigned_clone(&msg_var);
18206         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18207         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18208         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18209         CHECK(obj != NULL);
18210         (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
18211         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18212                 (*env)->ExceptionDescribe(env);
18213                 (*env)->FatalError(env, "A call to handle_commitment_signed in LDKChannelMessageHandler from rust threw an exception.");
18214         }
18215         if (get_jenv_res == JNI_EDETACHED) {
18216                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18217         }
18218 }
18219 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
18220         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
18221         JNIEnv *env;
18222         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18223         if (get_jenv_res == JNI_EDETACHED) {
18224                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18225         } else {
18226                 DO_ASSERT(get_jenv_res == JNI_OK);
18227         }
18228         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18229         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18230         LDKRevokeAndACK msg_var = *msg;
18231         int64_t msg_ref = 0;
18232         msg_var = RevokeAndACK_clone(&msg_var);
18233         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18234         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18235         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18236         CHECK(obj != NULL);
18237         (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
18238         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18239                 (*env)->ExceptionDescribe(env);
18240                 (*env)->FatalError(env, "A call to handle_revoke_and_ack in LDKChannelMessageHandler from rust threw an exception.");
18241         }
18242         if (get_jenv_res == JNI_EDETACHED) {
18243                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18244         }
18245 }
18246 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
18247         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
18248         JNIEnv *env;
18249         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18250         if (get_jenv_res == JNI_EDETACHED) {
18251                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18252         } else {
18253                 DO_ASSERT(get_jenv_res == JNI_OK);
18254         }
18255         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18256         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18257         LDKUpdateFee msg_var = *msg;
18258         int64_t msg_ref = 0;
18259         msg_var = UpdateFee_clone(&msg_var);
18260         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18261         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18262         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18263         CHECK(obj != NULL);
18264         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
18265         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18266                 (*env)->ExceptionDescribe(env);
18267                 (*env)->FatalError(env, "A call to handle_update_fee in LDKChannelMessageHandler from rust threw an exception.");
18268         }
18269         if (get_jenv_res == JNI_EDETACHED) {
18270                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18271         }
18272 }
18273 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
18274         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
18275         JNIEnv *env;
18276         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18277         if (get_jenv_res == JNI_EDETACHED) {
18278                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18279         } else {
18280                 DO_ASSERT(get_jenv_res == JNI_OK);
18281         }
18282         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18283         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18284         LDKAnnouncementSignatures msg_var = *msg;
18285         int64_t msg_ref = 0;
18286         msg_var = AnnouncementSignatures_clone(&msg_var);
18287         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18288         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18289         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18290         CHECK(obj != NULL);
18291         (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
18292         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18293                 (*env)->ExceptionDescribe(env);
18294                 (*env)->FatalError(env, "A call to handle_announcement_signatures in LDKChannelMessageHandler from rust threw an exception.");
18295         }
18296         if (get_jenv_res == JNI_EDETACHED) {
18297                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18298         }
18299 }
18300 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
18301         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
18302         JNIEnv *env;
18303         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18304         if (get_jenv_res == JNI_EDETACHED) {
18305                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18306         } else {
18307                 DO_ASSERT(get_jenv_res == JNI_OK);
18308         }
18309         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18310         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18311         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18312         CHECK(obj != NULL);
18313         (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr);
18314         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18315                 (*env)->ExceptionDescribe(env);
18316                 (*env)->FatalError(env, "A call to peer_disconnected in LDKChannelMessageHandler from rust threw an exception.");
18317         }
18318         if (get_jenv_res == JNI_EDETACHED) {
18319                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18320         }
18321 }
18322 LDKCResult_NoneNoneZ peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg, bool inbound) {
18323         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
18324         JNIEnv *env;
18325         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18326         if (get_jenv_res == JNI_EDETACHED) {
18327                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18328         } else {
18329                 DO_ASSERT(get_jenv_res == JNI_OK);
18330         }
18331         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18332         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18333         LDKInit msg_var = *msg;
18334         int64_t msg_ref = 0;
18335         msg_var = Init_clone(&msg_var);
18336         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18337         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18338         jboolean inbound_conv = inbound;
18339         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18340         CHECK(obj != NULL);
18341         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref, inbound_conv);
18342         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18343                 (*env)->ExceptionDescribe(env);
18344                 (*env)->FatalError(env, "A call to peer_connected in LDKChannelMessageHandler from rust threw an exception.");
18345         }
18346         void* ret_ptr = untag_ptr(ret);
18347         CHECK_ACCESS(ret_ptr);
18348         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
18349         FREE(untag_ptr(ret));
18350         if (get_jenv_res == JNI_EDETACHED) {
18351                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18352         }
18353         return ret_conv;
18354 }
18355 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
18356         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
18357         JNIEnv *env;
18358         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18359         if (get_jenv_res == JNI_EDETACHED) {
18360                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18361         } else {
18362                 DO_ASSERT(get_jenv_res == JNI_OK);
18363         }
18364         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18365         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18366         LDKChannelReestablish msg_var = *msg;
18367         int64_t msg_ref = 0;
18368         msg_var = ChannelReestablish_clone(&msg_var);
18369         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18370         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18371         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18372         CHECK(obj != NULL);
18373         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
18374         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18375                 (*env)->ExceptionDescribe(env);
18376                 (*env)->FatalError(env, "A call to handle_channel_reestablish in LDKChannelMessageHandler from rust threw an exception.");
18377         }
18378         if (get_jenv_res == JNI_EDETACHED) {
18379                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18380         }
18381 }
18382 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
18383         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
18384         JNIEnv *env;
18385         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18386         if (get_jenv_res == JNI_EDETACHED) {
18387                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18388         } else {
18389                 DO_ASSERT(get_jenv_res == JNI_OK);
18390         }
18391         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18392         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18393         LDKChannelUpdate msg_var = *msg;
18394         int64_t msg_ref = 0;
18395         msg_var = ChannelUpdate_clone(&msg_var);
18396         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18397         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18398         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18399         CHECK(obj != NULL);
18400         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
18401         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18402                 (*env)->ExceptionDescribe(env);
18403                 (*env)->FatalError(env, "A call to handle_channel_update in LDKChannelMessageHandler from rust threw an exception.");
18404         }
18405         if (get_jenv_res == JNI_EDETACHED) {
18406                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18407         }
18408 }
18409 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
18410         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
18411         JNIEnv *env;
18412         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18413         if (get_jenv_res == JNI_EDETACHED) {
18414                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18415         } else {
18416                 DO_ASSERT(get_jenv_res == JNI_OK);
18417         }
18418         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18419         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18420         LDKErrorMessage msg_var = *msg;
18421         int64_t msg_ref = 0;
18422         msg_var = ErrorMessage_clone(&msg_var);
18423         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18424         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18425         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18426         CHECK(obj != NULL);
18427         (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
18428         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18429                 (*env)->ExceptionDescribe(env);
18430                 (*env)->FatalError(env, "A call to handle_error in LDKChannelMessageHandler from rust threw an exception.");
18431         }
18432         if (get_jenv_res == JNI_EDETACHED) {
18433                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18434         }
18435 }
18436 LDKNodeFeatures provided_node_features_LDKChannelMessageHandler_jcall(const void* this_arg) {
18437         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
18438         JNIEnv *env;
18439         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18440         if (get_jenv_res == JNI_EDETACHED) {
18441                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18442         } else {
18443                 DO_ASSERT(get_jenv_res == JNI_OK);
18444         }
18445         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18446         CHECK(obj != NULL);
18447         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
18448         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18449                 (*env)->ExceptionDescribe(env);
18450                 (*env)->FatalError(env, "A call to provided_node_features in LDKChannelMessageHandler from rust threw an exception.");
18451         }
18452         LDKNodeFeatures ret_conv;
18453         ret_conv.inner = untag_ptr(ret);
18454         ret_conv.is_owned = ptr_is_owned(ret);
18455         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
18456         if (get_jenv_res == JNI_EDETACHED) {
18457                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18458         }
18459         return ret_conv;
18460 }
18461 LDKInitFeatures provided_init_features_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
18462         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
18463         JNIEnv *env;
18464         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18465         if (get_jenv_res == JNI_EDETACHED) {
18466                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18467         } else {
18468                 DO_ASSERT(get_jenv_res == JNI_OK);
18469         }
18470         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18471         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18472         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18473         CHECK(obj != NULL);
18474         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
18475         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18476                 (*env)->ExceptionDescribe(env);
18477                 (*env)->FatalError(env, "A call to provided_init_features in LDKChannelMessageHandler from rust threw an exception.");
18478         }
18479         LDKInitFeatures ret_conv;
18480         ret_conv.inner = untag_ptr(ret);
18481         ret_conv.is_owned = ptr_is_owned(ret);
18482         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
18483         if (get_jenv_res == JNI_EDETACHED) {
18484                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18485         }
18486         return ret_conv;
18487 }
18488 LDKCOption_CVec_ThirtyTwoBytesZZ get_chain_hashes_LDKChannelMessageHandler_jcall(const void* this_arg) {
18489         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
18490         JNIEnv *env;
18491         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18492         if (get_jenv_res == JNI_EDETACHED) {
18493                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18494         } else {
18495                 DO_ASSERT(get_jenv_res == JNI_OK);
18496         }
18497         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18498         CHECK(obj != NULL);
18499         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_chain_hashes_meth);
18500         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18501                 (*env)->ExceptionDescribe(env);
18502                 (*env)->FatalError(env, "A call to get_chain_hashes in LDKChannelMessageHandler from rust threw an exception.");
18503         }
18504         void* ret_ptr = untag_ptr(ret);
18505         CHECK_ACCESS(ret_ptr);
18506         LDKCOption_CVec_ThirtyTwoBytesZZ ret_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(ret_ptr);
18507         FREE(untag_ptr(ret));
18508         if (get_jenv_res == JNI_EDETACHED) {
18509                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18510         }
18511         return ret_conv;
18512 }
18513 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
18514         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
18515         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18516         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
18517 }
18518 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
18519         jclass c = (*env)->GetObjectClass(env, o);
18520         CHECK(c != NULL);
18521         LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
18522         atomic_init(&calls->refcnt, 1);
18523         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18524         calls->o = (*env)->NewWeakGlobalRef(env, o);
18525         calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJ)V");
18526         CHECK(calls->handle_open_channel_meth != NULL);
18527         calls->handle_open_channel_v2_meth = (*env)->GetMethodID(env, c, "handle_open_channel_v2", "([BJ)V");
18528         CHECK(calls->handle_open_channel_v2_meth != NULL);
18529         calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJ)V");
18530         CHECK(calls->handle_accept_channel_meth != NULL);
18531         calls->handle_accept_channel_v2_meth = (*env)->GetMethodID(env, c, "handle_accept_channel_v2", "([BJ)V");
18532         CHECK(calls->handle_accept_channel_v2_meth != NULL);
18533         calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
18534         CHECK(calls->handle_funding_created_meth != NULL);
18535         calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
18536         CHECK(calls->handle_funding_signed_meth != NULL);
18537         calls->handle_channel_ready_meth = (*env)->GetMethodID(env, c, "handle_channel_ready", "([BJ)V");
18538         CHECK(calls->handle_channel_ready_meth != NULL);
18539         calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJ)V");
18540         CHECK(calls->handle_shutdown_meth != NULL);
18541         calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
18542         CHECK(calls->handle_closing_signed_meth != NULL);
18543         calls->handle_stfu_meth = (*env)->GetMethodID(env, c, "handle_stfu", "([BJ)V");
18544         CHECK(calls->handle_stfu_meth != NULL);
18545         calls->handle_splice_meth = (*env)->GetMethodID(env, c, "handle_splice", "([BJ)V");
18546         CHECK(calls->handle_splice_meth != NULL);
18547         calls->handle_splice_ack_meth = (*env)->GetMethodID(env, c, "handle_splice_ack", "([BJ)V");
18548         CHECK(calls->handle_splice_ack_meth != NULL);
18549         calls->handle_splice_locked_meth = (*env)->GetMethodID(env, c, "handle_splice_locked", "([BJ)V");
18550         CHECK(calls->handle_splice_locked_meth != NULL);
18551         calls->handle_tx_add_input_meth = (*env)->GetMethodID(env, c, "handle_tx_add_input", "([BJ)V");
18552         CHECK(calls->handle_tx_add_input_meth != NULL);
18553         calls->handle_tx_add_output_meth = (*env)->GetMethodID(env, c, "handle_tx_add_output", "([BJ)V");
18554         CHECK(calls->handle_tx_add_output_meth != NULL);
18555         calls->handle_tx_remove_input_meth = (*env)->GetMethodID(env, c, "handle_tx_remove_input", "([BJ)V");
18556         CHECK(calls->handle_tx_remove_input_meth != NULL);
18557         calls->handle_tx_remove_output_meth = (*env)->GetMethodID(env, c, "handle_tx_remove_output", "([BJ)V");
18558         CHECK(calls->handle_tx_remove_output_meth != NULL);
18559         calls->handle_tx_complete_meth = (*env)->GetMethodID(env, c, "handle_tx_complete", "([BJ)V");
18560         CHECK(calls->handle_tx_complete_meth != NULL);
18561         calls->handle_tx_signatures_meth = (*env)->GetMethodID(env, c, "handle_tx_signatures", "([BJ)V");
18562         CHECK(calls->handle_tx_signatures_meth != NULL);
18563         calls->handle_tx_init_rbf_meth = (*env)->GetMethodID(env, c, "handle_tx_init_rbf", "([BJ)V");
18564         CHECK(calls->handle_tx_init_rbf_meth != NULL);
18565         calls->handle_tx_ack_rbf_meth = (*env)->GetMethodID(env, c, "handle_tx_ack_rbf", "([BJ)V");
18566         CHECK(calls->handle_tx_ack_rbf_meth != NULL);
18567         calls->handle_tx_abort_meth = (*env)->GetMethodID(env, c, "handle_tx_abort", "([BJ)V");
18568         CHECK(calls->handle_tx_abort_meth != NULL);
18569         calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
18570         CHECK(calls->handle_update_add_htlc_meth != NULL);
18571         calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
18572         CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
18573         calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
18574         CHECK(calls->handle_update_fail_htlc_meth != NULL);
18575         calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
18576         CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
18577         calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
18578         CHECK(calls->handle_commitment_signed_meth != NULL);
18579         calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
18580         CHECK(calls->handle_revoke_and_ack_meth != NULL);
18581         calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
18582         CHECK(calls->handle_update_fee_meth != NULL);
18583         calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
18584         CHECK(calls->handle_announcement_signatures_meth != NULL);
18585         calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([B)V");
18586         CHECK(calls->peer_disconnected_meth != NULL);
18587         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJZ)J");
18588         CHECK(calls->peer_connected_meth != NULL);
18589         calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
18590         CHECK(calls->handle_channel_reestablish_meth != NULL);
18591         calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "([BJ)V");
18592         CHECK(calls->handle_channel_update_meth != NULL);
18593         calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
18594         CHECK(calls->handle_error_meth != NULL);
18595         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
18596         CHECK(calls->provided_node_features_meth != NULL);
18597         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
18598         CHECK(calls->provided_init_features_meth != NULL);
18599         calls->get_chain_hashes_meth = (*env)->GetMethodID(env, c, "get_chain_hashes", "()J");
18600         CHECK(calls->get_chain_hashes_meth != NULL);
18601
18602         LDKChannelMessageHandler ret = {
18603                 .this_arg = (void*) calls,
18604                 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
18605                 .handle_open_channel_v2 = handle_open_channel_v2_LDKChannelMessageHandler_jcall,
18606                 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
18607                 .handle_accept_channel_v2 = handle_accept_channel_v2_LDKChannelMessageHandler_jcall,
18608                 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
18609                 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
18610                 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
18611                 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
18612                 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
18613                 .handle_stfu = handle_stfu_LDKChannelMessageHandler_jcall,
18614                 .handle_splice = handle_splice_LDKChannelMessageHandler_jcall,
18615                 .handle_splice_ack = handle_splice_ack_LDKChannelMessageHandler_jcall,
18616                 .handle_splice_locked = handle_splice_locked_LDKChannelMessageHandler_jcall,
18617                 .handle_tx_add_input = handle_tx_add_input_LDKChannelMessageHandler_jcall,
18618                 .handle_tx_add_output = handle_tx_add_output_LDKChannelMessageHandler_jcall,
18619                 .handle_tx_remove_input = handle_tx_remove_input_LDKChannelMessageHandler_jcall,
18620                 .handle_tx_remove_output = handle_tx_remove_output_LDKChannelMessageHandler_jcall,
18621                 .handle_tx_complete = handle_tx_complete_LDKChannelMessageHandler_jcall,
18622                 .handle_tx_signatures = handle_tx_signatures_LDKChannelMessageHandler_jcall,
18623                 .handle_tx_init_rbf = handle_tx_init_rbf_LDKChannelMessageHandler_jcall,
18624                 .handle_tx_ack_rbf = handle_tx_ack_rbf_LDKChannelMessageHandler_jcall,
18625                 .handle_tx_abort = handle_tx_abort_LDKChannelMessageHandler_jcall,
18626                 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
18627                 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
18628                 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
18629                 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
18630                 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
18631                 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
18632                 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
18633                 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
18634                 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
18635                 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
18636                 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
18637                 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
18638                 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
18639                 .provided_node_features = provided_node_features_LDKChannelMessageHandler_jcall,
18640                 .provided_init_features = provided_init_features_LDKChannelMessageHandler_jcall,
18641                 .get_chain_hashes = get_chain_hashes_LDKChannelMessageHandler_jcall,
18642                 .free = LDKChannelMessageHandler_JCalls_free,
18643                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
18644         };
18645         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
18646         return ret;
18647 }
18648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
18649         LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
18650         *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
18651         return tag_ptr(res_ptr, true);
18652 }
18653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
18654         LDKChannelMessageHandler *inp = (LDKChannelMessageHandler *)untag_ptr(arg);
18655         return tag_ptr(&inp->MessageSendEventsProvider, false);
18656 }
18657 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) {
18658         void* this_arg_ptr = untag_ptr(this_arg);
18659         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18660         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
18661         LDKPublicKey their_node_id_ref;
18662         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18663         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18664         LDKOpenChannel msg_conv;
18665         msg_conv.inner = untag_ptr(msg);
18666         msg_conv.is_owned = ptr_is_owned(msg);
18667         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18668         msg_conv.is_owned = false;
18669         (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
18670 }
18671
18672 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) {
18673         void* this_arg_ptr = untag_ptr(this_arg);
18674         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18675         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
18676         LDKPublicKey their_node_id_ref;
18677         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18678         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18679         LDKOpenChannelV2 msg_conv;
18680         msg_conv.inner = untag_ptr(msg);
18681         msg_conv.is_owned = ptr_is_owned(msg);
18682         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18683         msg_conv.is_owned = false;
18684         (this_arg_conv->handle_open_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
18685 }
18686
18687 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) {
18688         void* this_arg_ptr = untag_ptr(this_arg);
18689         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18690         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
18691         LDKPublicKey their_node_id_ref;
18692         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18693         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18694         LDKAcceptChannel msg_conv;
18695         msg_conv.inner = untag_ptr(msg);
18696         msg_conv.is_owned = ptr_is_owned(msg);
18697         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18698         msg_conv.is_owned = false;
18699         (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
18700 }
18701
18702 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) {
18703         void* this_arg_ptr = untag_ptr(this_arg);
18704         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18705         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
18706         LDKPublicKey their_node_id_ref;
18707         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18708         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18709         LDKAcceptChannelV2 msg_conv;
18710         msg_conv.inner = untag_ptr(msg);
18711         msg_conv.is_owned = ptr_is_owned(msg);
18712         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18713         msg_conv.is_owned = false;
18714         (this_arg_conv->handle_accept_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
18715 }
18716
18717 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) {
18718         void* this_arg_ptr = untag_ptr(this_arg);
18719         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18720         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
18721         LDKPublicKey their_node_id_ref;
18722         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18723         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18724         LDKFundingCreated msg_conv;
18725         msg_conv.inner = untag_ptr(msg);
18726         msg_conv.is_owned = ptr_is_owned(msg);
18727         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18728         msg_conv.is_owned = false;
18729         (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
18730 }
18731
18732 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) {
18733         void* this_arg_ptr = untag_ptr(this_arg);
18734         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18735         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
18736         LDKPublicKey their_node_id_ref;
18737         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18738         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18739         LDKFundingSigned msg_conv;
18740         msg_conv.inner = untag_ptr(msg);
18741         msg_conv.is_owned = ptr_is_owned(msg);
18742         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18743         msg_conv.is_owned = false;
18744         (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
18745 }
18746
18747 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) {
18748         void* this_arg_ptr = untag_ptr(this_arg);
18749         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18750         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
18751         LDKPublicKey their_node_id_ref;
18752         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18753         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18754         LDKChannelReady msg_conv;
18755         msg_conv.inner = untag_ptr(msg);
18756         msg_conv.is_owned = ptr_is_owned(msg);
18757         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18758         msg_conv.is_owned = false;
18759         (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
18760 }
18761
18762 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) {
18763         void* this_arg_ptr = untag_ptr(this_arg);
18764         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18765         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
18766         LDKPublicKey their_node_id_ref;
18767         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18768         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18769         LDKShutdown msg_conv;
18770         msg_conv.inner = untag_ptr(msg);
18771         msg_conv.is_owned = ptr_is_owned(msg);
18772         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18773         msg_conv.is_owned = false;
18774         (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
18775 }
18776
18777 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) {
18778         void* this_arg_ptr = untag_ptr(this_arg);
18779         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18780         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
18781         LDKPublicKey their_node_id_ref;
18782         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18783         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18784         LDKClosingSigned msg_conv;
18785         msg_conv.inner = untag_ptr(msg);
18786         msg_conv.is_owned = ptr_is_owned(msg);
18787         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18788         msg_conv.is_owned = false;
18789         (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
18790 }
18791
18792 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) {
18793         void* this_arg_ptr = untag_ptr(this_arg);
18794         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18795         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
18796         LDKPublicKey their_node_id_ref;
18797         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18798         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18799         LDKStfu msg_conv;
18800         msg_conv.inner = untag_ptr(msg);
18801         msg_conv.is_owned = ptr_is_owned(msg);
18802         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18803         msg_conv.is_owned = false;
18804         (this_arg_conv->handle_stfu)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
18805 }
18806
18807 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1splice(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
18808         void* this_arg_ptr = untag_ptr(this_arg);
18809         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18810         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
18811         LDKPublicKey their_node_id_ref;
18812         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18813         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18814         LDKSplice msg_conv;
18815         msg_conv.inner = untag_ptr(msg);
18816         msg_conv.is_owned = ptr_is_owned(msg);
18817         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18818         msg_conv.is_owned = false;
18819         (this_arg_conv->handle_splice)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
18820 }
18821
18822 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1splice_1ack(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
18823         void* this_arg_ptr = untag_ptr(this_arg);
18824         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18825         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
18826         LDKPublicKey their_node_id_ref;
18827         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18828         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18829         LDKSpliceAck msg_conv;
18830         msg_conv.inner = untag_ptr(msg);
18831         msg_conv.is_owned = ptr_is_owned(msg);
18832         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18833         msg_conv.is_owned = false;
18834         (this_arg_conv->handle_splice_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
18835 }
18836
18837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1splice_1locked(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
18838         void* this_arg_ptr = untag_ptr(this_arg);
18839         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18840         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
18841         LDKPublicKey their_node_id_ref;
18842         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18843         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18844         LDKSpliceLocked msg_conv;
18845         msg_conv.inner = untag_ptr(msg);
18846         msg_conv.is_owned = ptr_is_owned(msg);
18847         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18848         msg_conv.is_owned = false;
18849         (this_arg_conv->handle_splice_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
18850 }
18851
18852 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) {
18853         void* this_arg_ptr = untag_ptr(this_arg);
18854         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18855         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
18856         LDKPublicKey their_node_id_ref;
18857         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18858         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18859         LDKTxAddInput msg_conv;
18860         msg_conv.inner = untag_ptr(msg);
18861         msg_conv.is_owned = ptr_is_owned(msg);
18862         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18863         msg_conv.is_owned = false;
18864         (this_arg_conv->handle_tx_add_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
18865 }
18866
18867 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) {
18868         void* this_arg_ptr = untag_ptr(this_arg);
18869         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18870         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
18871         LDKPublicKey their_node_id_ref;
18872         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18873         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18874         LDKTxAddOutput msg_conv;
18875         msg_conv.inner = untag_ptr(msg);
18876         msg_conv.is_owned = ptr_is_owned(msg);
18877         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18878         msg_conv.is_owned = false;
18879         (this_arg_conv->handle_tx_add_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
18880 }
18881
18882 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) {
18883         void* this_arg_ptr = untag_ptr(this_arg);
18884         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18885         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
18886         LDKPublicKey their_node_id_ref;
18887         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18888         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18889         LDKTxRemoveInput msg_conv;
18890         msg_conv.inner = untag_ptr(msg);
18891         msg_conv.is_owned = ptr_is_owned(msg);
18892         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18893         msg_conv.is_owned = false;
18894         (this_arg_conv->handle_tx_remove_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
18895 }
18896
18897 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) {
18898         void* this_arg_ptr = untag_ptr(this_arg);
18899         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18900         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
18901         LDKPublicKey their_node_id_ref;
18902         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18903         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18904         LDKTxRemoveOutput msg_conv;
18905         msg_conv.inner = untag_ptr(msg);
18906         msg_conv.is_owned = ptr_is_owned(msg);
18907         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18908         msg_conv.is_owned = false;
18909         (this_arg_conv->handle_tx_remove_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
18910 }
18911
18912 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) {
18913         void* this_arg_ptr = untag_ptr(this_arg);
18914         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18915         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
18916         LDKPublicKey their_node_id_ref;
18917         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18918         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18919         LDKTxComplete msg_conv;
18920         msg_conv.inner = untag_ptr(msg);
18921         msg_conv.is_owned = ptr_is_owned(msg);
18922         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18923         msg_conv.is_owned = false;
18924         (this_arg_conv->handle_tx_complete)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
18925 }
18926
18927 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) {
18928         void* this_arg_ptr = untag_ptr(this_arg);
18929         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18930         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
18931         LDKPublicKey their_node_id_ref;
18932         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18933         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18934         LDKTxSignatures msg_conv;
18935         msg_conv.inner = untag_ptr(msg);
18936         msg_conv.is_owned = ptr_is_owned(msg);
18937         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18938         msg_conv.is_owned = false;
18939         (this_arg_conv->handle_tx_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
18940 }
18941
18942 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) {
18943         void* this_arg_ptr = untag_ptr(this_arg);
18944         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18945         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
18946         LDKPublicKey their_node_id_ref;
18947         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18948         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18949         LDKTxInitRbf msg_conv;
18950         msg_conv.inner = untag_ptr(msg);
18951         msg_conv.is_owned = ptr_is_owned(msg);
18952         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18953         msg_conv.is_owned = false;
18954         (this_arg_conv->handle_tx_init_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
18955 }
18956
18957 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) {
18958         void* this_arg_ptr = untag_ptr(this_arg);
18959         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18960         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
18961         LDKPublicKey their_node_id_ref;
18962         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18963         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18964         LDKTxAckRbf msg_conv;
18965         msg_conv.inner = untag_ptr(msg);
18966         msg_conv.is_owned = ptr_is_owned(msg);
18967         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18968         msg_conv.is_owned = false;
18969         (this_arg_conv->handle_tx_ack_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
18970 }
18971
18972 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) {
18973         void* this_arg_ptr = untag_ptr(this_arg);
18974         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18975         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
18976         LDKPublicKey their_node_id_ref;
18977         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18978         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18979         LDKTxAbort msg_conv;
18980         msg_conv.inner = untag_ptr(msg);
18981         msg_conv.is_owned = ptr_is_owned(msg);
18982         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18983         msg_conv.is_owned = false;
18984         (this_arg_conv->handle_tx_abort)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
18985 }
18986
18987 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) {
18988         void* this_arg_ptr = untag_ptr(this_arg);
18989         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18990         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
18991         LDKPublicKey their_node_id_ref;
18992         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18993         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18994         LDKUpdateAddHTLC msg_conv;
18995         msg_conv.inner = untag_ptr(msg);
18996         msg_conv.is_owned = ptr_is_owned(msg);
18997         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18998         msg_conv.is_owned = false;
18999         (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
19000 }
19001
19002 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) {
19003         void* this_arg_ptr = untag_ptr(this_arg);
19004         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19005         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
19006         LDKPublicKey their_node_id_ref;
19007         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
19008         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
19009         LDKUpdateFulfillHTLC msg_conv;
19010         msg_conv.inner = untag_ptr(msg);
19011         msg_conv.is_owned = ptr_is_owned(msg);
19012         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19013         msg_conv.is_owned = false;
19014         (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
19015 }
19016
19017 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) {
19018         void* this_arg_ptr = untag_ptr(this_arg);
19019         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19020         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
19021         LDKPublicKey their_node_id_ref;
19022         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
19023         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
19024         LDKUpdateFailHTLC msg_conv;
19025         msg_conv.inner = untag_ptr(msg);
19026         msg_conv.is_owned = ptr_is_owned(msg);
19027         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19028         msg_conv.is_owned = false;
19029         (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
19030 }
19031
19032 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) {
19033         void* this_arg_ptr = untag_ptr(this_arg);
19034         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19035         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
19036         LDKPublicKey their_node_id_ref;
19037         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
19038         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
19039         LDKUpdateFailMalformedHTLC msg_conv;
19040         msg_conv.inner = untag_ptr(msg);
19041         msg_conv.is_owned = ptr_is_owned(msg);
19042         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19043         msg_conv.is_owned = false;
19044         (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
19045 }
19046
19047 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) {
19048         void* this_arg_ptr = untag_ptr(this_arg);
19049         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19050         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
19051         LDKPublicKey their_node_id_ref;
19052         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
19053         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
19054         LDKCommitmentSigned msg_conv;
19055         msg_conv.inner = untag_ptr(msg);
19056         msg_conv.is_owned = ptr_is_owned(msg);
19057         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19058         msg_conv.is_owned = false;
19059         (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
19060 }
19061
19062 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) {
19063         void* this_arg_ptr = untag_ptr(this_arg);
19064         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19065         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
19066         LDKPublicKey their_node_id_ref;
19067         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
19068         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
19069         LDKRevokeAndACK msg_conv;
19070         msg_conv.inner = untag_ptr(msg);
19071         msg_conv.is_owned = ptr_is_owned(msg);
19072         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19073         msg_conv.is_owned = false;
19074         (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
19075 }
19076
19077 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) {
19078         void* this_arg_ptr = untag_ptr(this_arg);
19079         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19080         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
19081         LDKPublicKey their_node_id_ref;
19082         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
19083         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
19084         LDKUpdateFee msg_conv;
19085         msg_conv.inner = untag_ptr(msg);
19086         msg_conv.is_owned = ptr_is_owned(msg);
19087         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19088         msg_conv.is_owned = false;
19089         (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
19090 }
19091
19092 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) {
19093         void* this_arg_ptr = untag_ptr(this_arg);
19094         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19095         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
19096         LDKPublicKey their_node_id_ref;
19097         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
19098         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
19099         LDKAnnouncementSignatures msg_conv;
19100         msg_conv.inner = untag_ptr(msg);
19101         msg_conv.is_owned = ptr_is_owned(msg);
19102         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19103         msg_conv.is_owned = false;
19104         (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
19105 }
19106
19107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id) {
19108         void* this_arg_ptr = untag_ptr(this_arg);
19109         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19110         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
19111         LDKPublicKey their_node_id_ref;
19112         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
19113         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
19114         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
19115 }
19116
19117 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) {
19118         void* this_arg_ptr = untag_ptr(this_arg);
19119         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19120         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
19121         LDKPublicKey their_node_id_ref;
19122         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
19123         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
19124         LDKInit msg_conv;
19125         msg_conv.inner = untag_ptr(msg);
19126         msg_conv.is_owned = ptr_is_owned(msg);
19127         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19128         msg_conv.is_owned = false;
19129         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
19130         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv, inbound);
19131         return tag_ptr(ret_conv, true);
19132 }
19133
19134 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) {
19135         void* this_arg_ptr = untag_ptr(this_arg);
19136         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19137         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
19138         LDKPublicKey their_node_id_ref;
19139         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
19140         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
19141         LDKChannelReestablish msg_conv;
19142         msg_conv.inner = untag_ptr(msg);
19143         msg_conv.is_owned = ptr_is_owned(msg);
19144         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19145         msg_conv.is_owned = false;
19146         (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
19147 }
19148
19149 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) {
19150         void* this_arg_ptr = untag_ptr(this_arg);
19151         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19152         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
19153         LDKPublicKey their_node_id_ref;
19154         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
19155         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
19156         LDKChannelUpdate msg_conv;
19157         msg_conv.inner = untag_ptr(msg);
19158         msg_conv.is_owned = ptr_is_owned(msg);
19159         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19160         msg_conv.is_owned = false;
19161         (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
19162 }
19163
19164 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) {
19165         void* this_arg_ptr = untag_ptr(this_arg);
19166         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19167         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
19168         LDKPublicKey their_node_id_ref;
19169         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
19170         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
19171         LDKErrorMessage msg_conv;
19172         msg_conv.inner = untag_ptr(msg);
19173         msg_conv.is_owned = ptr_is_owned(msg);
19174         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19175         msg_conv.is_owned = false;
19176         (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
19177 }
19178
19179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
19180         void* this_arg_ptr = untag_ptr(this_arg);
19181         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19182         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
19183         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
19184         int64_t ret_ref = 0;
19185         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19186         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
19187         return ret_ref;
19188 }
19189
19190 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) {
19191         void* this_arg_ptr = untag_ptr(this_arg);
19192         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19193         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
19194         LDKPublicKey their_node_id_ref;
19195         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
19196         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
19197         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
19198         int64_t ret_ref = 0;
19199         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19200         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
19201         return ret_ref;
19202 }
19203
19204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1get_1chain_1hashes(JNIEnv *env, jclass clz, int64_t this_arg) {
19205         void* this_arg_ptr = untag_ptr(this_arg);
19206         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19207         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
19208         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
19209         *ret_copy = (this_arg_conv->get_chain_hashes)(this_arg_conv->this_arg);
19210         int64_t ret_ref = tag_ptr(ret_copy, true);
19211         return ret_ref;
19212 }
19213
19214 typedef struct LDKOffersMessageHandler_JCalls {
19215         atomic_size_t refcnt;
19216         JavaVM *vm;
19217         jweak o;
19218         jmethodID handle_message_meth;
19219         jmethodID release_pending_messages_meth;
19220 } LDKOffersMessageHandler_JCalls;
19221 static void LDKOffersMessageHandler_JCalls_free(void* this_arg) {
19222         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
19223         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
19224                 JNIEnv *env;
19225                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19226                 if (get_jenv_res == JNI_EDETACHED) {
19227                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19228                 } else {
19229                         DO_ASSERT(get_jenv_res == JNI_OK);
19230                 }
19231                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
19232                 if (get_jenv_res == JNI_EDETACHED) {
19233                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19234                 }
19235                 FREE(j_calls);
19236         }
19237 }
19238 LDKCOption_OffersMessageZ handle_message_LDKOffersMessageHandler_jcall(const void* this_arg, LDKOffersMessage message) {
19239         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
19240         JNIEnv *env;
19241         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19242         if (get_jenv_res == JNI_EDETACHED) {
19243                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19244         } else {
19245                 DO_ASSERT(get_jenv_res == JNI_OK);
19246         }
19247         LDKOffersMessage *message_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
19248         *message_copy = message;
19249         int64_t message_ref = tag_ptr(message_copy, true);
19250         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19251         CHECK(obj != NULL);
19252         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_message_meth, message_ref);
19253         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19254                 (*env)->ExceptionDescribe(env);
19255                 (*env)->FatalError(env, "A call to handle_message in LDKOffersMessageHandler from rust threw an exception.");
19256         }
19257         void* ret_ptr = untag_ptr(ret);
19258         CHECK_ACCESS(ret_ptr);
19259         LDKCOption_OffersMessageZ ret_conv = *(LDKCOption_OffersMessageZ*)(ret_ptr);
19260         FREE(untag_ptr(ret));
19261         if (get_jenv_res == JNI_EDETACHED) {
19262                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19263         }
19264         return ret_conv;
19265 }
19266 LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ release_pending_messages_LDKOffersMessageHandler_jcall(const void* this_arg) {
19267         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
19268         JNIEnv *env;
19269         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19270         if (get_jenv_res == JNI_EDETACHED) {
19271                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19272         } else {
19273                 DO_ASSERT(get_jenv_res == JNI_OK);
19274         }
19275         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19276         CHECK(obj != NULL);
19277         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_messages_meth);
19278         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19279                 (*env)->ExceptionDescribe(env);
19280                 (*env)->FatalError(env, "A call to release_pending_messages in LDKOffersMessageHandler from rust threw an exception.");
19281         }
19282         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret_constr;
19283         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
19284         if (ret_constr.datalen > 0)
19285                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ Elements");
19286         else
19287                 ret_constr.data = NULL;
19288         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
19289         for (size_t x = 0; x < ret_constr.datalen; x++) {
19290                 int64_t ret_conv_49 = ret_vals[x];
19291                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
19292                 CHECK_ACCESS(ret_conv_49_ptr);
19293                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ ret_conv_49_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(ret_conv_49_ptr);
19294                 FREE(untag_ptr(ret_conv_49));
19295                 ret_constr.data[x] = ret_conv_49_conv;
19296         }
19297         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
19298         if (get_jenv_res == JNI_EDETACHED) {
19299                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19300         }
19301         return ret_constr;
19302 }
19303 static void LDKOffersMessageHandler_JCalls_cloned(LDKOffersMessageHandler* new_obj) {
19304         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) new_obj->this_arg;
19305         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
19306 }
19307 static inline LDKOffersMessageHandler LDKOffersMessageHandler_init (JNIEnv *env, jclass clz, jobject o) {
19308         jclass c = (*env)->GetObjectClass(env, o);
19309         CHECK(c != NULL);
19310         LDKOffersMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOffersMessageHandler_JCalls), "LDKOffersMessageHandler_JCalls");
19311         atomic_init(&calls->refcnt, 1);
19312         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
19313         calls->o = (*env)->NewWeakGlobalRef(env, o);
19314         calls->handle_message_meth = (*env)->GetMethodID(env, c, "handle_message", "(J)J");
19315         CHECK(calls->handle_message_meth != NULL);
19316         calls->release_pending_messages_meth = (*env)->GetMethodID(env, c, "release_pending_messages", "()[J");
19317         CHECK(calls->release_pending_messages_meth != NULL);
19318
19319         LDKOffersMessageHandler ret = {
19320                 .this_arg = (void*) calls,
19321                 .handle_message = handle_message_LDKOffersMessageHandler_jcall,
19322                 .release_pending_messages = release_pending_messages_LDKOffersMessageHandler_jcall,
19323                 .free = LDKOffersMessageHandler_JCalls_free,
19324         };
19325         return ret;
19326 }
19327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOffersMessageHandler_1new(JNIEnv *env, jclass clz, jobject o) {
19328         LDKOffersMessageHandler *res_ptr = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
19329         *res_ptr = LDKOffersMessageHandler_init(env, clz, o);
19330         return tag_ptr(res_ptr, true);
19331 }
19332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessageHandler_1handle_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t message) {
19333         void* this_arg_ptr = untag_ptr(this_arg);
19334         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19335         LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr;
19336         void* message_ptr = untag_ptr(message);
19337         CHECK_ACCESS(message_ptr);
19338         LDKOffersMessage message_conv = *(LDKOffersMessage*)(message_ptr);
19339         message_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(message));
19340         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
19341         *ret_copy = (this_arg_conv->handle_message)(this_arg_conv->this_arg, message_conv);
19342         int64_t ret_ref = tag_ptr(ret_copy, true);
19343         return ret_ref;
19344 }
19345
19346 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_OffersMessageHandler_1release_1pending_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
19347         void* this_arg_ptr = untag_ptr(this_arg);
19348         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19349         LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr;
19350         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret_var = (this_arg_conv->release_pending_messages)(this_arg_conv->this_arg);
19351         int64_tArray ret_arr = NULL;
19352         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
19353         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
19354         for (size_t x = 0; x < ret_var.datalen; x++) {
19355                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
19356                 *ret_conv_49_conv = ret_var.data[x];
19357                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
19358         }
19359         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
19360         FREE(ret_var.data);
19361         return ret_arr;
19362 }
19363
19364 typedef struct LDKRoutingMessageHandler_JCalls {
19365         atomic_size_t refcnt;
19366         JavaVM *vm;
19367         jweak o;
19368         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
19369         jmethodID handle_node_announcement_meth;
19370         jmethodID handle_channel_announcement_meth;
19371         jmethodID handle_channel_update_meth;
19372         jmethodID get_next_channel_announcement_meth;
19373         jmethodID get_next_node_announcement_meth;
19374         jmethodID peer_connected_meth;
19375         jmethodID handle_reply_channel_range_meth;
19376         jmethodID handle_reply_short_channel_ids_end_meth;
19377         jmethodID handle_query_channel_range_meth;
19378         jmethodID handle_query_short_channel_ids_meth;
19379         jmethodID processing_queue_high_meth;
19380         jmethodID provided_node_features_meth;
19381         jmethodID provided_init_features_meth;
19382 } LDKRoutingMessageHandler_JCalls;
19383 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
19384         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
19385         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
19386                 JNIEnv *env;
19387                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19388                 if (get_jenv_res == JNI_EDETACHED) {
19389                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19390                 } else {
19391                         DO_ASSERT(get_jenv_res == JNI_OK);
19392                 }
19393                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
19394                 if (get_jenv_res == JNI_EDETACHED) {
19395                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19396                 }
19397                 FREE(j_calls);
19398         }
19399 }
19400 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
19401         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
19402         JNIEnv *env;
19403         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19404         if (get_jenv_res == JNI_EDETACHED) {
19405                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19406         } else {
19407                 DO_ASSERT(get_jenv_res == JNI_OK);
19408         }
19409         LDKNodeAnnouncement msg_var = *msg;
19410         int64_t msg_ref = 0;
19411         msg_var = NodeAnnouncement_clone(&msg_var);
19412         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19413         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19414         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19415         CHECK(obj != NULL);
19416         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
19417         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19418                 (*env)->ExceptionDescribe(env);
19419                 (*env)->FatalError(env, "A call to handle_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
19420         }
19421         void* ret_ptr = untag_ptr(ret);
19422         CHECK_ACCESS(ret_ptr);
19423         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
19424         FREE(untag_ptr(ret));
19425         if (get_jenv_res == JNI_EDETACHED) {
19426                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19427         }
19428         return ret_conv;
19429 }
19430 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
19431         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
19432         JNIEnv *env;
19433         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19434         if (get_jenv_res == JNI_EDETACHED) {
19435                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19436         } else {
19437                 DO_ASSERT(get_jenv_res == JNI_OK);
19438         }
19439         LDKChannelAnnouncement msg_var = *msg;
19440         int64_t msg_ref = 0;
19441         msg_var = ChannelAnnouncement_clone(&msg_var);
19442         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19443         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19444         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19445         CHECK(obj != NULL);
19446         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
19447         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19448                 (*env)->ExceptionDescribe(env);
19449                 (*env)->FatalError(env, "A call to handle_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
19450         }
19451         void* ret_ptr = untag_ptr(ret);
19452         CHECK_ACCESS(ret_ptr);
19453         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
19454         FREE(untag_ptr(ret));
19455         if (get_jenv_res == JNI_EDETACHED) {
19456                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19457         }
19458         return ret_conv;
19459 }
19460 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
19461         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
19462         JNIEnv *env;
19463         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19464         if (get_jenv_res == JNI_EDETACHED) {
19465                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19466         } else {
19467                 DO_ASSERT(get_jenv_res == JNI_OK);
19468         }
19469         LDKChannelUpdate msg_var = *msg;
19470         int64_t msg_ref = 0;
19471         msg_var = ChannelUpdate_clone(&msg_var);
19472         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19473         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19474         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19475         CHECK(obj != NULL);
19476         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
19477         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19478                 (*env)->ExceptionDescribe(env);
19479                 (*env)->FatalError(env, "A call to handle_channel_update in LDKRoutingMessageHandler from rust threw an exception.");
19480         }
19481         void* ret_ptr = untag_ptr(ret);
19482         CHECK_ACCESS(ret_ptr);
19483         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
19484         FREE(untag_ptr(ret));
19485         if (get_jenv_res == JNI_EDETACHED) {
19486                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19487         }
19488         return ret_conv;
19489 }
19490 LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point) {
19491         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_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         int64_t starting_point_conv = starting_point;
19500         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19501         CHECK(obj != NULL);
19502         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_next_channel_announcement_meth, starting_point_conv);
19503         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19504                 (*env)->ExceptionDescribe(env);
19505                 (*env)->FatalError(env, "A call to get_next_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
19506         }
19507         void* ret_ptr = untag_ptr(ret);
19508         CHECK_ACCESS(ret_ptr);
19509         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(ret_ptr);
19510         FREE(untag_ptr(ret));
19511         if (get_jenv_res == JNI_EDETACHED) {
19512                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19513         }
19514         return ret_conv;
19515 }
19516 LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKNodeId starting_point) {
19517         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
19518         JNIEnv *env;
19519         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19520         if (get_jenv_res == JNI_EDETACHED) {
19521                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19522         } else {
19523                 DO_ASSERT(get_jenv_res == JNI_OK);
19524         }
19525         LDKNodeId starting_point_var = starting_point;
19526         int64_t starting_point_ref = 0;
19527         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_var);
19528         starting_point_ref = tag_ptr(starting_point_var.inner, starting_point_var.is_owned);
19529         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19530         CHECK(obj != NULL);
19531         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_next_node_announcement_meth, starting_point_ref);
19532         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19533                 (*env)->ExceptionDescribe(env);
19534                 (*env)->FatalError(env, "A call to get_next_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
19535         }
19536         LDKNodeAnnouncement ret_conv;
19537         ret_conv.inner = untag_ptr(ret);
19538         ret_conv.is_owned = ptr_is_owned(ret);
19539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
19540         if (get_jenv_res == JNI_EDETACHED) {
19541                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19542         }
19543         return ret_conv;
19544 }
19545 LDKCResult_NoneNoneZ peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
19546         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
19547         JNIEnv *env;
19548         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19549         if (get_jenv_res == JNI_EDETACHED) {
19550                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19551         } else {
19552                 DO_ASSERT(get_jenv_res == JNI_OK);
19553         }
19554         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19555         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19556         LDKInit init_var = *init;
19557         int64_t init_ref = 0;
19558         init_var = Init_clone(&init_var);
19559         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
19560         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
19561         jboolean inbound_conv = inbound;
19562         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19563         CHECK(obj != NULL);
19564         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, init_ref, inbound_conv);
19565         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19566                 (*env)->ExceptionDescribe(env);
19567                 (*env)->FatalError(env, "A call to peer_connected in LDKRoutingMessageHandler from rust threw an exception.");
19568         }
19569         void* ret_ptr = untag_ptr(ret);
19570         CHECK_ACCESS(ret_ptr);
19571         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
19572         FREE(untag_ptr(ret));
19573         if (get_jenv_res == JNI_EDETACHED) {
19574                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19575         }
19576         return ret_conv;
19577 }
19578 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
19579         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
19580         JNIEnv *env;
19581         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19582         if (get_jenv_res == JNI_EDETACHED) {
19583                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19584         } else {
19585                 DO_ASSERT(get_jenv_res == JNI_OK);
19586         }
19587         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19588         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19589         LDKReplyChannelRange msg_var = msg;
19590         int64_t msg_ref = 0;
19591         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19592         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19593         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19594         CHECK(obj != NULL);
19595         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
19596         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19597                 (*env)->ExceptionDescribe(env);
19598                 (*env)->FatalError(env, "A call to handle_reply_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
19599         }
19600         void* ret_ptr = untag_ptr(ret);
19601         CHECK_ACCESS(ret_ptr);
19602         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
19603         FREE(untag_ptr(ret));
19604         if (get_jenv_res == JNI_EDETACHED) {
19605                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19606         }
19607         return ret_conv;
19608 }
19609 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
19610         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
19611         JNIEnv *env;
19612         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19613         if (get_jenv_res == JNI_EDETACHED) {
19614                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19615         } else {
19616                 DO_ASSERT(get_jenv_res == JNI_OK);
19617         }
19618         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19619         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19620         LDKReplyShortChannelIdsEnd msg_var = msg;
19621         int64_t msg_ref = 0;
19622         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19623         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19624         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19625         CHECK(obj != NULL);
19626         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
19627         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19628                 (*env)->ExceptionDescribe(env);
19629                 (*env)->FatalError(env, "A call to handle_reply_short_channel_ids_end in LDKRoutingMessageHandler from rust threw an exception.");
19630         }
19631         void* ret_ptr = untag_ptr(ret);
19632         CHECK_ACCESS(ret_ptr);
19633         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
19634         FREE(untag_ptr(ret));
19635         if (get_jenv_res == JNI_EDETACHED) {
19636                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19637         }
19638         return ret_conv;
19639 }
19640 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
19641         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
19642         JNIEnv *env;
19643         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19644         if (get_jenv_res == JNI_EDETACHED) {
19645                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19646         } else {
19647                 DO_ASSERT(get_jenv_res == JNI_OK);
19648         }
19649         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19650         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19651         LDKQueryChannelRange msg_var = msg;
19652         int64_t msg_ref = 0;
19653         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19654         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19655         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19656         CHECK(obj != NULL);
19657         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
19658         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19659                 (*env)->ExceptionDescribe(env);
19660                 (*env)->FatalError(env, "A call to handle_query_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
19661         }
19662         void* ret_ptr = untag_ptr(ret);
19663         CHECK_ACCESS(ret_ptr);
19664         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
19665         FREE(untag_ptr(ret));
19666         if (get_jenv_res == JNI_EDETACHED) {
19667                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19668         }
19669         return ret_conv;
19670 }
19671 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
19672         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
19673         JNIEnv *env;
19674         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19675         if (get_jenv_res == JNI_EDETACHED) {
19676                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19677         } else {
19678                 DO_ASSERT(get_jenv_res == JNI_OK);
19679         }
19680         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19681         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19682         LDKQueryShortChannelIds msg_var = msg;
19683         int64_t msg_ref = 0;
19684         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19685         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19686         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19687         CHECK(obj != NULL);
19688         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
19689         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19690                 (*env)->ExceptionDescribe(env);
19691                 (*env)->FatalError(env, "A call to handle_query_short_channel_ids in LDKRoutingMessageHandler from rust threw an exception.");
19692         }
19693         void* ret_ptr = untag_ptr(ret);
19694         CHECK_ACCESS(ret_ptr);
19695         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
19696         FREE(untag_ptr(ret));
19697         if (get_jenv_res == JNI_EDETACHED) {
19698                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19699         }
19700         return ret_conv;
19701 }
19702 bool processing_queue_high_LDKRoutingMessageHandler_jcall(const void* this_arg) {
19703         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
19704         JNIEnv *env;
19705         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19706         if (get_jenv_res == JNI_EDETACHED) {
19707                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19708         } else {
19709                 DO_ASSERT(get_jenv_res == JNI_OK);
19710         }
19711         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19712         CHECK(obj != NULL);
19713         jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->processing_queue_high_meth);
19714         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19715                 (*env)->ExceptionDescribe(env);
19716                 (*env)->FatalError(env, "A call to processing_queue_high in LDKRoutingMessageHandler from rust threw an exception.");
19717         }
19718         if (get_jenv_res == JNI_EDETACHED) {
19719                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19720         }
19721         return ret;
19722 }
19723 LDKNodeFeatures provided_node_features_LDKRoutingMessageHandler_jcall(const void* this_arg) {
19724         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
19725         JNIEnv *env;
19726         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19727         if (get_jenv_res == JNI_EDETACHED) {
19728                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19729         } else {
19730                 DO_ASSERT(get_jenv_res == JNI_OK);
19731         }
19732         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19733         CHECK(obj != NULL);
19734         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
19735         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19736                 (*env)->ExceptionDescribe(env);
19737                 (*env)->FatalError(env, "A call to provided_node_features in LDKRoutingMessageHandler from rust threw an exception.");
19738         }
19739         LDKNodeFeatures ret_conv;
19740         ret_conv.inner = untag_ptr(ret);
19741         ret_conv.is_owned = ptr_is_owned(ret);
19742         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
19743         if (get_jenv_res == JNI_EDETACHED) {
19744                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19745         }
19746         return ret_conv;
19747 }
19748 LDKInitFeatures provided_init_features_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
19749         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
19750         JNIEnv *env;
19751         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19752         if (get_jenv_res == JNI_EDETACHED) {
19753                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19754         } else {
19755                 DO_ASSERT(get_jenv_res == JNI_OK);
19756         }
19757         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19758         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19759         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19760         CHECK(obj != NULL);
19761         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
19762         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19763                 (*env)->ExceptionDescribe(env);
19764                 (*env)->FatalError(env, "A call to provided_init_features in LDKRoutingMessageHandler from rust threw an exception.");
19765         }
19766         LDKInitFeatures ret_conv;
19767         ret_conv.inner = untag_ptr(ret);
19768         ret_conv.is_owned = ptr_is_owned(ret);
19769         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
19770         if (get_jenv_res == JNI_EDETACHED) {
19771                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19772         }
19773         return ret_conv;
19774 }
19775 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
19776         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
19777         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
19778         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
19779 }
19780 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
19781         jclass c = (*env)->GetObjectClass(env, o);
19782         CHECK(c != NULL);
19783         LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
19784         atomic_init(&calls->refcnt, 1);
19785         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
19786         calls->o = (*env)->NewWeakGlobalRef(env, o);
19787         calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
19788         CHECK(calls->handle_node_announcement_meth != NULL);
19789         calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
19790         CHECK(calls->handle_channel_announcement_meth != NULL);
19791         calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
19792         CHECK(calls->handle_channel_update_meth != NULL);
19793         calls->get_next_channel_announcement_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcement", "(J)J");
19794         CHECK(calls->get_next_channel_announcement_meth != NULL);
19795         calls->get_next_node_announcement_meth = (*env)->GetMethodID(env, c, "get_next_node_announcement", "(J)J");
19796         CHECK(calls->get_next_node_announcement_meth != NULL);
19797         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJZ)J");
19798         CHECK(calls->peer_connected_meth != NULL);
19799         calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
19800         CHECK(calls->handle_reply_channel_range_meth != NULL);
19801         calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
19802         CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
19803         calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
19804         CHECK(calls->handle_query_channel_range_meth != NULL);
19805         calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
19806         CHECK(calls->handle_query_short_channel_ids_meth != NULL);
19807         calls->processing_queue_high_meth = (*env)->GetMethodID(env, c, "processing_queue_high", "()Z");
19808         CHECK(calls->processing_queue_high_meth != NULL);
19809         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
19810         CHECK(calls->provided_node_features_meth != NULL);
19811         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
19812         CHECK(calls->provided_init_features_meth != NULL);
19813
19814         LDKRoutingMessageHandler ret = {
19815                 .this_arg = (void*) calls,
19816                 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
19817                 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
19818                 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
19819                 .get_next_channel_announcement = get_next_channel_announcement_LDKRoutingMessageHandler_jcall,
19820                 .get_next_node_announcement = get_next_node_announcement_LDKRoutingMessageHandler_jcall,
19821                 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
19822                 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
19823                 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
19824                 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
19825                 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
19826                 .processing_queue_high = processing_queue_high_LDKRoutingMessageHandler_jcall,
19827                 .provided_node_features = provided_node_features_LDKRoutingMessageHandler_jcall,
19828                 .provided_init_features = provided_init_features_LDKRoutingMessageHandler_jcall,
19829                 .free = LDKRoutingMessageHandler_JCalls_free,
19830                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
19831         };
19832         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
19833         return ret;
19834 }
19835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
19836         LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
19837         *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
19838         return tag_ptr(res_ptr, true);
19839 }
19840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
19841         LDKRoutingMessageHandler *inp = (LDKRoutingMessageHandler *)untag_ptr(arg);
19842         return tag_ptr(&inp->MessageSendEventsProvider, false);
19843 }
19844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
19845         void* this_arg_ptr = untag_ptr(this_arg);
19846         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19847         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
19848         LDKNodeAnnouncement msg_conv;
19849         msg_conv.inner = untag_ptr(msg);
19850         msg_conv.is_owned = ptr_is_owned(msg);
19851         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19852         msg_conv.is_owned = false;
19853         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
19854         *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
19855         return tag_ptr(ret_conv, true);
19856 }
19857
19858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
19859         void* this_arg_ptr = untag_ptr(this_arg);
19860         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19861         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
19862         LDKChannelAnnouncement msg_conv;
19863         msg_conv.inner = untag_ptr(msg);
19864         msg_conv.is_owned = ptr_is_owned(msg);
19865         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19866         msg_conv.is_owned = false;
19867         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
19868         *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
19869         return tag_ptr(ret_conv, true);
19870 }
19871
19872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
19873         void* this_arg_ptr = untag_ptr(this_arg);
19874         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19875         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
19876         LDKChannelUpdate msg_conv;
19877         msg_conv.inner = untag_ptr(msg);
19878         msg_conv.is_owned = ptr_is_owned(msg);
19879         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19880         msg_conv.is_owned = false;
19881         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
19882         *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
19883         return tag_ptr(ret_conv, true);
19884 }
19885
19886 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) {
19887         void* this_arg_ptr = untag_ptr(this_arg);
19888         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19889         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
19890         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
19891         *ret_copy = (this_arg_conv->get_next_channel_announcement)(this_arg_conv->this_arg, starting_point);
19892         int64_t ret_ref = tag_ptr(ret_copy, true);
19893         return ret_ref;
19894 }
19895
19896 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) {
19897         void* this_arg_ptr = untag_ptr(this_arg);
19898         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19899         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
19900         LDKNodeId starting_point_conv;
19901         starting_point_conv.inner = untag_ptr(starting_point);
19902         starting_point_conv.is_owned = ptr_is_owned(starting_point);
19903         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_conv);
19904         starting_point_conv = NodeId_clone(&starting_point_conv);
19905         LDKNodeAnnouncement ret_var = (this_arg_conv->get_next_node_announcement)(this_arg_conv->this_arg, starting_point_conv);
19906         int64_t ret_ref = 0;
19907         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19908         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
19909         return ret_ref;
19910 }
19911
19912 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) {
19913         void* this_arg_ptr = untag_ptr(this_arg);
19914         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19915         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
19916         LDKPublicKey their_node_id_ref;
19917         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
19918         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
19919         LDKInit init_conv;
19920         init_conv.inner = untag_ptr(init);
19921         init_conv.is_owned = ptr_is_owned(init);
19922         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
19923         init_conv.is_owned = false;
19924         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
19925         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
19926         return tag_ptr(ret_conv, true);
19927 }
19928
19929 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) {
19930         void* this_arg_ptr = untag_ptr(this_arg);
19931         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19932         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
19933         LDKPublicKey their_node_id_ref;
19934         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
19935         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
19936         LDKReplyChannelRange msg_conv;
19937         msg_conv.inner = untag_ptr(msg);
19938         msg_conv.is_owned = ptr_is_owned(msg);
19939         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19940         msg_conv = ReplyChannelRange_clone(&msg_conv);
19941         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19942         *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
19943         return tag_ptr(ret_conv, true);
19944 }
19945
19946 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) {
19947         void* this_arg_ptr = untag_ptr(this_arg);
19948         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19949         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
19950         LDKPublicKey their_node_id_ref;
19951         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
19952         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
19953         LDKReplyShortChannelIdsEnd msg_conv;
19954         msg_conv.inner = untag_ptr(msg);
19955         msg_conv.is_owned = ptr_is_owned(msg);
19956         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19957         msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
19958         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19959         *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
19960         return tag_ptr(ret_conv, true);
19961 }
19962
19963 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) {
19964         void* this_arg_ptr = untag_ptr(this_arg);
19965         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19966         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
19967         LDKPublicKey their_node_id_ref;
19968         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
19969         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
19970         LDKQueryChannelRange msg_conv;
19971         msg_conv.inner = untag_ptr(msg);
19972         msg_conv.is_owned = ptr_is_owned(msg);
19973         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19974         msg_conv = QueryChannelRange_clone(&msg_conv);
19975         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19976         *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
19977         return tag_ptr(ret_conv, true);
19978 }
19979
19980 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) {
19981         void* this_arg_ptr = untag_ptr(this_arg);
19982         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19983         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
19984         LDKPublicKey their_node_id_ref;
19985         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
19986         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
19987         LDKQueryShortChannelIds msg_conv;
19988         msg_conv.inner = untag_ptr(msg);
19989         msg_conv.is_owned = ptr_is_owned(msg);
19990         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19991         msg_conv = QueryShortChannelIds_clone(&msg_conv);
19992         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19993         *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
19994         return tag_ptr(ret_conv, true);
19995 }
19996
19997 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1processing_1queue_1high(JNIEnv *env, jclass clz, int64_t this_arg) {
19998         void* this_arg_ptr = untag_ptr(this_arg);
19999         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20000         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
20001         jboolean ret_conv = (this_arg_conv->processing_queue_high)(this_arg_conv->this_arg);
20002         return ret_conv;
20003 }
20004
20005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
20006         void* this_arg_ptr = untag_ptr(this_arg);
20007         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20008         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
20009         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
20010         int64_t ret_ref = 0;
20011         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20012         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
20013         return ret_ref;
20014 }
20015
20016 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) {
20017         void* this_arg_ptr = untag_ptr(this_arg);
20018         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20019         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
20020         LDKPublicKey their_node_id_ref;
20021         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20022         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20023         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
20024         int64_t ret_ref = 0;
20025         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20026         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
20027         return ret_ref;
20028 }
20029
20030 typedef struct LDKOnionMessageHandler_JCalls {
20031         atomic_size_t refcnt;
20032         JavaVM *vm;
20033         jweak o;
20034         jmethodID get_and_clear_connections_needed_meth;
20035         jmethodID handle_onion_message_meth;
20036         jmethodID next_onion_message_for_peer_meth;
20037         jmethodID peer_connected_meth;
20038         jmethodID peer_disconnected_meth;
20039         jmethodID timer_tick_occurred_meth;
20040         jmethodID provided_node_features_meth;
20041         jmethodID provided_init_features_meth;
20042 } LDKOnionMessageHandler_JCalls;
20043 static void LDKOnionMessageHandler_JCalls_free(void* this_arg) {
20044         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
20045         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
20046                 JNIEnv *env;
20047                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20048                 if (get_jenv_res == JNI_EDETACHED) {
20049                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20050                 } else {
20051                         DO_ASSERT(get_jenv_res == JNI_OK);
20052                 }
20053                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
20054                 if (get_jenv_res == JNI_EDETACHED) {
20055                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20056                 }
20057                 FREE(j_calls);
20058         }
20059 }
20060 LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ get_and_clear_connections_needed_LDKOnionMessageHandler_jcall(const void* this_arg) {
20061         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
20062         JNIEnv *env;
20063         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20064         if (get_jenv_res == JNI_EDETACHED) {
20065                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20066         } else {
20067                 DO_ASSERT(get_jenv_res == JNI_OK);
20068         }
20069         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20070         CHECK(obj != NULL);
20071         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_connections_needed_meth);
20072         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20073                 (*env)->ExceptionDescribe(env);
20074                 (*env)->FatalError(env, "A call to get_and_clear_connections_needed in LDKOnionMessageHandler from rust threw an exception.");
20075         }
20076         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ ret_constr;
20077         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
20078         if (ret_constr.datalen > 0)
20079                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ Elements");
20080         else
20081                 ret_constr.data = NULL;
20082         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
20083         for (size_t o = 0; o < ret_constr.datalen; o++) {
20084                 int64_t ret_conv_40 = ret_vals[o];
20085                 void* ret_conv_40_ptr = untag_ptr(ret_conv_40);
20086                 CHECK_ACCESS(ret_conv_40_ptr);
20087                 LDKC2Tuple_PublicKeyCVec_SocketAddressZZ ret_conv_40_conv = *(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)(ret_conv_40_ptr);
20088                 FREE(untag_ptr(ret_conv_40));
20089                 ret_constr.data[o] = ret_conv_40_conv;
20090         }
20091         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
20092         if (get_jenv_res == JNI_EDETACHED) {
20093                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20094         }
20095         return ret_constr;
20096 }
20097 void handle_onion_message_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id, const LDKOnionMessage * msg) {
20098         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
20099         JNIEnv *env;
20100         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20101         if (get_jenv_res == JNI_EDETACHED) {
20102                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20103         } else {
20104                 DO_ASSERT(get_jenv_res == JNI_OK);
20105         }
20106         int8_tArray peer_node_id_arr = (*env)->NewByteArray(env, 33);
20107         (*env)->SetByteArrayRegion(env, peer_node_id_arr, 0, 33, peer_node_id.compressed_form);
20108         LDKOnionMessage msg_var = *msg;
20109         int64_t msg_ref = 0;
20110         msg_var = OnionMessage_clone(&msg_var);
20111         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
20112         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
20113         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20114         CHECK(obj != NULL);
20115         (*env)->CallVoidMethod(env, obj, j_calls->handle_onion_message_meth, peer_node_id_arr, msg_ref);
20116         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20117                 (*env)->ExceptionDescribe(env);
20118                 (*env)->FatalError(env, "A call to handle_onion_message in LDKOnionMessageHandler from rust threw an exception.");
20119         }
20120         if (get_jenv_res == JNI_EDETACHED) {
20121                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20122         }
20123 }
20124 LDKOnionMessage next_onion_message_for_peer_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id) {
20125         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
20126         JNIEnv *env;
20127         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20128         if (get_jenv_res == JNI_EDETACHED) {
20129                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20130         } else {
20131                 DO_ASSERT(get_jenv_res == JNI_OK);
20132         }
20133         int8_tArray peer_node_id_arr = (*env)->NewByteArray(env, 33);
20134         (*env)->SetByteArrayRegion(env, peer_node_id_arr, 0, 33, peer_node_id.compressed_form);
20135         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20136         CHECK(obj != NULL);
20137         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->next_onion_message_for_peer_meth, peer_node_id_arr);
20138         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20139                 (*env)->ExceptionDescribe(env);
20140                 (*env)->FatalError(env, "A call to next_onion_message_for_peer in LDKOnionMessageHandler from rust threw an exception.");
20141         }
20142         LDKOnionMessage ret_conv;
20143         ret_conv.inner = untag_ptr(ret);
20144         ret_conv.is_owned = ptr_is_owned(ret);
20145         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
20146         if (get_jenv_res == JNI_EDETACHED) {
20147                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20148         }
20149         return ret_conv;
20150 }
20151 LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
20152         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
20153         JNIEnv *env;
20154         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20155         if (get_jenv_res == JNI_EDETACHED) {
20156                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20157         } else {
20158                 DO_ASSERT(get_jenv_res == JNI_OK);
20159         }
20160         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
20161         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
20162         LDKInit init_var = *init;
20163         int64_t init_ref = 0;
20164         init_var = Init_clone(&init_var);
20165         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
20166         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
20167         jboolean inbound_conv = inbound;
20168         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20169         CHECK(obj != NULL);
20170         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, init_ref, inbound_conv);
20171         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20172                 (*env)->ExceptionDescribe(env);
20173                 (*env)->FatalError(env, "A call to peer_connected in LDKOnionMessageHandler from rust threw an exception.");
20174         }
20175         void* ret_ptr = untag_ptr(ret);
20176         CHECK_ACCESS(ret_ptr);
20177         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
20178         FREE(untag_ptr(ret));
20179         if (get_jenv_res == JNI_EDETACHED) {
20180                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20181         }
20182         return ret_conv;
20183 }
20184 void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
20185         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
20186         JNIEnv *env;
20187         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20188         if (get_jenv_res == JNI_EDETACHED) {
20189                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20190         } else {
20191                 DO_ASSERT(get_jenv_res == JNI_OK);
20192         }
20193         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
20194         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
20195         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20196         CHECK(obj != NULL);
20197         (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr);
20198         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20199                 (*env)->ExceptionDescribe(env);
20200                 (*env)->FatalError(env, "A call to peer_disconnected in LDKOnionMessageHandler from rust threw an exception.");
20201         }
20202         if (get_jenv_res == JNI_EDETACHED) {
20203                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20204         }
20205 }
20206 void timer_tick_occurred_LDKOnionMessageHandler_jcall(const void* this_arg) {
20207         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
20208         JNIEnv *env;
20209         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20210         if (get_jenv_res == JNI_EDETACHED) {
20211                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20212         } else {
20213                 DO_ASSERT(get_jenv_res == JNI_OK);
20214         }
20215         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20216         CHECK(obj != NULL);
20217         (*env)->CallVoidMethod(env, obj, j_calls->timer_tick_occurred_meth);
20218         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20219                 (*env)->ExceptionDescribe(env);
20220                 (*env)->FatalError(env, "A call to timer_tick_occurred in LDKOnionMessageHandler from rust threw an exception.");
20221         }
20222         if (get_jenv_res == JNI_EDETACHED) {
20223                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20224         }
20225 }
20226 LDKNodeFeatures provided_node_features_LDKOnionMessageHandler_jcall(const void* this_arg) {
20227         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
20228         JNIEnv *env;
20229         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20230         if (get_jenv_res == JNI_EDETACHED) {
20231                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20232         } else {
20233                 DO_ASSERT(get_jenv_res == JNI_OK);
20234         }
20235         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20236         CHECK(obj != NULL);
20237         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
20238         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20239                 (*env)->ExceptionDescribe(env);
20240                 (*env)->FatalError(env, "A call to provided_node_features in LDKOnionMessageHandler from rust threw an exception.");
20241         }
20242         LDKNodeFeatures ret_conv;
20243         ret_conv.inner = untag_ptr(ret);
20244         ret_conv.is_owned = ptr_is_owned(ret);
20245         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
20246         if (get_jenv_res == JNI_EDETACHED) {
20247                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20248         }
20249         return ret_conv;
20250 }
20251 LDKInitFeatures provided_init_features_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
20252         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
20253         JNIEnv *env;
20254         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20255         if (get_jenv_res == JNI_EDETACHED) {
20256                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20257         } else {
20258                 DO_ASSERT(get_jenv_res == JNI_OK);
20259         }
20260         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
20261         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
20262         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20263         CHECK(obj != NULL);
20264         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
20265         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20266                 (*env)->ExceptionDescribe(env);
20267                 (*env)->FatalError(env, "A call to provided_init_features in LDKOnionMessageHandler from rust threw an exception.");
20268         }
20269         LDKInitFeatures ret_conv;
20270         ret_conv.inner = untag_ptr(ret);
20271         ret_conv.is_owned = ptr_is_owned(ret);
20272         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
20273         if (get_jenv_res == JNI_EDETACHED) {
20274                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20275         }
20276         return ret_conv;
20277 }
20278 static void LDKOnionMessageHandler_JCalls_cloned(LDKOnionMessageHandler* new_obj) {
20279         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) new_obj->this_arg;
20280         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
20281 }
20282 static inline LDKOnionMessageHandler LDKOnionMessageHandler_init (JNIEnv *env, jclass clz, jobject o) {
20283         jclass c = (*env)->GetObjectClass(env, o);
20284         CHECK(c != NULL);
20285         LDKOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOnionMessageHandler_JCalls), "LDKOnionMessageHandler_JCalls");
20286         atomic_init(&calls->refcnt, 1);
20287         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
20288         calls->o = (*env)->NewWeakGlobalRef(env, o);
20289         calls->get_and_clear_connections_needed_meth = (*env)->GetMethodID(env, c, "get_and_clear_connections_needed", "()[J");
20290         CHECK(calls->get_and_clear_connections_needed_meth != NULL);
20291         calls->handle_onion_message_meth = (*env)->GetMethodID(env, c, "handle_onion_message", "([BJ)V");
20292         CHECK(calls->handle_onion_message_meth != NULL);
20293         calls->next_onion_message_for_peer_meth = (*env)->GetMethodID(env, c, "next_onion_message_for_peer", "([B)J");
20294         CHECK(calls->next_onion_message_for_peer_meth != NULL);
20295         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJZ)J");
20296         CHECK(calls->peer_connected_meth != NULL);
20297         calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([B)V");
20298         CHECK(calls->peer_disconnected_meth != NULL);
20299         calls->timer_tick_occurred_meth = (*env)->GetMethodID(env, c, "timer_tick_occurred", "()V");
20300         CHECK(calls->timer_tick_occurred_meth != NULL);
20301         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
20302         CHECK(calls->provided_node_features_meth != NULL);
20303         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
20304         CHECK(calls->provided_init_features_meth != NULL);
20305
20306         LDKOnionMessageHandler ret = {
20307                 .this_arg = (void*) calls,
20308                 .get_and_clear_connections_needed = get_and_clear_connections_needed_LDKOnionMessageHandler_jcall,
20309                 .handle_onion_message = handle_onion_message_LDKOnionMessageHandler_jcall,
20310                 .next_onion_message_for_peer = next_onion_message_for_peer_LDKOnionMessageHandler_jcall,
20311                 .peer_connected = peer_connected_LDKOnionMessageHandler_jcall,
20312                 .peer_disconnected = peer_disconnected_LDKOnionMessageHandler_jcall,
20313                 .timer_tick_occurred = timer_tick_occurred_LDKOnionMessageHandler_jcall,
20314                 .provided_node_features = provided_node_features_LDKOnionMessageHandler_jcall,
20315                 .provided_init_features = provided_init_features_LDKOnionMessageHandler_jcall,
20316                 .free = LDKOnionMessageHandler_JCalls_free,
20317         };
20318         return ret;
20319 }
20320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageHandler_1new(JNIEnv *env, jclass clz, jobject o) {
20321         LDKOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
20322         *res_ptr = LDKOnionMessageHandler_init(env, clz, o);
20323         return tag_ptr(res_ptr, true);
20324 }
20325 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1get_1and_1clear_1connections_1needed(JNIEnv *env, jclass clz, int64_t this_arg) {
20326         void* this_arg_ptr = untag_ptr(this_arg);
20327         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20328         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
20329         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ ret_var = (this_arg_conv->get_and_clear_connections_needed)(this_arg_conv->this_arg);
20330         int64_tArray ret_arr = NULL;
20331         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
20332         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
20333         for (size_t o = 0; o < ret_var.datalen; o++) {
20334                 LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
20335                 *ret_conv_40_conv = ret_var.data[o];
20336                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
20337         }
20338         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
20339         FREE(ret_var.data);
20340         return ret_arr;
20341 }
20342
20343 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) {
20344         void* this_arg_ptr = untag_ptr(this_arg);
20345         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20346         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
20347         LDKPublicKey peer_node_id_ref;
20348         CHECK((*env)->GetArrayLength(env, peer_node_id) == 33);
20349         (*env)->GetByteArrayRegion(env, peer_node_id, 0, 33, peer_node_id_ref.compressed_form);
20350         LDKOnionMessage msg_conv;
20351         msg_conv.inner = untag_ptr(msg);
20352         msg_conv.is_owned = ptr_is_owned(msg);
20353         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20354         msg_conv.is_owned = false;
20355         (this_arg_conv->handle_onion_message)(this_arg_conv->this_arg, peer_node_id_ref, &msg_conv);
20356 }
20357
20358 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) {
20359         void* this_arg_ptr = untag_ptr(this_arg);
20360         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20361         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
20362         LDKPublicKey peer_node_id_ref;
20363         CHECK((*env)->GetArrayLength(env, peer_node_id) == 33);
20364         (*env)->GetByteArrayRegion(env, peer_node_id, 0, 33, peer_node_id_ref.compressed_form);
20365         LDKOnionMessage ret_var = (this_arg_conv->next_onion_message_for_peer)(this_arg_conv->this_arg, peer_node_id_ref);
20366         int64_t ret_ref = 0;
20367         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20368         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
20369         return ret_ref;
20370 }
20371
20372 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) {
20373         void* this_arg_ptr = untag_ptr(this_arg);
20374         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20375         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
20376         LDKPublicKey their_node_id_ref;
20377         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20378         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20379         LDKInit init_conv;
20380         init_conv.inner = untag_ptr(init);
20381         init_conv.is_owned = ptr_is_owned(init);
20382         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
20383         init_conv.is_owned = false;
20384         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
20385         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
20386         return tag_ptr(ret_conv, true);
20387 }
20388
20389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1peer_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id) {
20390         void* this_arg_ptr = untag_ptr(this_arg);
20391         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20392         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
20393         LDKPublicKey their_node_id_ref;
20394         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20395         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20396         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
20397 }
20398
20399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
20400         void* this_arg_ptr = untag_ptr(this_arg);
20401         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20402         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
20403         (this_arg_conv->timer_tick_occurred)(this_arg_conv->this_arg);
20404 }
20405
20406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
20407         void* this_arg_ptr = untag_ptr(this_arg);
20408         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20409         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
20410         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
20411         int64_t ret_ref = 0;
20412         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20413         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
20414         return ret_ref;
20415 }
20416
20417 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) {
20418         void* this_arg_ptr = untag_ptr(this_arg);
20419         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20420         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
20421         LDKPublicKey their_node_id_ref;
20422         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20423         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20424         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
20425         int64_t ret_ref = 0;
20426         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20427         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
20428         return ret_ref;
20429 }
20430
20431 typedef struct LDKCustomMessageReader_JCalls {
20432         atomic_size_t refcnt;
20433         JavaVM *vm;
20434         jweak o;
20435         jmethodID read_meth;
20436 } LDKCustomMessageReader_JCalls;
20437 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
20438         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
20439         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
20440                 JNIEnv *env;
20441                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20442                 if (get_jenv_res == JNI_EDETACHED) {
20443                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20444                 } else {
20445                         DO_ASSERT(get_jenv_res == JNI_OK);
20446                 }
20447                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
20448                 if (get_jenv_res == JNI_EDETACHED) {
20449                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20450                 }
20451                 FREE(j_calls);
20452         }
20453 }
20454 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
20455         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
20456         JNIEnv *env;
20457         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20458         if (get_jenv_res == JNI_EDETACHED) {
20459                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20460         } else {
20461                 DO_ASSERT(get_jenv_res == JNI_OK);
20462         }
20463         int16_t message_type_conv = message_type;
20464         LDKu8slice buffer_var = buffer;
20465         int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen);
20466         (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data);
20467         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20468         CHECK(obj != NULL);
20469         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_meth, message_type_conv, buffer_arr);
20470         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20471                 (*env)->ExceptionDescribe(env);
20472                 (*env)->FatalError(env, "A call to read in LDKCustomMessageReader from rust threw an exception.");
20473         }
20474         void* ret_ptr = untag_ptr(ret);
20475         CHECK_ACCESS(ret_ptr);
20476         LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
20477         FREE(untag_ptr(ret));
20478         if (get_jenv_res == JNI_EDETACHED) {
20479                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20480         }
20481         return ret_conv;
20482 }
20483 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
20484         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
20485         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
20486 }
20487 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JNIEnv *env, jclass clz, jobject o) {
20488         jclass c = (*env)->GetObjectClass(env, o);
20489         CHECK(c != NULL);
20490         LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
20491         atomic_init(&calls->refcnt, 1);
20492         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
20493         calls->o = (*env)->NewWeakGlobalRef(env, o);
20494         calls->read_meth = (*env)->GetMethodID(env, c, "read", "(S[B)J");
20495         CHECK(calls->read_meth != NULL);
20496
20497         LDKCustomMessageReader ret = {
20498                 .this_arg = (void*) calls,
20499                 .read = read_LDKCustomMessageReader_jcall,
20500                 .free = LDKCustomMessageReader_JCalls_free,
20501         };
20502         return ret;
20503 }
20504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageReader_1new(JNIEnv *env, jclass clz, jobject o) {
20505         LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
20506         *res_ptr = LDKCustomMessageReader_init(env, clz, o);
20507         return tag_ptr(res_ptr, true);
20508 }
20509 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) {
20510         void* this_arg_ptr = untag_ptr(this_arg);
20511         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20512         LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
20513         LDKu8slice buffer_ref;
20514         buffer_ref.datalen = (*env)->GetArrayLength(env, buffer);
20515         buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL);
20516         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
20517         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
20518         (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0);
20519         return tag_ptr(ret_conv, true);
20520 }
20521
20522 typedef struct LDKCustomMessageHandler_JCalls {
20523         atomic_size_t refcnt;
20524         JavaVM *vm;
20525         jweak o;
20526         LDKCustomMessageReader_JCalls* CustomMessageReader;
20527         jmethodID handle_custom_message_meth;
20528         jmethodID get_and_clear_pending_msg_meth;
20529         jmethodID provided_node_features_meth;
20530         jmethodID provided_init_features_meth;
20531 } LDKCustomMessageHandler_JCalls;
20532 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
20533         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
20534         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
20535                 JNIEnv *env;
20536                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20537                 if (get_jenv_res == JNI_EDETACHED) {
20538                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20539                 } else {
20540                         DO_ASSERT(get_jenv_res == JNI_OK);
20541                 }
20542                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
20543                 if (get_jenv_res == JNI_EDETACHED) {
20544                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20545                 }
20546                 FREE(j_calls);
20547         }
20548 }
20549 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
20550         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
20551         JNIEnv *env;
20552         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20553         if (get_jenv_res == JNI_EDETACHED) {
20554                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20555         } else {
20556                 DO_ASSERT(get_jenv_res == JNI_OK);
20557         }
20558         LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
20559         *msg_ret = msg;
20560         int8_tArray sender_node_id_arr = (*env)->NewByteArray(env, 33);
20561         (*env)->SetByteArrayRegion(env, sender_node_id_arr, 0, 33, sender_node_id.compressed_form);
20562         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20563         CHECK(obj != NULL);
20564         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, tag_ptr(msg_ret, true), sender_node_id_arr);
20565         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20566                 (*env)->ExceptionDescribe(env);
20567                 (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomMessageHandler from rust threw an exception.");
20568         }
20569         void* ret_ptr = untag_ptr(ret);
20570         CHECK_ACCESS(ret_ptr);
20571         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
20572         FREE(untag_ptr(ret));
20573         if (get_jenv_res == JNI_EDETACHED) {
20574                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20575         }
20576         return ret_conv;
20577 }
20578 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
20579         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
20580         JNIEnv *env;
20581         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20582         if (get_jenv_res == JNI_EDETACHED) {
20583                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20584         } else {
20585                 DO_ASSERT(get_jenv_res == JNI_OK);
20586         }
20587         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20588         CHECK(obj != NULL);
20589         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_meth);
20590         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20591                 (*env)->ExceptionDescribe(env);
20592                 (*env)->FatalError(env, "A call to get_and_clear_pending_msg in LDKCustomMessageHandler from rust threw an exception.");
20593         }
20594         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
20595         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
20596         if (ret_constr.datalen > 0)
20597                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
20598         else
20599                 ret_constr.data = NULL;
20600         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
20601         for (size_t z = 0; z < ret_constr.datalen; z++) {
20602                 int64_t ret_conv_25 = ret_vals[z];
20603                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
20604                 CHECK_ACCESS(ret_conv_25_ptr);
20605                 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
20606                 FREE(untag_ptr(ret_conv_25));
20607                 ret_constr.data[z] = ret_conv_25_conv;
20608         }
20609         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
20610         if (get_jenv_res == JNI_EDETACHED) {
20611                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20612         }
20613         return ret_constr;
20614 }
20615 LDKNodeFeatures provided_node_features_LDKCustomMessageHandler_jcall(const void* this_arg) {
20616         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
20617         JNIEnv *env;
20618         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20619         if (get_jenv_res == JNI_EDETACHED) {
20620                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20621         } else {
20622                 DO_ASSERT(get_jenv_res == JNI_OK);
20623         }
20624         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20625         CHECK(obj != NULL);
20626         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
20627         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20628                 (*env)->ExceptionDescribe(env);
20629                 (*env)->FatalError(env, "A call to provided_node_features in LDKCustomMessageHandler from rust threw an exception.");
20630         }
20631         LDKNodeFeatures ret_conv;
20632         ret_conv.inner = untag_ptr(ret);
20633         ret_conv.is_owned = ptr_is_owned(ret);
20634         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
20635         if (get_jenv_res == JNI_EDETACHED) {
20636                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20637         }
20638         return ret_conv;
20639 }
20640 LDKInitFeatures provided_init_features_LDKCustomMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
20641         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
20642         JNIEnv *env;
20643         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20644         if (get_jenv_res == JNI_EDETACHED) {
20645                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20646         } else {
20647                 DO_ASSERT(get_jenv_res == JNI_OK);
20648         }
20649         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
20650         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
20651         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20652         CHECK(obj != NULL);
20653         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
20654         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20655                 (*env)->ExceptionDescribe(env);
20656                 (*env)->FatalError(env, "A call to provided_init_features in LDKCustomMessageHandler from rust threw an exception.");
20657         }
20658         LDKInitFeatures ret_conv;
20659         ret_conv.inner = untag_ptr(ret);
20660         ret_conv.is_owned = ptr_is_owned(ret);
20661         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
20662         if (get_jenv_res == JNI_EDETACHED) {
20663                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20664         }
20665         return ret_conv;
20666 }
20667 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
20668         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
20669         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
20670         atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
20671 }
20672 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
20673         jclass c = (*env)->GetObjectClass(env, o);
20674         CHECK(c != NULL);
20675         LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
20676         atomic_init(&calls->refcnt, 1);
20677         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
20678         calls->o = (*env)->NewWeakGlobalRef(env, o);
20679         calls->handle_custom_message_meth = (*env)->GetMethodID(env, c, "handle_custom_message", "(J[B)J");
20680         CHECK(calls->handle_custom_message_meth != NULL);
20681         calls->get_and_clear_pending_msg_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg", "()[J");
20682         CHECK(calls->get_and_clear_pending_msg_meth != NULL);
20683         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
20684         CHECK(calls->provided_node_features_meth != NULL);
20685         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
20686         CHECK(calls->provided_init_features_meth != NULL);
20687
20688         LDKCustomMessageHandler ret = {
20689                 .this_arg = (void*) calls,
20690                 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
20691                 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
20692                 .provided_node_features = provided_node_features_LDKCustomMessageHandler_jcall,
20693                 .provided_init_features = provided_init_features_LDKCustomMessageHandler_jcall,
20694                 .free = LDKCustomMessageHandler_JCalls_free,
20695                 .CustomMessageReader = LDKCustomMessageReader_init(env, clz, CustomMessageReader),
20696         };
20697         calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
20698         return ret;
20699 }
20700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
20701         LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
20702         *res_ptr = LDKCustomMessageHandler_init(env, clz, o, CustomMessageReader);
20703         return tag_ptr(res_ptr, true);
20704 }
20705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1get_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t arg) {
20706         LDKCustomMessageHandler *inp = (LDKCustomMessageHandler *)untag_ptr(arg);
20707         return tag_ptr(&inp->CustomMessageReader, false);
20708 }
20709 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) {
20710         void* this_arg_ptr = untag_ptr(this_arg);
20711         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20712         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
20713         void* msg_ptr = untag_ptr(msg);
20714         CHECK_ACCESS(msg_ptr);
20715         LDKType msg_conv = *(LDKType*)(msg_ptr);
20716         if (msg_conv.free == LDKType_JCalls_free) {
20717                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20718                 LDKType_JCalls_cloned(&msg_conv);
20719         }
20720         LDKPublicKey sender_node_id_ref;
20721         CHECK((*env)->GetArrayLength(env, sender_node_id) == 33);
20722         (*env)->GetByteArrayRegion(env, sender_node_id, 0, 33, sender_node_id_ref.compressed_form);
20723         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20724         *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
20725         return tag_ptr(ret_conv, true);
20726 }
20727
20728 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1get_1and_1clear_1pending_1msg(JNIEnv *env, jclass clz, int64_t this_arg) {
20729         void* this_arg_ptr = untag_ptr(this_arg);
20730         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20731         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
20732         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
20733         int64_tArray ret_arr = NULL;
20734         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
20735         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
20736         for (size_t z = 0; z < ret_var.datalen; z++) {
20737                 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
20738                 *ret_conv_25_conv = ret_var.data[z];
20739                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
20740         }
20741         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
20742         FREE(ret_var.data);
20743         return ret_arr;
20744 }
20745
20746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
20747         void* this_arg_ptr = untag_ptr(this_arg);
20748         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20749         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
20750         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
20751         int64_t ret_ref = 0;
20752         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20753         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
20754         return ret_ref;
20755 }
20756
20757 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) {
20758         void* this_arg_ptr = untag_ptr(this_arg);
20759         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20760         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
20761         LDKPublicKey their_node_id_ref;
20762         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20763         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20764         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
20765         int64_t ret_ref = 0;
20766         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20767         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
20768         return ret_ref;
20769 }
20770
20771 typedef struct LDKCustomOnionMessageHandler_JCalls {
20772         atomic_size_t refcnt;
20773         JavaVM *vm;
20774         jweak o;
20775         jmethodID handle_custom_message_meth;
20776         jmethodID read_custom_message_meth;
20777         jmethodID release_pending_custom_messages_meth;
20778 } LDKCustomOnionMessageHandler_JCalls;
20779 static void LDKCustomOnionMessageHandler_JCalls_free(void* this_arg) {
20780         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
20781         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
20782                 JNIEnv *env;
20783                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20784                 if (get_jenv_res == JNI_EDETACHED) {
20785                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20786                 } else {
20787                         DO_ASSERT(get_jenv_res == JNI_OK);
20788                 }
20789                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
20790                 if (get_jenv_res == JNI_EDETACHED) {
20791                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20792                 }
20793                 FREE(j_calls);
20794         }
20795 }
20796 LDKCOption_OnionMessageContentsZ handle_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, LDKOnionMessageContents msg) {
20797         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
20798         JNIEnv *env;
20799         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20800         if (get_jenv_res == JNI_EDETACHED) {
20801                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20802         } else {
20803                 DO_ASSERT(get_jenv_res == JNI_OK);
20804         }
20805         LDKOnionMessageContents* msg_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
20806         *msg_ret = msg;
20807         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20808         CHECK(obj != NULL);
20809         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, tag_ptr(msg_ret, true));
20810         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20811                 (*env)->ExceptionDescribe(env);
20812                 (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomOnionMessageHandler from rust threw an exception.");
20813         }
20814         void* ret_ptr = untag_ptr(ret);
20815         CHECK_ACCESS(ret_ptr);
20816         LDKCOption_OnionMessageContentsZ ret_conv = *(LDKCOption_OnionMessageContentsZ*)(ret_ptr);
20817         FREE(untag_ptr(ret));
20818         if (get_jenv_res == JNI_EDETACHED) {
20819                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20820         }
20821         return ret_conv;
20822 }
20823 LDKCResult_COption_OnionMessageContentsZDecodeErrorZ read_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, uint64_t message_type, LDKu8slice buffer) {
20824         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
20825         JNIEnv *env;
20826         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20827         if (get_jenv_res == JNI_EDETACHED) {
20828                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20829         } else {
20830                 DO_ASSERT(get_jenv_res == JNI_OK);
20831         }
20832         int64_t message_type_conv = message_type;
20833         LDKu8slice buffer_var = buffer;
20834         int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen);
20835         (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data);
20836         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20837         CHECK(obj != NULL);
20838         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_custom_message_meth, message_type_conv, buffer_arr);
20839         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20840                 (*env)->ExceptionDescribe(env);
20841                 (*env)->FatalError(env, "A call to read_custom_message in LDKCustomOnionMessageHandler from rust threw an exception.");
20842         }
20843         void* ret_ptr = untag_ptr(ret);
20844         CHECK_ACCESS(ret_ptr);
20845         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ ret_conv = *(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)(ret_ptr);
20846         FREE(untag_ptr(ret));
20847         if (get_jenv_res == JNI_EDETACHED) {
20848                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20849         }
20850         return ret_conv;
20851 }
20852 LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ release_pending_custom_messages_LDKCustomOnionMessageHandler_jcall(const void* this_arg) {
20853         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
20854         JNIEnv *env;
20855         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20856         if (get_jenv_res == JNI_EDETACHED) {
20857                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20858         } else {
20859                 DO_ASSERT(get_jenv_res == JNI_OK);
20860         }
20861         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20862         CHECK(obj != NULL);
20863         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_custom_messages_meth);
20864         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20865                 (*env)->ExceptionDescribe(env);
20866                 (*env)->FatalError(env, "A call to release_pending_custom_messages in LDKCustomOnionMessageHandler from rust threw an exception.");
20867         }
20868         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret_constr;
20869         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
20870         if (ret_constr.datalen > 0)
20871                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ Elements");
20872         else
20873                 ret_constr.data = NULL;
20874         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
20875         for (size_t e = 0; e < ret_constr.datalen; e++) {
20876                 int64_t ret_conv_56 = ret_vals[e];
20877                 void* ret_conv_56_ptr = untag_ptr(ret_conv_56);
20878                 CHECK_ACCESS(ret_conv_56_ptr);
20879                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ ret_conv_56_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(ret_conv_56_ptr);
20880                 FREE(untag_ptr(ret_conv_56));
20881                 ret_constr.data[e] = ret_conv_56_conv;
20882         }
20883         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
20884         if (get_jenv_res == JNI_EDETACHED) {
20885                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20886         }
20887         return ret_constr;
20888 }
20889 static void LDKCustomOnionMessageHandler_JCalls_cloned(LDKCustomOnionMessageHandler* new_obj) {
20890         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) new_obj->this_arg;
20891         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
20892 }
20893 static inline LDKCustomOnionMessageHandler LDKCustomOnionMessageHandler_init (JNIEnv *env, jclass clz, jobject o) {
20894         jclass c = (*env)->GetObjectClass(env, o);
20895         CHECK(c != NULL);
20896         LDKCustomOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageHandler_JCalls), "LDKCustomOnionMessageHandler_JCalls");
20897         atomic_init(&calls->refcnt, 1);
20898         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
20899         calls->o = (*env)->NewWeakGlobalRef(env, o);
20900         calls->handle_custom_message_meth = (*env)->GetMethodID(env, c, "handle_custom_message", "(J)J");
20901         CHECK(calls->handle_custom_message_meth != NULL);
20902         calls->read_custom_message_meth = (*env)->GetMethodID(env, c, "read_custom_message", "(J[B)J");
20903         CHECK(calls->read_custom_message_meth != NULL);
20904         calls->release_pending_custom_messages_meth = (*env)->GetMethodID(env, c, "release_pending_custom_messages", "()[J");
20905         CHECK(calls->release_pending_custom_messages_meth != NULL);
20906
20907         LDKCustomOnionMessageHandler ret = {
20908                 .this_arg = (void*) calls,
20909                 .handle_custom_message = handle_custom_message_LDKCustomOnionMessageHandler_jcall,
20910                 .read_custom_message = read_custom_message_LDKCustomOnionMessageHandler_jcall,
20911                 .release_pending_custom_messages = release_pending_custom_messages_LDKCustomOnionMessageHandler_jcall,
20912                 .free = LDKCustomOnionMessageHandler_JCalls_free,
20913         };
20914         return ret;
20915 }
20916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomOnionMessageHandler_1new(JNIEnv *env, jclass clz, jobject o) {
20917         LDKCustomOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
20918         *res_ptr = LDKCustomOnionMessageHandler_init(env, clz, o);
20919         return tag_ptr(res_ptr, true);
20920 }
20921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageHandler_1handle_1custom_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
20922         void* this_arg_ptr = untag_ptr(this_arg);
20923         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20924         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
20925         void* msg_ptr = untag_ptr(msg);
20926         CHECK_ACCESS(msg_ptr);
20927         LDKOnionMessageContents msg_conv = *(LDKOnionMessageContents*)(msg_ptr);
20928         if (msg_conv.free == LDKOnionMessageContents_JCalls_free) {
20929                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20930                 LDKOnionMessageContents_JCalls_cloned(&msg_conv);
20931         }
20932         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
20933         *ret_copy = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv);
20934         int64_t ret_ref = tag_ptr(ret_copy, true);
20935         return ret_ref;
20936 }
20937
20938 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) {
20939         void* this_arg_ptr = untag_ptr(this_arg);
20940         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20941         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
20942         LDKu8slice buffer_ref;
20943         buffer_ref.datalen = (*env)->GetArrayLength(env, buffer);
20944         buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL);
20945         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
20946         *ret_conv = (this_arg_conv->read_custom_message)(this_arg_conv->this_arg, message_type, buffer_ref);
20947         (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0);
20948         return tag_ptr(ret_conv, true);
20949 }
20950
20951 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageHandler_1release_1pending_1custom_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
20952         void* this_arg_ptr = untag_ptr(this_arg);
20953         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20954         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
20955         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret_var = (this_arg_conv->release_pending_custom_messages)(this_arg_conv->this_arg);
20956         int64_tArray ret_arr = NULL;
20957         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
20958         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
20959         for (size_t e = 0; e < ret_var.datalen; e++) {
20960                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv_56_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
20961                 *ret_conv_56_conv = ret_var.data[e];
20962                 ret_arr_ptr[e] = tag_ptr(ret_conv_56_conv, true);
20963         }
20964         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
20965         FREE(ret_var.data);
20966         return ret_arr;
20967 }
20968
20969 typedef struct LDKSocketDescriptor_JCalls {
20970         atomic_size_t refcnt;
20971         JavaVM *vm;
20972         jweak o;
20973         jmethodID send_data_meth;
20974         jmethodID disconnect_socket_meth;
20975         jmethodID eq_meth;
20976         jmethodID hash_meth;
20977 } LDKSocketDescriptor_JCalls;
20978 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
20979         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
20980         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
20981                 JNIEnv *env;
20982                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20983                 if (get_jenv_res == JNI_EDETACHED) {
20984                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20985                 } else {
20986                         DO_ASSERT(get_jenv_res == JNI_OK);
20987                 }
20988                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
20989                 if (get_jenv_res == JNI_EDETACHED) {
20990                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20991                 }
20992                 FREE(j_calls);
20993         }
20994 }
20995 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
20996         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
20997         JNIEnv *env;
20998         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20999         if (get_jenv_res == JNI_EDETACHED) {
21000                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21001         } else {
21002                 DO_ASSERT(get_jenv_res == JNI_OK);
21003         }
21004         LDKu8slice data_var = data;
21005         int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
21006         (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
21007         jboolean resume_read_conv = resume_read;
21008         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21009         CHECK(obj != NULL);
21010         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read_conv);
21011         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21012                 (*env)->ExceptionDescribe(env);
21013                 (*env)->FatalError(env, "A call to send_data in LDKSocketDescriptor from rust threw an exception.");
21014         }
21015         if (get_jenv_res == JNI_EDETACHED) {
21016                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21017         }
21018         return ret;
21019 }
21020 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
21021         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
21022         JNIEnv *env;
21023         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21024         if (get_jenv_res == JNI_EDETACHED) {
21025                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21026         } else {
21027                 DO_ASSERT(get_jenv_res == JNI_OK);
21028         }
21029         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21030         CHECK(obj != NULL);
21031         (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
21032         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21033                 (*env)->ExceptionDescribe(env);
21034                 (*env)->FatalError(env, "A call to disconnect_socket in LDKSocketDescriptor from rust threw an exception.");
21035         }
21036         if (get_jenv_res == JNI_EDETACHED) {
21037                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21038         }
21039 }
21040 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
21041         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
21042         JNIEnv *env;
21043         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21044         if (get_jenv_res == JNI_EDETACHED) {
21045                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21046         } else {
21047                 DO_ASSERT(get_jenv_res == JNI_OK);
21048         }
21049         LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
21050         *other_arg_clone = SocketDescriptor_clone(other_arg);
21051         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21052         CHECK(obj != NULL);
21053         jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, tag_ptr(other_arg_clone, true));
21054         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21055                 (*env)->ExceptionDescribe(env);
21056                 (*env)->FatalError(env, "A call to eq in LDKSocketDescriptor from rust threw an exception.");
21057         }
21058         if (get_jenv_res == JNI_EDETACHED) {
21059                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21060         }
21061         return ret;
21062 }
21063 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
21064         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
21065         JNIEnv *env;
21066         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21067         if (get_jenv_res == JNI_EDETACHED) {
21068                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21069         } else {
21070                 DO_ASSERT(get_jenv_res == JNI_OK);
21071         }
21072         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21073         CHECK(obj != NULL);
21074         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
21075         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21076                 (*env)->ExceptionDescribe(env);
21077                 (*env)->FatalError(env, "A call to hash in LDKSocketDescriptor from rust threw an exception.");
21078         }
21079         if (get_jenv_res == JNI_EDETACHED) {
21080                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21081         }
21082         return ret;
21083 }
21084 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
21085         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
21086         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
21087 }
21088 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
21089         jclass c = (*env)->GetObjectClass(env, o);
21090         CHECK(c != NULL);
21091         LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
21092         atomic_init(&calls->refcnt, 1);
21093         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
21094         calls->o = (*env)->NewWeakGlobalRef(env, o);
21095         calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
21096         CHECK(calls->send_data_meth != NULL);
21097         calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
21098         CHECK(calls->disconnect_socket_meth != NULL);
21099         calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
21100         CHECK(calls->eq_meth != NULL);
21101         calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
21102         CHECK(calls->hash_meth != NULL);
21103
21104         LDKSocketDescriptor ret = {
21105                 .this_arg = (void*) calls,
21106                 .send_data = send_data_LDKSocketDescriptor_jcall,
21107                 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
21108                 .eq = eq_LDKSocketDescriptor_jcall,
21109                 .hash = hash_LDKSocketDescriptor_jcall,
21110                 .cloned = LDKSocketDescriptor_JCalls_cloned,
21111                 .free = LDKSocketDescriptor_JCalls_free,
21112         };
21113         return ret;
21114 }
21115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
21116         LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
21117         *res_ptr = LDKSocketDescriptor_init(env, clz, o);
21118         return tag_ptr(res_ptr, true);
21119 }
21120 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) {
21121         void* this_arg_ptr = untag_ptr(this_arg);
21122         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21123         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
21124         LDKu8slice data_ref;
21125         data_ref.datalen = (*env)->GetArrayLength(env, data);
21126         data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
21127         int64_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
21128         (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
21129         return ret_conv;
21130 }
21131
21132 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
21133         void* this_arg_ptr = untag_ptr(this_arg);
21134         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21135         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
21136         (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
21137 }
21138
21139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
21140         void* this_arg_ptr = untag_ptr(this_arg);
21141         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21142         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
21143         int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
21144         return ret_conv;
21145 }
21146
21147 static jclass LDKEffectiveCapacity_ExactLiquidity_class = NULL;
21148 static jmethodID LDKEffectiveCapacity_ExactLiquidity_meth = NULL;
21149 static jclass LDKEffectiveCapacity_AdvertisedMaxHTLC_class = NULL;
21150 static jmethodID LDKEffectiveCapacity_AdvertisedMaxHTLC_meth = NULL;
21151 static jclass LDKEffectiveCapacity_Total_class = NULL;
21152 static jmethodID LDKEffectiveCapacity_Total_meth = NULL;
21153 static jclass LDKEffectiveCapacity_Infinite_class = NULL;
21154 static jmethodID LDKEffectiveCapacity_Infinite_meth = NULL;
21155 static jclass LDKEffectiveCapacity_HintMaxHTLC_class = NULL;
21156 static jmethodID LDKEffectiveCapacity_HintMaxHTLC_meth = NULL;
21157 static jclass LDKEffectiveCapacity_Unknown_class = NULL;
21158 static jmethodID LDKEffectiveCapacity_Unknown_meth = NULL;
21159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEffectiveCapacity_init (JNIEnv *env, jclass clz) {
21160         LDKEffectiveCapacity_ExactLiquidity_class =
21161                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$ExactLiquidity"));
21162         CHECK(LDKEffectiveCapacity_ExactLiquidity_class != NULL);
21163         LDKEffectiveCapacity_ExactLiquidity_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_ExactLiquidity_class, "<init>", "(J)V");
21164         CHECK(LDKEffectiveCapacity_ExactLiquidity_meth != NULL);
21165         LDKEffectiveCapacity_AdvertisedMaxHTLC_class =
21166                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$AdvertisedMaxHTLC"));
21167         CHECK(LDKEffectiveCapacity_AdvertisedMaxHTLC_class != NULL);
21168         LDKEffectiveCapacity_AdvertisedMaxHTLC_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_AdvertisedMaxHTLC_class, "<init>", "(J)V");
21169         CHECK(LDKEffectiveCapacity_AdvertisedMaxHTLC_meth != NULL);
21170         LDKEffectiveCapacity_Total_class =
21171                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Total"));
21172         CHECK(LDKEffectiveCapacity_Total_class != NULL);
21173         LDKEffectiveCapacity_Total_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Total_class, "<init>", "(JJ)V");
21174         CHECK(LDKEffectiveCapacity_Total_meth != NULL);
21175         LDKEffectiveCapacity_Infinite_class =
21176                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Infinite"));
21177         CHECK(LDKEffectiveCapacity_Infinite_class != NULL);
21178         LDKEffectiveCapacity_Infinite_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Infinite_class, "<init>", "()V");
21179         CHECK(LDKEffectiveCapacity_Infinite_meth != NULL);
21180         LDKEffectiveCapacity_HintMaxHTLC_class =
21181                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$HintMaxHTLC"));
21182         CHECK(LDKEffectiveCapacity_HintMaxHTLC_class != NULL);
21183         LDKEffectiveCapacity_HintMaxHTLC_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_HintMaxHTLC_class, "<init>", "(J)V");
21184         CHECK(LDKEffectiveCapacity_HintMaxHTLC_meth != NULL);
21185         LDKEffectiveCapacity_Unknown_class =
21186                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Unknown"));
21187         CHECK(LDKEffectiveCapacity_Unknown_class != NULL);
21188         LDKEffectiveCapacity_Unknown_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Unknown_class, "<init>", "()V");
21189         CHECK(LDKEffectiveCapacity_Unknown_meth != NULL);
21190 }
21191 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEffectiveCapacity_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
21192         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
21193         switch(obj->tag) {
21194                 case LDKEffectiveCapacity_ExactLiquidity: {
21195                         int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
21196                         return (*env)->NewObject(env, LDKEffectiveCapacity_ExactLiquidity_class, LDKEffectiveCapacity_ExactLiquidity_meth, liquidity_msat_conv);
21197                 }
21198                 case LDKEffectiveCapacity_AdvertisedMaxHTLC: {
21199                         int64_t amount_msat_conv = obj->advertised_max_htlc.amount_msat;
21200                         return (*env)->NewObject(env, LDKEffectiveCapacity_AdvertisedMaxHTLC_class, LDKEffectiveCapacity_AdvertisedMaxHTLC_meth, amount_msat_conv);
21201                 }
21202                 case LDKEffectiveCapacity_Total: {
21203                         int64_t capacity_msat_conv = obj->total.capacity_msat;
21204                         int64_t htlc_maximum_msat_conv = obj->total.htlc_maximum_msat;
21205                         return (*env)->NewObject(env, LDKEffectiveCapacity_Total_class, LDKEffectiveCapacity_Total_meth, capacity_msat_conv, htlc_maximum_msat_conv);
21206                 }
21207                 case LDKEffectiveCapacity_Infinite: {
21208                         return (*env)->NewObject(env, LDKEffectiveCapacity_Infinite_class, LDKEffectiveCapacity_Infinite_meth);
21209                 }
21210                 case LDKEffectiveCapacity_HintMaxHTLC: {
21211                         int64_t amount_msat_conv = obj->hint_max_htlc.amount_msat;
21212                         return (*env)->NewObject(env, LDKEffectiveCapacity_HintMaxHTLC_class, LDKEffectiveCapacity_HintMaxHTLC_meth, amount_msat_conv);
21213                 }
21214                 case LDKEffectiveCapacity_Unknown: {
21215                         return (*env)->NewObject(env, LDKEffectiveCapacity_Unknown_class, LDKEffectiveCapacity_Unknown_meth);
21216                 }
21217                 default: abort();
21218         }
21219 }
21220 static jclass LDKPayee_Blinded_class = NULL;
21221 static jmethodID LDKPayee_Blinded_meth = NULL;
21222 static jclass LDKPayee_Clear_class = NULL;
21223 static jmethodID LDKPayee_Clear_meth = NULL;
21224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPayee_init (JNIEnv *env, jclass clz) {
21225         LDKPayee_Blinded_class =
21226                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPayee$Blinded"));
21227         CHECK(LDKPayee_Blinded_class != NULL);
21228         LDKPayee_Blinded_meth = (*env)->GetMethodID(env, LDKPayee_Blinded_class, "<init>", "([JJ)V");
21229         CHECK(LDKPayee_Blinded_meth != NULL);
21230         LDKPayee_Clear_class =
21231                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPayee$Clear"));
21232         CHECK(LDKPayee_Clear_class != NULL);
21233         LDKPayee_Clear_meth = (*env)->GetMethodID(env, LDKPayee_Clear_class, "<init>", "([B[JJI)V");
21234         CHECK(LDKPayee_Clear_meth != NULL);
21235 }
21236 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPayee_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
21237         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
21238         switch(obj->tag) {
21239                 case LDKPayee_Blinded: {
21240                         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_var = obj->blinded.route_hints;
21241                         int64_tArray route_hints_arr = NULL;
21242                         route_hints_arr = (*env)->NewLongArray(env, route_hints_var.datalen);
21243                         int64_t *route_hints_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, route_hints_arr, NULL);
21244                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
21245                                 LDKC2Tuple_BlindedPayInfoBlindedPathZ* route_hints_conv_37_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
21246                                 *route_hints_conv_37_conv = route_hints_var.data[l];
21247                                 *route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(route_hints_conv_37_conv);
21248                                 route_hints_arr_ptr[l] = tag_ptr(route_hints_conv_37_conv, true);
21249                         }
21250                         (*env)->ReleasePrimitiveArrayCritical(env, route_hints_arr, route_hints_arr_ptr, 0);
21251                         LDKBolt12InvoiceFeatures features_var = obj->blinded.features;
21252                         int64_t features_ref = 0;
21253                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
21254                         features_ref = tag_ptr(features_var.inner, false);
21255                         return (*env)->NewObject(env, LDKPayee_Blinded_class, LDKPayee_Blinded_meth, route_hints_arr, features_ref);
21256                 }
21257                 case LDKPayee_Clear: {
21258                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
21259                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->clear.node_id.compressed_form);
21260                         LDKCVec_RouteHintZ route_hints_var = obj->clear.route_hints;
21261                         int64_tArray route_hints_arr = NULL;
21262                         route_hints_arr = (*env)->NewLongArray(env, route_hints_var.datalen);
21263                         int64_t *route_hints_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, route_hints_arr, NULL);
21264                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
21265                                 LDKRouteHint route_hints_conv_11_var = route_hints_var.data[l];
21266                                 int64_t route_hints_conv_11_ref = 0;
21267                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_var);
21268                                 route_hints_conv_11_ref = tag_ptr(route_hints_conv_11_var.inner, false);
21269                                 route_hints_arr_ptr[l] = route_hints_conv_11_ref;
21270                         }
21271                         (*env)->ReleasePrimitiveArrayCritical(env, route_hints_arr, route_hints_arr_ptr, 0);
21272                         LDKBolt11InvoiceFeatures features_var = obj->clear.features;
21273                         int64_t features_ref = 0;
21274                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
21275                         features_ref = tag_ptr(features_var.inner, false);
21276                         int32_t final_cltv_expiry_delta_conv = obj->clear.final_cltv_expiry_delta;
21277                         return (*env)->NewObject(env, LDKPayee_Clear_class, LDKPayee_Clear_meth, node_id_arr, route_hints_arr, features_ref, final_cltv_expiry_delta_conv);
21278                 }
21279                 default: abort();
21280         }
21281 }
21282 typedef struct LDKScore_JCalls {
21283         atomic_size_t refcnt;
21284         JavaVM *vm;
21285         jweak o;
21286         LDKScoreLookUp_JCalls* ScoreLookUp;
21287         LDKScoreUpdate_JCalls* ScoreUpdate;
21288         jmethodID write_meth;
21289 } LDKScore_JCalls;
21290 static void LDKScore_JCalls_free(void* this_arg) {
21291         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
21292         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
21293                 JNIEnv *env;
21294                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21295                 if (get_jenv_res == JNI_EDETACHED) {
21296                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21297                 } else {
21298                         DO_ASSERT(get_jenv_res == JNI_OK);
21299                 }
21300                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
21301                 if (get_jenv_res == JNI_EDETACHED) {
21302                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21303                 }
21304                 FREE(j_calls);
21305         }
21306 }
21307 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
21308         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
21309         JNIEnv *env;
21310         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21311         if (get_jenv_res == JNI_EDETACHED) {
21312                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21313         } else {
21314                 DO_ASSERT(get_jenv_res == JNI_OK);
21315         }
21316         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21317         CHECK(obj != NULL);
21318         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
21319         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21320                 (*env)->ExceptionDescribe(env);
21321                 (*env)->FatalError(env, "A call to write in LDKScore from rust threw an exception.");
21322         }
21323         LDKCVec_u8Z ret_ref;
21324         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
21325         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
21326         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
21327         if (get_jenv_res == JNI_EDETACHED) {
21328                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21329         }
21330         return ret_ref;
21331 }
21332 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
21333         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
21334         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
21335         atomic_fetch_add_explicit(&j_calls->ScoreLookUp->refcnt, 1, memory_order_release);
21336         atomic_fetch_add_explicit(&j_calls->ScoreUpdate->refcnt, 1, memory_order_release);
21337 }
21338 static inline LDKScore LDKScore_init (JNIEnv *env, jclass clz, jobject o, jobject ScoreLookUp, jobject ScoreUpdate) {
21339         jclass c = (*env)->GetObjectClass(env, o);
21340         CHECK(c != NULL);
21341         LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
21342         atomic_init(&calls->refcnt, 1);
21343         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
21344         calls->o = (*env)->NewWeakGlobalRef(env, o);
21345         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
21346         CHECK(calls->write_meth != NULL);
21347
21348         LDKScore ret = {
21349                 .this_arg = (void*) calls,
21350                 .write = write_LDKScore_jcall,
21351                 .free = LDKScore_JCalls_free,
21352                 .ScoreLookUp = LDKScoreLookUp_init(env, clz, ScoreLookUp),
21353                 .ScoreUpdate = LDKScoreUpdate_init(env, clz, ScoreUpdate),
21354         };
21355         calls->ScoreLookUp = ret.ScoreLookUp.this_arg;
21356         calls->ScoreUpdate = ret.ScoreUpdate.this_arg;
21357         return ret;
21358 }
21359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1new(JNIEnv *env, jclass clz, jobject o, jobject ScoreLookUp, jobject ScoreUpdate) {
21360         LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
21361         *res_ptr = LDKScore_init(env, clz, o, ScoreLookUp, ScoreUpdate);
21362         return tag_ptr(res_ptr, true);
21363 }
21364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1get_1ScoreLookUp(JNIEnv *env, jclass clz, int64_t arg) {
21365         LDKScore *inp = (LDKScore *)untag_ptr(arg);
21366         return tag_ptr(&inp->ScoreLookUp, false);
21367 }
21368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1get_1ScoreUpdate(JNIEnv *env, jclass clz, int64_t arg) {
21369         LDKScore *inp = (LDKScore *)untag_ptr(arg);
21370         return tag_ptr(&inp->ScoreUpdate, false);
21371 }
21372 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Score_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
21373         void* this_arg_ptr = untag_ptr(this_arg);
21374         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21375         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
21376         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
21377         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21378         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21379         CVec_u8Z_free(ret_var);
21380         return ret_arr;
21381 }
21382
21383 typedef struct LDKCoinSelectionSource_JCalls {
21384         atomic_size_t refcnt;
21385         JavaVM *vm;
21386         jweak o;
21387         jmethodID select_confirmed_utxos_meth;
21388         jmethodID sign_psbt_meth;
21389 } LDKCoinSelectionSource_JCalls;
21390 static void LDKCoinSelectionSource_JCalls_free(void* this_arg) {
21391         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
21392         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
21393                 JNIEnv *env;
21394                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21395                 if (get_jenv_res == JNI_EDETACHED) {
21396                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21397                 } else {
21398                         DO_ASSERT(get_jenv_res == JNI_OK);
21399                 }
21400                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
21401                 if (get_jenv_res == JNI_EDETACHED) {
21402                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21403                 }
21404                 FREE(j_calls);
21405         }
21406 }
21407 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) {
21408         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
21409         JNIEnv *env;
21410         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21411         if (get_jenv_res == JNI_EDETACHED) {
21412                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21413         } else {
21414                 DO_ASSERT(get_jenv_res == JNI_OK);
21415         }
21416         int8_tArray claim_id_arr = (*env)->NewByteArray(env, 32);
21417         (*env)->SetByteArrayRegion(env, claim_id_arr, 0, 32, claim_id.data);
21418         LDKCVec_InputZ must_spend_var = must_spend;
21419         int64_tArray must_spend_arr = NULL;
21420         must_spend_arr = (*env)->NewLongArray(env, must_spend_var.datalen);
21421         int64_t *must_spend_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, must_spend_arr, NULL);
21422         for (size_t h = 0; h < must_spend_var.datalen; h++) {
21423                 LDKInput must_spend_conv_7_var = must_spend_var.data[h];
21424                 int64_t must_spend_conv_7_ref = 0;
21425                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_var);
21426                 must_spend_conv_7_ref = tag_ptr(must_spend_conv_7_var.inner, must_spend_conv_7_var.is_owned);
21427                 must_spend_arr_ptr[h] = must_spend_conv_7_ref;
21428         }
21429         (*env)->ReleasePrimitiveArrayCritical(env, must_spend_arr, must_spend_arr_ptr, 0);
21430         FREE(must_spend_var.data);
21431         LDKCVec_TxOutZ must_pay_to_var = must_pay_to;
21432         int64_tArray must_pay_to_arr = NULL;
21433         must_pay_to_arr = (*env)->NewLongArray(env, must_pay_to_var.datalen);
21434         int64_t *must_pay_to_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, must_pay_to_arr, NULL);
21435         for (size_t h = 0; h < must_pay_to_var.datalen; h++) {
21436                 LDKTxOut* must_pay_to_conv_7_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
21437                 *must_pay_to_conv_7_ref = must_pay_to_var.data[h];
21438                 must_pay_to_arr_ptr[h] = tag_ptr(must_pay_to_conv_7_ref, true);
21439         }
21440         (*env)->ReleasePrimitiveArrayCritical(env, must_pay_to_arr, must_pay_to_arr_ptr, 0);
21441         FREE(must_pay_to_var.data);
21442         int32_t target_feerate_sat_per_1000_weight_conv = target_feerate_sat_per_1000_weight;
21443         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21444         CHECK(obj != NULL);
21445         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);
21446         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21447                 (*env)->ExceptionDescribe(env);
21448                 (*env)->FatalError(env, "A call to select_confirmed_utxos in LDKCoinSelectionSource from rust threw an exception.");
21449         }
21450         void* ret_ptr = untag_ptr(ret);
21451         CHECK_ACCESS(ret_ptr);
21452         LDKCResult_CoinSelectionNoneZ ret_conv = *(LDKCResult_CoinSelectionNoneZ*)(ret_ptr);
21453         FREE(untag_ptr(ret));
21454         if (get_jenv_res == JNI_EDETACHED) {
21455                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21456         }
21457         return ret_conv;
21458 }
21459 LDKCResult_TransactionNoneZ sign_psbt_LDKCoinSelectionSource_jcall(const void* this_arg, LDKCVec_u8Z psbt) {
21460         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
21461         JNIEnv *env;
21462         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21463         if (get_jenv_res == JNI_EDETACHED) {
21464                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21465         } else {
21466                 DO_ASSERT(get_jenv_res == JNI_OK);
21467         }
21468         LDKCVec_u8Z psbt_var = psbt;
21469         int8_tArray psbt_arr = (*env)->NewByteArray(env, psbt_var.datalen);
21470         (*env)->SetByteArrayRegion(env, psbt_arr, 0, psbt_var.datalen, psbt_var.data);
21471         CVec_u8Z_free(psbt_var);
21472         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21473         CHECK(obj != NULL);
21474         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_psbt_meth, psbt_arr);
21475         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21476                 (*env)->ExceptionDescribe(env);
21477                 (*env)->FatalError(env, "A call to sign_psbt in LDKCoinSelectionSource from rust threw an exception.");
21478         }
21479         void* ret_ptr = untag_ptr(ret);
21480         CHECK_ACCESS(ret_ptr);
21481         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
21482         FREE(untag_ptr(ret));
21483         if (get_jenv_res == JNI_EDETACHED) {
21484                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21485         }
21486         return ret_conv;
21487 }
21488 static void LDKCoinSelectionSource_JCalls_cloned(LDKCoinSelectionSource* new_obj) {
21489         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) new_obj->this_arg;
21490         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
21491 }
21492 static inline LDKCoinSelectionSource LDKCoinSelectionSource_init (JNIEnv *env, jclass clz, jobject o) {
21493         jclass c = (*env)->GetObjectClass(env, o);
21494         CHECK(c != NULL);
21495         LDKCoinSelectionSource_JCalls *calls = MALLOC(sizeof(LDKCoinSelectionSource_JCalls), "LDKCoinSelectionSource_JCalls");
21496         atomic_init(&calls->refcnt, 1);
21497         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
21498         calls->o = (*env)->NewWeakGlobalRef(env, o);
21499         calls->select_confirmed_utxos_meth = (*env)->GetMethodID(env, c, "select_confirmed_utxos", "([B[J[JI)J");
21500         CHECK(calls->select_confirmed_utxos_meth != NULL);
21501         calls->sign_psbt_meth = (*env)->GetMethodID(env, c, "sign_psbt", "([B)J");
21502         CHECK(calls->sign_psbt_meth != NULL);
21503
21504         LDKCoinSelectionSource ret = {
21505                 .this_arg = (void*) calls,
21506                 .select_confirmed_utxos = select_confirmed_utxos_LDKCoinSelectionSource_jcall,
21507                 .sign_psbt = sign_psbt_LDKCoinSelectionSource_jcall,
21508                 .free = LDKCoinSelectionSource_JCalls_free,
21509         };
21510         return ret;
21511 }
21512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCoinSelectionSource_1new(JNIEnv *env, jclass clz, jobject o) {
21513         LDKCoinSelectionSource *res_ptr = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
21514         *res_ptr = LDKCoinSelectionSource_init(env, clz, o);
21515         return tag_ptr(res_ptr, true);
21516 }
21517 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) {
21518         void* this_arg_ptr = untag_ptr(this_arg);
21519         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21520         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
21521         LDKThirtyTwoBytes claim_id_ref;
21522         CHECK((*env)->GetArrayLength(env, claim_id) == 32);
21523         (*env)->GetByteArrayRegion(env, claim_id, 0, 32, claim_id_ref.data);
21524         LDKCVec_InputZ must_spend_constr;
21525         must_spend_constr.datalen = (*env)->GetArrayLength(env, must_spend);
21526         if (must_spend_constr.datalen > 0)
21527                 must_spend_constr.data = MALLOC(must_spend_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
21528         else
21529                 must_spend_constr.data = NULL;
21530         int64_t* must_spend_vals = (*env)->GetLongArrayElements (env, must_spend, NULL);
21531         for (size_t h = 0; h < must_spend_constr.datalen; h++) {
21532                 int64_t must_spend_conv_7 = must_spend_vals[h];
21533                 LDKInput must_spend_conv_7_conv;
21534                 must_spend_conv_7_conv.inner = untag_ptr(must_spend_conv_7);
21535                 must_spend_conv_7_conv.is_owned = ptr_is_owned(must_spend_conv_7);
21536                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_conv);
21537                 must_spend_conv_7_conv = Input_clone(&must_spend_conv_7_conv);
21538                 must_spend_constr.data[h] = must_spend_conv_7_conv;
21539         }
21540         (*env)->ReleaseLongArrayElements(env, must_spend, must_spend_vals, 0);
21541         LDKCVec_TxOutZ must_pay_to_constr;
21542         must_pay_to_constr.datalen = (*env)->GetArrayLength(env, must_pay_to);
21543         if (must_pay_to_constr.datalen > 0)
21544                 must_pay_to_constr.data = MALLOC(must_pay_to_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
21545         else
21546                 must_pay_to_constr.data = NULL;
21547         int64_t* must_pay_to_vals = (*env)->GetLongArrayElements (env, must_pay_to, NULL);
21548         for (size_t h = 0; h < must_pay_to_constr.datalen; h++) {
21549                 int64_t must_pay_to_conv_7 = must_pay_to_vals[h];
21550                 void* must_pay_to_conv_7_ptr = untag_ptr(must_pay_to_conv_7);
21551                 CHECK_ACCESS(must_pay_to_conv_7_ptr);
21552                 LDKTxOut must_pay_to_conv_7_conv = *(LDKTxOut*)(must_pay_to_conv_7_ptr);
21553                 must_pay_to_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(must_pay_to_conv_7));
21554                 must_pay_to_constr.data[h] = must_pay_to_conv_7_conv;
21555         }
21556         (*env)->ReleaseLongArrayElements(env, must_pay_to, must_pay_to_vals, 0);
21557         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
21558         *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);
21559         return tag_ptr(ret_conv, true);
21560 }
21561
21562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelectionSource_1sign_1psbt(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray psbt) {
21563         void* this_arg_ptr = untag_ptr(this_arg);
21564         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21565         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
21566         LDKCVec_u8Z psbt_ref;
21567         psbt_ref.datalen = (*env)->GetArrayLength(env, psbt);
21568         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
21569         (*env)->GetByteArrayRegion(env, psbt, 0, psbt_ref.datalen, psbt_ref.data);
21570         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
21571         *ret_conv = (this_arg_conv->sign_psbt)(this_arg_conv->this_arg, psbt_ref);
21572         return tag_ptr(ret_conv, true);
21573 }
21574
21575 typedef struct LDKWalletSource_JCalls {
21576         atomic_size_t refcnt;
21577         JavaVM *vm;
21578         jweak o;
21579         jmethodID list_confirmed_utxos_meth;
21580         jmethodID get_change_script_meth;
21581         jmethodID sign_psbt_meth;
21582 } LDKWalletSource_JCalls;
21583 static void LDKWalletSource_JCalls_free(void* this_arg) {
21584         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
21585         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
21586                 JNIEnv *env;
21587                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21588                 if (get_jenv_res == JNI_EDETACHED) {
21589                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21590                 } else {
21591                         DO_ASSERT(get_jenv_res == JNI_OK);
21592                 }
21593                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
21594                 if (get_jenv_res == JNI_EDETACHED) {
21595                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21596                 }
21597                 FREE(j_calls);
21598         }
21599 }
21600 LDKCResult_CVec_UtxoZNoneZ list_confirmed_utxos_LDKWalletSource_jcall(const void* this_arg) {
21601         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
21602         JNIEnv *env;
21603         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21604         if (get_jenv_res == JNI_EDETACHED) {
21605                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21606         } else {
21607                 DO_ASSERT(get_jenv_res == JNI_OK);
21608         }
21609         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21610         CHECK(obj != NULL);
21611         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->list_confirmed_utxos_meth);
21612         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21613                 (*env)->ExceptionDescribe(env);
21614                 (*env)->FatalError(env, "A call to list_confirmed_utxos in LDKWalletSource from rust threw an exception.");
21615         }
21616         void* ret_ptr = untag_ptr(ret);
21617         CHECK_ACCESS(ret_ptr);
21618         LDKCResult_CVec_UtxoZNoneZ ret_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(ret_ptr);
21619         FREE(untag_ptr(ret));
21620         if (get_jenv_res == JNI_EDETACHED) {
21621                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21622         }
21623         return ret_conv;
21624 }
21625 LDKCResult_CVec_u8ZNoneZ get_change_script_LDKWalletSource_jcall(const void* this_arg) {
21626         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
21627         JNIEnv *env;
21628         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21629         if (get_jenv_res == JNI_EDETACHED) {
21630                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21631         } else {
21632                 DO_ASSERT(get_jenv_res == JNI_OK);
21633         }
21634         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21635         CHECK(obj != NULL);
21636         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_change_script_meth);
21637         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21638                 (*env)->ExceptionDescribe(env);
21639                 (*env)->FatalError(env, "A call to get_change_script in LDKWalletSource from rust threw an exception.");
21640         }
21641         void* ret_ptr = untag_ptr(ret);
21642         CHECK_ACCESS(ret_ptr);
21643         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
21644         FREE(untag_ptr(ret));
21645         if (get_jenv_res == JNI_EDETACHED) {
21646                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21647         }
21648         return ret_conv;
21649 }
21650 LDKCResult_TransactionNoneZ sign_psbt_LDKWalletSource_jcall(const void* this_arg, LDKCVec_u8Z psbt) {
21651         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
21652         JNIEnv *env;
21653         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21654         if (get_jenv_res == JNI_EDETACHED) {
21655                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21656         } else {
21657                 DO_ASSERT(get_jenv_res == JNI_OK);
21658         }
21659         LDKCVec_u8Z psbt_var = psbt;
21660         int8_tArray psbt_arr = (*env)->NewByteArray(env, psbt_var.datalen);
21661         (*env)->SetByteArrayRegion(env, psbt_arr, 0, psbt_var.datalen, psbt_var.data);
21662         CVec_u8Z_free(psbt_var);
21663         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21664         CHECK(obj != NULL);
21665         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_psbt_meth, psbt_arr);
21666         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21667                 (*env)->ExceptionDescribe(env);
21668                 (*env)->FatalError(env, "A call to sign_psbt in LDKWalletSource from rust threw an exception.");
21669         }
21670         void* ret_ptr = untag_ptr(ret);
21671         CHECK_ACCESS(ret_ptr);
21672         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
21673         FREE(untag_ptr(ret));
21674         if (get_jenv_res == JNI_EDETACHED) {
21675                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21676         }
21677         return ret_conv;
21678 }
21679 static void LDKWalletSource_JCalls_cloned(LDKWalletSource* new_obj) {
21680         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) new_obj->this_arg;
21681         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
21682 }
21683 static inline LDKWalletSource LDKWalletSource_init (JNIEnv *env, jclass clz, jobject o) {
21684         jclass c = (*env)->GetObjectClass(env, o);
21685         CHECK(c != NULL);
21686         LDKWalletSource_JCalls *calls = MALLOC(sizeof(LDKWalletSource_JCalls), "LDKWalletSource_JCalls");
21687         atomic_init(&calls->refcnt, 1);
21688         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
21689         calls->o = (*env)->NewWeakGlobalRef(env, o);
21690         calls->list_confirmed_utxos_meth = (*env)->GetMethodID(env, c, "list_confirmed_utxos", "()J");
21691         CHECK(calls->list_confirmed_utxos_meth != NULL);
21692         calls->get_change_script_meth = (*env)->GetMethodID(env, c, "get_change_script", "()J");
21693         CHECK(calls->get_change_script_meth != NULL);
21694         calls->sign_psbt_meth = (*env)->GetMethodID(env, c, "sign_psbt", "([B)J");
21695         CHECK(calls->sign_psbt_meth != NULL);
21696
21697         LDKWalletSource ret = {
21698                 .this_arg = (void*) calls,
21699                 .list_confirmed_utxos = list_confirmed_utxos_LDKWalletSource_jcall,
21700                 .get_change_script = get_change_script_LDKWalletSource_jcall,
21701                 .sign_psbt = sign_psbt_LDKWalletSource_jcall,
21702                 .free = LDKWalletSource_JCalls_free,
21703         };
21704         return ret;
21705 }
21706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWalletSource_1new(JNIEnv *env, jclass clz, jobject o) {
21707         LDKWalletSource *res_ptr = MALLOC(sizeof(LDKWalletSource), "LDKWalletSource");
21708         *res_ptr = LDKWalletSource_init(env, clz, o);
21709         return tag_ptr(res_ptr, true);
21710 }
21711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WalletSource_1list_1confirmed_1utxos(JNIEnv *env, jclass clz, int64_t this_arg) {
21712         void* this_arg_ptr = untag_ptr(this_arg);
21713         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21714         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
21715         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
21716         *ret_conv = (this_arg_conv->list_confirmed_utxos)(this_arg_conv->this_arg);
21717         return tag_ptr(ret_conv, true);
21718 }
21719
21720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WalletSource_1get_1change_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
21721         void* this_arg_ptr = untag_ptr(this_arg);
21722         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21723         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
21724         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
21725         *ret_conv = (this_arg_conv->get_change_script)(this_arg_conv->this_arg);
21726         return tag_ptr(ret_conv, true);
21727 }
21728
21729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WalletSource_1sign_1psbt(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray psbt) {
21730         void* this_arg_ptr = untag_ptr(this_arg);
21731         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21732         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
21733         LDKCVec_u8Z psbt_ref;
21734         psbt_ref.datalen = (*env)->GetArrayLength(env, psbt);
21735         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
21736         (*env)->GetByteArrayRegion(env, psbt, 0, psbt_ref.datalen, psbt_ref.data);
21737         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
21738         *ret_conv = (this_arg_conv->sign_psbt)(this_arg_conv->this_arg, psbt_ref);
21739         return tag_ptr(ret_conv, true);
21740 }
21741
21742 static jclass LDKGossipSync_P2P_class = NULL;
21743 static jmethodID LDKGossipSync_P2P_meth = NULL;
21744 static jclass LDKGossipSync_Rapid_class = NULL;
21745 static jmethodID LDKGossipSync_Rapid_meth = NULL;
21746 static jclass LDKGossipSync_None_class = NULL;
21747 static jmethodID LDKGossipSync_None_meth = NULL;
21748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKGossipSync_init (JNIEnv *env, jclass clz) {
21749         LDKGossipSync_P2P_class =
21750                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$P2P"));
21751         CHECK(LDKGossipSync_P2P_class != NULL);
21752         LDKGossipSync_P2P_meth = (*env)->GetMethodID(env, LDKGossipSync_P2P_class, "<init>", "(J)V");
21753         CHECK(LDKGossipSync_P2P_meth != NULL);
21754         LDKGossipSync_Rapid_class =
21755                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$Rapid"));
21756         CHECK(LDKGossipSync_Rapid_class != NULL);
21757         LDKGossipSync_Rapid_meth = (*env)->GetMethodID(env, LDKGossipSync_Rapid_class, "<init>", "(J)V");
21758         CHECK(LDKGossipSync_Rapid_meth != NULL);
21759         LDKGossipSync_None_class =
21760                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$None"));
21761         CHECK(LDKGossipSync_None_class != NULL);
21762         LDKGossipSync_None_meth = (*env)->GetMethodID(env, LDKGossipSync_None_class, "<init>", "()V");
21763         CHECK(LDKGossipSync_None_meth != NULL);
21764 }
21765 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKGossipSync_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
21766         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
21767         switch(obj->tag) {
21768                 case LDKGossipSync_P2P: {
21769                         LDKP2PGossipSync p2p_var = obj->p2p;
21770                         int64_t p2p_ref = 0;
21771                         CHECK_INNER_FIELD_ACCESS_OR_NULL(p2p_var);
21772                         p2p_ref = tag_ptr(p2p_var.inner, false);
21773                         return (*env)->NewObject(env, LDKGossipSync_P2P_class, LDKGossipSync_P2P_meth, p2p_ref);
21774                 }
21775                 case LDKGossipSync_Rapid: {
21776                         LDKRapidGossipSync rapid_var = obj->rapid;
21777                         int64_t rapid_ref = 0;
21778                         CHECK_INNER_FIELD_ACCESS_OR_NULL(rapid_var);
21779                         rapid_ref = tag_ptr(rapid_var.inner, false);
21780                         return (*env)->NewObject(env, LDKGossipSync_Rapid_class, LDKGossipSync_Rapid_meth, rapid_ref);
21781                 }
21782                 case LDKGossipSync_None: {
21783                         return (*env)->NewObject(env, LDKGossipSync_None_class, LDKGossipSync_None_meth);
21784                 }
21785                 default: abort();
21786         }
21787 }
21788 static jclass LDKFallback_SegWitProgram_class = NULL;
21789 static jmethodID LDKFallback_SegWitProgram_meth = NULL;
21790 static jclass LDKFallback_PubKeyHash_class = NULL;
21791 static jmethodID LDKFallback_PubKeyHash_meth = NULL;
21792 static jclass LDKFallback_ScriptHash_class = NULL;
21793 static jmethodID LDKFallback_ScriptHash_meth = NULL;
21794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFallback_init (JNIEnv *env, jclass clz) {
21795         LDKFallback_SegWitProgram_class =
21796                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$SegWitProgram"));
21797         CHECK(LDKFallback_SegWitProgram_class != NULL);
21798         LDKFallback_SegWitProgram_meth = (*env)->GetMethodID(env, LDKFallback_SegWitProgram_class, "<init>", "(B[B)V");
21799         CHECK(LDKFallback_SegWitProgram_meth != NULL);
21800         LDKFallback_PubKeyHash_class =
21801                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$PubKeyHash"));
21802         CHECK(LDKFallback_PubKeyHash_class != NULL);
21803         LDKFallback_PubKeyHash_meth = (*env)->GetMethodID(env, LDKFallback_PubKeyHash_class, "<init>", "([B)V");
21804         CHECK(LDKFallback_PubKeyHash_meth != NULL);
21805         LDKFallback_ScriptHash_class =
21806                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$ScriptHash"));
21807         CHECK(LDKFallback_ScriptHash_class != NULL);
21808         LDKFallback_ScriptHash_meth = (*env)->GetMethodID(env, LDKFallback_ScriptHash_class, "<init>", "([B)V");
21809         CHECK(LDKFallback_ScriptHash_meth != NULL);
21810 }
21811 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFallback_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
21812         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
21813         switch(obj->tag) {
21814                 case LDKFallback_SegWitProgram: {
21815                         uint8_t version_val = obj->seg_wit_program.version._0;
21816                         LDKCVec_u8Z program_var = obj->seg_wit_program.program;
21817                         int8_tArray program_arr = (*env)->NewByteArray(env, program_var.datalen);
21818                         (*env)->SetByteArrayRegion(env, program_arr, 0, program_var.datalen, program_var.data);
21819                         return (*env)->NewObject(env, LDKFallback_SegWitProgram_class, LDKFallback_SegWitProgram_meth, version_val, program_arr);
21820                 }
21821                 case LDKFallback_PubKeyHash: {
21822                         int8_tArray pub_key_hash_arr = (*env)->NewByteArray(env, 20);
21823                         (*env)->SetByteArrayRegion(env, pub_key_hash_arr, 0, 20, obj->pub_key_hash.data);
21824                         return (*env)->NewObject(env, LDKFallback_PubKeyHash_class, LDKFallback_PubKeyHash_meth, pub_key_hash_arr);
21825                 }
21826                 case LDKFallback_ScriptHash: {
21827                         int8_tArray script_hash_arr = (*env)->NewByteArray(env, 20);
21828                         (*env)->SetByteArrayRegion(env, script_hash_arr, 0, 20, obj->script_hash.data);
21829                         return (*env)->NewObject(env, LDKFallback_ScriptHash_class, LDKFallback_ScriptHash_meth, script_hash_arr);
21830                 }
21831                 default: abort();
21832         }
21833 }
21834 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version(JNIEnv *env, jclass clz) {
21835         LDKStr ret_str = _ldk_get_compiled_version();
21836         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
21837         Str_free(ret_str);
21838         return ret_conv;
21839 }
21840
21841 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1compiled_1version(JNIEnv *env, jclass clz) {
21842         LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
21843         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
21844         Str_free(ret_str);
21845         return ret_conv;
21846 }
21847
21848 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_U128_1le_1bytes(JNIEnv *env, jclass clz, int8_tArray val) {
21849         LDKU128 val_ref;
21850         CHECK((*env)->GetArrayLength(env, val) == 16);
21851         (*env)->GetByteArrayRegion(env, val, 0, 16, val_ref.le_bytes);
21852         int8_tArray ret_arr = (*env)->NewByteArray(env, 16);
21853         (*env)->SetByteArrayRegion(env, ret_arr, 0, 16, U128_le_bytes(val_ref).data);
21854         return ret_arr;
21855 }
21856
21857 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_U128_1new(JNIEnv *env, jclass clz, int8_tArray le_bytes) {
21858         LDKSixteenBytes le_bytes_ref;
21859         CHECK((*env)->GetArrayLength(env, le_bytes) == 16);
21860         (*env)->GetByteArrayRegion(env, le_bytes, 0, 16, le_bytes_ref.data);
21861         int8_tArray ret_arr = (*env)->NewByteArray(env, 16);
21862         (*env)->SetByteArrayRegion(env, ret_arr, 0, 16, U128_new(le_bytes_ref).le_bytes);
21863         return ret_arr;
21864 }
21865
21866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WitnessProgram_1new(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
21867         
21868         LDKCVec_u8Z program_ref;
21869         program_ref.datalen = (*env)->GetArrayLength(env, program);
21870         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
21871         (*env)->GetByteArrayRegion(env, program, 0, program_ref.datalen, program_ref.data);
21872         LDKWitnessProgram* ret_ref = MALLOC(sizeof(LDKWitnessProgram), "LDKWitnessProgram");
21873         *ret_ref = WitnessProgram_new((LDKWitnessVersion){ ._0 = version }, program_ref);
21874         return tag_ptr(ret_ref, true);
21875 }
21876
21877 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_WitnessProgram_1get_1version(JNIEnv *env, jclass clz, int64_t prog) {
21878         LDKWitnessProgram* prog_conv = (LDKWitnessProgram*)untag_ptr(prog);
21879         uint8_t ret_val = WitnessProgram_get_version(prog_conv)._0;
21880         return ret_val;
21881 }
21882
21883 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WitnessProgram_1get_1program(JNIEnv *env, jclass clz, int64_t prog) {
21884         LDKWitnessProgram* prog_conv = (LDKWitnessProgram*)untag_ptr(prog);
21885         LDKu8slice ret_var = WitnessProgram_get_program(prog_conv);
21886         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21887         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21888         return ret_arr;
21889 }
21890
21891 static inline uint64_t WitnessProgram_clone_ptr(LDKWitnessProgram *NONNULL_PTR arg) {
21892         LDKWitnessProgram* ret_ref = MALLOC(sizeof(LDKWitnessProgram), "LDKWitnessProgram");
21893         *ret_ref = WitnessProgram_clone(arg);
21894         return tag_ptr(ret_ref, true);
21895 }
21896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WitnessProgram_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21897         LDKWitnessProgram* arg_conv = (LDKWitnessProgram*)untag_ptr(arg);
21898         int64_t ret_conv = WitnessProgram_clone_ptr(arg_conv);
21899         return ret_conv;
21900 }
21901
21902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WitnessProgram_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21903         LDKWitnessProgram* orig_conv = (LDKWitnessProgram*)untag_ptr(orig);
21904         LDKWitnessProgram* ret_ref = MALLOC(sizeof(LDKWitnessProgram), "LDKWitnessProgram");
21905         *ret_ref = WitnessProgram_clone(orig_conv);
21906         return tag_ptr(ret_ref, true);
21907 }
21908
21909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WitnessProgram_1free(JNIEnv *env, jclass clz, int64_t o) {
21910         if (!ptr_is_owned(o)) return;
21911         void* o_ptr = untag_ptr(o);
21912         CHECK_ACCESS(o_ptr);
21913         LDKWitnessProgram o_conv = *(LDKWitnessProgram*)(o_ptr);
21914         FREE(untag_ptr(o));
21915         WitnessProgram_free(o_conv);
21916 }
21917
21918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1new(JNIEnv *env, jclass clz, int8_tArray big_endian_bytes) {
21919         LDKThirtyTwoBytes big_endian_bytes_ref;
21920         CHECK((*env)->GetArrayLength(env, big_endian_bytes) == 32);
21921         (*env)->GetByteArrayRegion(env, big_endian_bytes, 0, 32, big_endian_bytes_ref.data);
21922         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
21923         *ret_ref = BigEndianScalar_new(big_endian_bytes_ref);
21924         return tag_ptr(ret_ref, true);
21925 }
21926
21927 static inline uint64_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
21928         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
21929         *ret_copy = Bech32Error_clone(arg);
21930         int64_t ret_ref = tag_ptr(ret_copy, true);
21931         return ret_ref;
21932 }
21933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21934         LDKBech32Error* arg_conv = (LDKBech32Error*)untag_ptr(arg);
21935         int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
21936         return ret_conv;
21937 }
21938
21939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21940         LDKBech32Error* orig_conv = (LDKBech32Error*)untag_ptr(orig);
21941         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
21942         *ret_copy = Bech32Error_clone(orig_conv);
21943         int64_t ret_ref = tag_ptr(ret_copy, true);
21944         return ret_ref;
21945 }
21946
21947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bech32Error_1free(JNIEnv *env, jclass clz, int64_t o) {
21948         if (!ptr_is_owned(o)) return;
21949         void* o_ptr = untag_ptr(o);
21950         CHECK_ACCESS(o_ptr);
21951         LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
21952         FREE(untag_ptr(o));
21953         Bech32Error_free(o_conv);
21954 }
21955
21956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
21957         LDKTransaction _res_ref;
21958         _res_ref.datalen = (*env)->GetArrayLength(env, _res);
21959         _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
21960         (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
21961         _res_ref.data_is_owned = true;
21962         Transaction_free(_res_ref);
21963 }
21964
21965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Witness_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
21966         LDKWitness _res_ref;
21967         _res_ref.datalen = (*env)->GetArrayLength(env, _res);
21968         _res_ref.data = MALLOC(_res_ref.datalen, "LDKWitness Bytes");
21969         (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
21970         _res_ref.data_is_owned = true;
21971         Witness_free(_res_ref);
21972 }
21973
21974 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) {
21975         LDKWitness witness_ref;
21976         witness_ref.datalen = (*env)->GetArrayLength(env, witness);
21977         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
21978         (*env)->GetByteArrayRegion(env, witness, 0, witness_ref.datalen, witness_ref.data);
21979         witness_ref.data_is_owned = true;
21980         LDKCVec_u8Z script_sig_ref;
21981         script_sig_ref.datalen = (*env)->GetArrayLength(env, script_sig);
21982         script_sig_ref.data = MALLOC(script_sig_ref.datalen, "LDKCVec_u8Z Bytes");
21983         (*env)->GetByteArrayRegion(env, script_sig, 0, script_sig_ref.datalen, script_sig_ref.data);
21984         LDKThirtyTwoBytes previous_txid_ref;
21985         CHECK((*env)->GetArrayLength(env, previous_txid) == 32);
21986         (*env)->GetByteArrayRegion(env, previous_txid, 0, 32, previous_txid_ref.data);
21987         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
21988         *ret_ref = TxIn_new(witness_ref, script_sig_ref, sequence, previous_txid_ref, previous_vout);
21989         return tag_ptr(ret_ref, true);
21990 }
21991
21992 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxIn_1get_1witness(JNIEnv *env, jclass clz, int64_t txin) {
21993         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
21994         LDKWitness ret_var = TxIn_get_witness(txin_conv);
21995         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21996         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21997         Witness_free(ret_var);
21998         return ret_arr;
21999 }
22000
22001 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxIn_1get_1script_1sig(JNIEnv *env, jclass clz, int64_t txin) {
22002         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
22003         LDKu8slice ret_var = TxIn_get_script_sig(txin_conv);
22004         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22005         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22006         return ret_arr;
22007 }
22008
22009 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxIn_1get_1sequence(JNIEnv *env, jclass clz, int64_t txin) {
22010         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
22011         int32_t ret_conv = TxIn_get_sequence(txin_conv);
22012         return ret_conv;
22013 }
22014
22015 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxIn_1get_1previous_1txid(JNIEnv *env, jclass clz, int64_t txin) {
22016         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
22017         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22018         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TxIn_get_previous_txid(txin_conv).data);
22019         return ret_arr;
22020 }
22021
22022 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxIn_1get_1previous_1vout(JNIEnv *env, jclass clz, int64_t txin) {
22023         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
22024         int32_t ret_conv = TxIn_get_previous_vout(txin_conv);
22025         return ret_conv;
22026 }
22027
22028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxIn_1free(JNIEnv *env, jclass clz, int64_t _res) {
22029         if (!ptr_is_owned(_res)) return;
22030         void* _res_ptr = untag_ptr(_res);
22031         CHECK_ACCESS(_res_ptr);
22032         LDKTxIn _res_conv = *(LDKTxIn*)(_res_ptr);
22033         FREE(untag_ptr(_res));
22034         TxIn_free(_res_conv);
22035 }
22036
22037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1new(JNIEnv *env, jclass clz, int8_tArray script_pubkey, int64_t value) {
22038         LDKCVec_u8Z script_pubkey_ref;
22039         script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
22040         script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
22041         (*env)->GetByteArrayRegion(env, script_pubkey, 0, script_pubkey_ref.datalen, script_pubkey_ref.data);
22042         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
22043         *ret_ref = TxOut_new(script_pubkey_ref, value);
22044         return tag_ptr(ret_ref, true);
22045 }
22046
22047 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxOut_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t txout) {
22048         LDKTxOut* txout_conv = (LDKTxOut*)untag_ptr(txout);
22049         LDKu8slice ret_var = TxOut_get_script_pubkey(txout_conv);
22050         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22051         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22052         return ret_arr;
22053 }
22054
22055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1get_1value(JNIEnv *env, jclass clz, int64_t txout) {
22056         LDKTxOut* txout_conv = (LDKTxOut*)untag_ptr(txout);
22057         int64_t ret_conv = TxOut_get_value(txout_conv);
22058         return ret_conv;
22059 }
22060
22061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
22062         if (!ptr_is_owned(_res)) return;
22063         void* _res_ptr = untag_ptr(_res);
22064         CHECK_ACCESS(_res_ptr);
22065         LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
22066         FREE(untag_ptr(_res));
22067         TxOut_free(_res_conv);
22068 }
22069
22070 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
22071         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
22072         *ret_ref = TxOut_clone(arg);
22073         return tag_ptr(ret_ref, true);
22074 }
22075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22076         LDKTxOut* arg_conv = (LDKTxOut*)untag_ptr(arg);
22077         int64_t ret_conv = TxOut_clone_ptr(arg_conv);
22078         return ret_conv;
22079 }
22080
22081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22082         LDKTxOut* orig_conv = (LDKTxOut*)untag_ptr(orig);
22083         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
22084         *ret_ref = TxOut_clone(orig_conv);
22085         return tag_ptr(ret_ref, true);
22086 }
22087
22088 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free(JNIEnv *env, jclass clz, jstring _res) {
22089         LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
22090         Str_free(dummy);
22091 }
22092
22093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
22094         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
22095         *ret_copy = COption_u64Z_some(o);
22096         int64_t ret_ref = tag_ptr(ret_copy, true);
22097         return ret_ref;
22098 }
22099
22100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1none(JNIEnv *env, jclass clz) {
22101         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
22102         *ret_copy = COption_u64Z_none();
22103         int64_t ret_ref = tag_ptr(ret_copy, true);
22104         return ret_ref;
22105 }
22106
22107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
22108         if (!ptr_is_owned(_res)) return;
22109         void* _res_ptr = untag_ptr(_res);
22110         CHECK_ACCESS(_res_ptr);
22111         LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
22112         FREE(untag_ptr(_res));
22113         COption_u64Z_free(_res_conv);
22114 }
22115
22116 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
22117         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
22118         *ret_copy = COption_u64Z_clone(arg);
22119         int64_t ret_ref = tag_ptr(ret_copy, true);
22120         return ret_ref;
22121 }
22122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22123         LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)untag_ptr(arg);
22124         int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
22125         return ret_conv;
22126 }
22127
22128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22129         LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)untag_ptr(orig);
22130         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
22131         *ret_copy = COption_u64Z_clone(orig_conv);
22132         int64_t ret_ref = tag_ptr(ret_copy, true);
22133         return ret_ref;
22134 }
22135
22136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BlindedPathZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22137         LDKCVec_BlindedPathZ _res_constr;
22138         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22139         if (_res_constr.datalen > 0)
22140                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedPath), "LDKCVec_BlindedPathZ Elements");
22141         else
22142                 _res_constr.data = NULL;
22143         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22144         for (size_t n = 0; n < _res_constr.datalen; n++) {
22145                 int64_t _res_conv_13 = _res_vals[n];
22146                 LDKBlindedPath _res_conv_13_conv;
22147                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
22148                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
22149                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
22150                 _res_constr.data[n] = _res_conv_13_conv;
22151         }
22152         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22153         CVec_BlindedPathZ_free(_res_constr);
22154 }
22155
22156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22157         LDKRefund o_conv;
22158         o_conv.inner = untag_ptr(o);
22159         o_conv.is_owned = ptr_is_owned(o);
22160         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22161         o_conv = Refund_clone(&o_conv);
22162         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
22163         *ret_conv = CResult_RefundBolt12ParseErrorZ_ok(o_conv);
22164         return tag_ptr(ret_conv, true);
22165 }
22166
22167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22168         LDKBolt12ParseError e_conv;
22169         e_conv.inner = untag_ptr(e);
22170         e_conv.is_owned = ptr_is_owned(e);
22171         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22172         e_conv = Bolt12ParseError_clone(&e_conv);
22173         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
22174         *ret_conv = CResult_RefundBolt12ParseErrorZ_err(e_conv);
22175         return tag_ptr(ret_conv, true);
22176 }
22177
22178 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22179         LDKCResult_RefundBolt12ParseErrorZ* o_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(o);
22180         jboolean ret_conv = CResult_RefundBolt12ParseErrorZ_is_ok(o_conv);
22181         return ret_conv;
22182 }
22183
22184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22185         if (!ptr_is_owned(_res)) return;
22186         void* _res_ptr = untag_ptr(_res);
22187         CHECK_ACCESS(_res_ptr);
22188         LDKCResult_RefundBolt12ParseErrorZ _res_conv = *(LDKCResult_RefundBolt12ParseErrorZ*)(_res_ptr);
22189         FREE(untag_ptr(_res));
22190         CResult_RefundBolt12ParseErrorZ_free(_res_conv);
22191 }
22192
22193 static inline uint64_t CResult_RefundBolt12ParseErrorZ_clone_ptr(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR arg) {
22194         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
22195         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(arg);
22196         return tag_ptr(ret_conv, true);
22197 }
22198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22199         LDKCResult_RefundBolt12ParseErrorZ* arg_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(arg);
22200         int64_t ret_conv = CResult_RefundBolt12ParseErrorZ_clone_ptr(arg_conv);
22201         return ret_conv;
22202 }
22203
22204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22205         LDKCResult_RefundBolt12ParseErrorZ* orig_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(orig);
22206         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
22207         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(orig_conv);
22208         return tag_ptr(ret_conv, true);
22209 }
22210
22211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22212         void* o_ptr = untag_ptr(o);
22213         CHECK_ACCESS(o_ptr);
22214         LDKRetry o_conv = *(LDKRetry*)(o_ptr);
22215         o_conv = Retry_clone((LDKRetry*)untag_ptr(o));
22216         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
22217         *ret_conv = CResult_RetryDecodeErrorZ_ok(o_conv);
22218         return tag_ptr(ret_conv, true);
22219 }
22220
22221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22222         void* e_ptr = untag_ptr(e);
22223         CHECK_ACCESS(e_ptr);
22224         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22225         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22226         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
22227         *ret_conv = CResult_RetryDecodeErrorZ_err(e_conv);
22228         return tag_ptr(ret_conv, true);
22229 }
22230
22231 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22232         LDKCResult_RetryDecodeErrorZ* o_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(o);
22233         jboolean ret_conv = CResult_RetryDecodeErrorZ_is_ok(o_conv);
22234         return ret_conv;
22235 }
22236
22237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22238         if (!ptr_is_owned(_res)) return;
22239         void* _res_ptr = untag_ptr(_res);
22240         CHECK_ACCESS(_res_ptr);
22241         LDKCResult_RetryDecodeErrorZ _res_conv = *(LDKCResult_RetryDecodeErrorZ*)(_res_ptr);
22242         FREE(untag_ptr(_res));
22243         CResult_RetryDecodeErrorZ_free(_res_conv);
22244 }
22245
22246 static inline uint64_t CResult_RetryDecodeErrorZ_clone_ptr(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR arg) {
22247         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
22248         *ret_conv = CResult_RetryDecodeErrorZ_clone(arg);
22249         return tag_ptr(ret_conv, true);
22250 }
22251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22252         LDKCResult_RetryDecodeErrorZ* arg_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(arg);
22253         int64_t ret_conv = CResult_RetryDecodeErrorZ_clone_ptr(arg_conv);
22254         return ret_conv;
22255 }
22256
22257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22258         LDKCResult_RetryDecodeErrorZ* orig_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(orig);
22259         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
22260         *ret_conv = CResult_RetryDecodeErrorZ_clone(orig_conv);
22261         return tag_ptr(ret_conv, true);
22262 }
22263
22264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
22265         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
22266         *ret_conv = CResult_NoneAPIErrorZ_ok();
22267         return tag_ptr(ret_conv, true);
22268 }
22269
22270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22271         void* e_ptr = untag_ptr(e);
22272         CHECK_ACCESS(e_ptr);
22273         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
22274         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
22275         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
22276         *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
22277         return tag_ptr(ret_conv, true);
22278 }
22279
22280 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22281         LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o);
22282         jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
22283         return ret_conv;
22284 }
22285
22286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22287         if (!ptr_is_owned(_res)) return;
22288         void* _res_ptr = untag_ptr(_res);
22289         CHECK_ACCESS(_res_ptr);
22290         LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
22291         FREE(untag_ptr(_res));
22292         CResult_NoneAPIErrorZ_free(_res_conv);
22293 }
22294
22295 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
22296         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
22297         *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
22298         return tag_ptr(ret_conv, true);
22299 }
22300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22301         LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg);
22302         int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
22303         return ret_conv;
22304 }
22305
22306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22307         LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig);
22308         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
22309         *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
22310         return tag_ptr(ret_conv, true);
22311 }
22312
22313 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22314         LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
22315         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22316         if (_res_constr.datalen > 0)
22317                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
22318         else
22319                 _res_constr.data = NULL;
22320         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22321         for (size_t w = 0; w < _res_constr.datalen; w++) {
22322                 int64_t _res_conv_22 = _res_vals[w];
22323                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
22324                 CHECK_ACCESS(_res_conv_22_ptr);
22325                 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
22326                 FREE(untag_ptr(_res_conv_22));
22327                 _res_constr.data[w] = _res_conv_22_conv;
22328         }
22329         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22330         CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
22331 }
22332
22333 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22334         LDKCVec_APIErrorZ _res_constr;
22335         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22336         if (_res_constr.datalen > 0)
22337                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
22338         else
22339                 _res_constr.data = NULL;
22340         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22341         for (size_t k = 0; k < _res_constr.datalen; k++) {
22342                 int64_t _res_conv_10 = _res_vals[k];
22343                 void* _res_conv_10_ptr = untag_ptr(_res_conv_10);
22344                 CHECK_ACCESS(_res_conv_10_ptr);
22345                 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
22346                 FREE(untag_ptr(_res_conv_10));
22347                 _res_constr.data[k] = _res_conv_10_conv;
22348         }
22349         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22350         CVec_APIErrorZ_free(_res_constr);
22351 }
22352
22353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ThirtyTwoBytesZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
22354         LDKThirtyTwoBytes o_ref;
22355         CHECK((*env)->GetArrayLength(env, o) == 32);
22356         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
22357         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
22358         *ret_copy = COption_ThirtyTwoBytesZ_some(o_ref);
22359         int64_t ret_ref = tag_ptr(ret_copy, true);
22360         return ret_ref;
22361 }
22362
22363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ThirtyTwoBytesZ_1none(JNIEnv *env, jclass clz) {
22364         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
22365         *ret_copy = COption_ThirtyTwoBytesZ_none();
22366         int64_t ret_ref = tag_ptr(ret_copy, true);
22367         return ret_ref;
22368 }
22369
22370 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ThirtyTwoBytesZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22371         if (!ptr_is_owned(_res)) return;
22372         void* _res_ptr = untag_ptr(_res);
22373         CHECK_ACCESS(_res_ptr);
22374         LDKCOption_ThirtyTwoBytesZ _res_conv = *(LDKCOption_ThirtyTwoBytesZ*)(_res_ptr);
22375         FREE(untag_ptr(_res));
22376         COption_ThirtyTwoBytesZ_free(_res_conv);
22377 }
22378
22379 static inline uint64_t COption_ThirtyTwoBytesZ_clone_ptr(LDKCOption_ThirtyTwoBytesZ *NONNULL_PTR arg) {
22380         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
22381         *ret_copy = COption_ThirtyTwoBytesZ_clone(arg);
22382         int64_t ret_ref = tag_ptr(ret_copy, true);
22383         return ret_ref;
22384 }
22385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ThirtyTwoBytesZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22386         LDKCOption_ThirtyTwoBytesZ* arg_conv = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(arg);
22387         int64_t ret_conv = COption_ThirtyTwoBytesZ_clone_ptr(arg_conv);
22388         return ret_conv;
22389 }
22390
22391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ThirtyTwoBytesZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22392         LDKCOption_ThirtyTwoBytesZ* orig_conv = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(orig);
22393         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
22394         *ret_copy = COption_ThirtyTwoBytesZ_clone(orig_conv);
22395         int64_t ret_ref = tag_ptr(ret_copy, true);
22396         return ret_ref;
22397 }
22398
22399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
22400         LDKCVec_u8Z _res_ref;
22401         _res_ref.datalen = (*env)->GetArrayLength(env, _res);
22402         _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
22403         (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
22404         CVec_u8Z_free(_res_ref);
22405 }
22406
22407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
22408         LDKCVec_u8Z o_ref;
22409         o_ref.datalen = (*env)->GetArrayLength(env, o);
22410         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
22411         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
22412         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
22413         *ret_copy = COption_CVec_u8ZZ_some(o_ref);
22414         int64_t ret_ref = tag_ptr(ret_copy, true);
22415         return ret_ref;
22416 }
22417
22418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1none(JNIEnv *env, jclass clz) {
22419         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
22420         *ret_copy = COption_CVec_u8ZZ_none();
22421         int64_t ret_ref = tag_ptr(ret_copy, true);
22422         return ret_ref;
22423 }
22424
22425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22426         if (!ptr_is_owned(_res)) return;
22427         void* _res_ptr = untag_ptr(_res);
22428         CHECK_ACCESS(_res_ptr);
22429         LDKCOption_CVec_u8ZZ _res_conv = *(LDKCOption_CVec_u8ZZ*)(_res_ptr);
22430         FREE(untag_ptr(_res));
22431         COption_CVec_u8ZZ_free(_res_conv);
22432 }
22433
22434 static inline uint64_t COption_CVec_u8ZZ_clone_ptr(LDKCOption_CVec_u8ZZ *NONNULL_PTR arg) {
22435         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
22436         *ret_copy = COption_CVec_u8ZZ_clone(arg);
22437         int64_t ret_ref = tag_ptr(ret_copy, true);
22438         return ret_ref;
22439 }
22440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22441         LDKCOption_CVec_u8ZZ* arg_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(arg);
22442         int64_t ret_conv = COption_CVec_u8ZZ_clone_ptr(arg_conv);
22443         return ret_conv;
22444 }
22445
22446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22447         LDKCOption_CVec_u8ZZ* orig_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(orig);
22448         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
22449         *ret_copy = COption_CVec_u8ZZ_clone(orig_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_CResult_1RecipientOnionFieldsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22455         LDKRecipientOnionFields o_conv;
22456         o_conv.inner = untag_ptr(o);
22457         o_conv.is_owned = ptr_is_owned(o);
22458         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22459         o_conv = RecipientOnionFields_clone(&o_conv);
22460         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
22461         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_ok(o_conv);
22462         return tag_ptr(ret_conv, true);
22463 }
22464
22465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22466         void* e_ptr = untag_ptr(e);
22467         CHECK_ACCESS(e_ptr);
22468         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22469         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22470         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
22471         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_err(e_conv);
22472         return tag_ptr(ret_conv, true);
22473 }
22474
22475 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22476         LDKCResult_RecipientOnionFieldsDecodeErrorZ* o_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(o);
22477         jboolean ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(o_conv);
22478         return ret_conv;
22479 }
22480
22481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22482         if (!ptr_is_owned(_res)) return;
22483         void* _res_ptr = untag_ptr(_res);
22484         CHECK_ACCESS(_res_ptr);
22485         LDKCResult_RecipientOnionFieldsDecodeErrorZ _res_conv = *(LDKCResult_RecipientOnionFieldsDecodeErrorZ*)(_res_ptr);
22486         FREE(untag_ptr(_res));
22487         CResult_RecipientOnionFieldsDecodeErrorZ_free(_res_conv);
22488 }
22489
22490 static inline uint64_t CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR arg) {
22491         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
22492         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(arg);
22493         return tag_ptr(ret_conv, true);
22494 }
22495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22496         LDKCResult_RecipientOnionFieldsDecodeErrorZ* arg_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(arg);
22497         int64_t ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(arg_conv);
22498         return ret_conv;
22499 }
22500
22501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22502         LDKCResult_RecipientOnionFieldsDecodeErrorZ* orig_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(orig);
22503         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
22504         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(orig_conv);
22505         return tag_ptr(ret_conv, true);
22506 }
22507
22508 static inline uint64_t C2Tuple_u64CVec_u8ZZ_clone_ptr(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR arg) {
22509         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
22510         *ret_conv = C2Tuple_u64CVec_u8ZZ_clone(arg);
22511         return tag_ptr(ret_conv, true);
22512 }
22513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22514         LDKC2Tuple_u64CVec_u8ZZ* arg_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(arg);
22515         int64_t ret_conv = C2Tuple_u64CVec_u8ZZ_clone_ptr(arg_conv);
22516         return ret_conv;
22517 }
22518
22519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22520         LDKC2Tuple_u64CVec_u8ZZ* orig_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(orig);
22521         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
22522         *ret_conv = C2Tuple_u64CVec_u8ZZ_clone(orig_conv);
22523         return tag_ptr(ret_conv, true);
22524 }
22525
22526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
22527         LDKCVec_u8Z b_ref;
22528         b_ref.datalen = (*env)->GetArrayLength(env, b);
22529         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
22530         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
22531         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
22532         *ret_conv = C2Tuple_u64CVec_u8ZZ_new(a, b_ref);
22533         return tag_ptr(ret_conv, true);
22534 }
22535
22536 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22537         if (!ptr_is_owned(_res)) return;
22538         void* _res_ptr = untag_ptr(_res);
22539         CHECK_ACCESS(_res_ptr);
22540         LDKC2Tuple_u64CVec_u8ZZ _res_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(_res_ptr);
22541         FREE(untag_ptr(_res));
22542         C2Tuple_u64CVec_u8ZZ_free(_res_conv);
22543 }
22544
22545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u64CVec_1u8ZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22546         LDKCVec_C2Tuple_u64CVec_u8ZZZ _res_constr;
22547         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22548         if (_res_constr.datalen > 0)
22549                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
22550         else
22551                 _res_constr.data = NULL;
22552         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22553         for (size_t x = 0; x < _res_constr.datalen; x++) {
22554                 int64_t _res_conv_23 = _res_vals[x];
22555                 void* _res_conv_23_ptr = untag_ptr(_res_conv_23);
22556                 CHECK_ACCESS(_res_conv_23_ptr);
22557                 LDKC2Tuple_u64CVec_u8ZZ _res_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(_res_conv_23_ptr);
22558                 FREE(untag_ptr(_res_conv_23));
22559                 _res_constr.data[x] = _res_conv_23_conv;
22560         }
22561         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22562         CVec_C2Tuple_u64CVec_u8ZZZ_free(_res_constr);
22563 }
22564
22565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22566         LDKRecipientOnionFields o_conv;
22567         o_conv.inner = untag_ptr(o);
22568         o_conv.is_owned = ptr_is_owned(o);
22569         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22570         o_conv = RecipientOnionFields_clone(&o_conv);
22571         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
22572         *ret_conv = CResult_RecipientOnionFieldsNoneZ_ok(o_conv);
22573         return tag_ptr(ret_conv, true);
22574 }
22575
22576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1err(JNIEnv *env, jclass clz) {
22577         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
22578         *ret_conv = CResult_RecipientOnionFieldsNoneZ_err();
22579         return tag_ptr(ret_conv, true);
22580 }
22581
22582 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22583         LDKCResult_RecipientOnionFieldsNoneZ* o_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(o);
22584         jboolean ret_conv = CResult_RecipientOnionFieldsNoneZ_is_ok(o_conv);
22585         return ret_conv;
22586 }
22587
22588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22589         if (!ptr_is_owned(_res)) return;
22590         void* _res_ptr = untag_ptr(_res);
22591         CHECK_ACCESS(_res_ptr);
22592         LDKCResult_RecipientOnionFieldsNoneZ _res_conv = *(LDKCResult_RecipientOnionFieldsNoneZ*)(_res_ptr);
22593         FREE(untag_ptr(_res));
22594         CResult_RecipientOnionFieldsNoneZ_free(_res_conv);
22595 }
22596
22597 static inline uint64_t CResult_RecipientOnionFieldsNoneZ_clone_ptr(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR arg) {
22598         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
22599         *ret_conv = CResult_RecipientOnionFieldsNoneZ_clone(arg);
22600         return tag_ptr(ret_conv, true);
22601 }
22602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22603         LDKCResult_RecipientOnionFieldsNoneZ* arg_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(arg);
22604         int64_t ret_conv = CResult_RecipientOnionFieldsNoneZ_clone_ptr(arg_conv);
22605         return ret_conv;
22606 }
22607
22608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22609         LDKCResult_RecipientOnionFieldsNoneZ* orig_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(orig);
22610         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
22611         *ret_conv = CResult_RecipientOnionFieldsNoneZ_clone(orig_conv);
22612         return tag_ptr(ret_conv, true);
22613 }
22614
22615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ThirtyTwoBytesZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
22616         LDKCVec_ThirtyTwoBytesZ _res_constr;
22617         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22618         if (_res_constr.datalen > 0)
22619                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
22620         else
22621                 _res_constr.data = NULL;
22622         for (size_t i = 0; i < _res_constr.datalen; i++) {
22623                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
22624                 LDKThirtyTwoBytes _res_conv_8_ref;
22625                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
22626                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
22627                 _res_constr.data[i] = _res_conv_8_ref;
22628         }
22629         CVec_ThirtyTwoBytesZ_free(_res_constr);
22630 }
22631
22632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ThirtyTwoBytesZZ_1some(JNIEnv *env, jclass clz, jobjectArray o) {
22633         LDKCVec_ThirtyTwoBytesZ o_constr;
22634         o_constr.datalen = (*env)->GetArrayLength(env, o);
22635         if (o_constr.datalen > 0)
22636                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
22637         else
22638                 o_constr.data = NULL;
22639         for (size_t i = 0; i < o_constr.datalen; i++) {
22640                 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
22641                 LDKThirtyTwoBytes o_conv_8_ref;
22642                 CHECK((*env)->GetArrayLength(env, o_conv_8) == 32);
22643                 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 32, o_conv_8_ref.data);
22644                 o_constr.data[i] = o_conv_8_ref;
22645         }
22646         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
22647         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_some(o_constr);
22648         int64_t ret_ref = tag_ptr(ret_copy, true);
22649         return ret_ref;
22650 }
22651
22652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ThirtyTwoBytesZZ_1none(JNIEnv *env, jclass clz) {
22653         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
22654         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_none();
22655         int64_t ret_ref = tag_ptr(ret_copy, true);
22656         return ret_ref;
22657 }
22658
22659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ThirtyTwoBytesZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22660         if (!ptr_is_owned(_res)) return;
22661         void* _res_ptr = untag_ptr(_res);
22662         CHECK_ACCESS(_res_ptr);
22663         LDKCOption_CVec_ThirtyTwoBytesZZ _res_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(_res_ptr);
22664         FREE(untag_ptr(_res));
22665         COption_CVec_ThirtyTwoBytesZZ_free(_res_conv);
22666 }
22667
22668 static inline uint64_t COption_CVec_ThirtyTwoBytesZZ_clone_ptr(LDKCOption_CVec_ThirtyTwoBytesZZ *NONNULL_PTR arg) {
22669         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
22670         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_clone(arg);
22671         int64_t ret_ref = tag_ptr(ret_copy, true);
22672         return ret_ref;
22673 }
22674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ThirtyTwoBytesZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22675         LDKCOption_CVec_ThirtyTwoBytesZZ* arg_conv = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(arg);
22676         int64_t ret_conv = COption_CVec_ThirtyTwoBytesZZ_clone_ptr(arg_conv);
22677         return ret_conv;
22678 }
22679
22680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ThirtyTwoBytesZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22681         LDKCOption_CVec_ThirtyTwoBytesZZ* orig_conv = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(orig);
22682         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
22683         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_clone(orig_conv);
22684         int64_t ret_ref = tag_ptr(ret_copy, true);
22685         return ret_ref;
22686 }
22687
22688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
22689         LDKThirtyTwoBytes o_ref;
22690         CHECK((*env)->GetArrayLength(env, o) == 32);
22691         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
22692         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
22693         *ret_conv = CResult_ThirtyTwoBytesNoneZ_ok(o_ref);
22694         return tag_ptr(ret_conv, true);
22695 }
22696
22697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1err(JNIEnv *env, jclass clz) {
22698         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
22699         *ret_conv = CResult_ThirtyTwoBytesNoneZ_err();
22700         return tag_ptr(ret_conv, true);
22701 }
22702
22703 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22704         LDKCResult_ThirtyTwoBytesNoneZ* o_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(o);
22705         jboolean ret_conv = CResult_ThirtyTwoBytesNoneZ_is_ok(o_conv);
22706         return ret_conv;
22707 }
22708
22709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22710         if (!ptr_is_owned(_res)) return;
22711         void* _res_ptr = untag_ptr(_res);
22712         CHECK_ACCESS(_res_ptr);
22713         LDKCResult_ThirtyTwoBytesNoneZ _res_conv = *(LDKCResult_ThirtyTwoBytesNoneZ*)(_res_ptr);
22714         FREE(untag_ptr(_res));
22715         CResult_ThirtyTwoBytesNoneZ_free(_res_conv);
22716 }
22717
22718 static inline uint64_t CResult_ThirtyTwoBytesNoneZ_clone_ptr(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR arg) {
22719         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
22720         *ret_conv = CResult_ThirtyTwoBytesNoneZ_clone(arg);
22721         return tag_ptr(ret_conv, true);
22722 }
22723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22724         LDKCResult_ThirtyTwoBytesNoneZ* arg_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(arg);
22725         int64_t ret_conv = CResult_ThirtyTwoBytesNoneZ_clone_ptr(arg_conv);
22726         return ret_conv;
22727 }
22728
22729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22730         LDKCResult_ThirtyTwoBytesNoneZ* orig_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(orig);
22731         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
22732         *ret_conv = CResult_ThirtyTwoBytesNoneZ_clone(orig_conv);
22733         return tag_ptr(ret_conv, true);
22734 }
22735
22736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22737         LDKBlindedPayInfo o_conv;
22738         o_conv.inner = untag_ptr(o);
22739         o_conv.is_owned = ptr_is_owned(o);
22740         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22741         o_conv = BlindedPayInfo_clone(&o_conv);
22742         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
22743         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_ok(o_conv);
22744         return tag_ptr(ret_conv, true);
22745 }
22746
22747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22748         void* e_ptr = untag_ptr(e);
22749         CHECK_ACCESS(e_ptr);
22750         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22751         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22752         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
22753         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_err(e_conv);
22754         return tag_ptr(ret_conv, true);
22755 }
22756
22757 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22758         LDKCResult_BlindedPayInfoDecodeErrorZ* o_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(o);
22759         jboolean ret_conv = CResult_BlindedPayInfoDecodeErrorZ_is_ok(o_conv);
22760         return ret_conv;
22761 }
22762
22763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22764         if (!ptr_is_owned(_res)) return;
22765         void* _res_ptr = untag_ptr(_res);
22766         CHECK_ACCESS(_res_ptr);
22767         LDKCResult_BlindedPayInfoDecodeErrorZ _res_conv = *(LDKCResult_BlindedPayInfoDecodeErrorZ*)(_res_ptr);
22768         FREE(untag_ptr(_res));
22769         CResult_BlindedPayInfoDecodeErrorZ_free(_res_conv);
22770 }
22771
22772 static inline uint64_t CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR arg) {
22773         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
22774         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(arg);
22775         return tag_ptr(ret_conv, true);
22776 }
22777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22778         LDKCResult_BlindedPayInfoDecodeErrorZ* arg_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(arg);
22779         int64_t ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(arg_conv);
22780         return ret_conv;
22781 }
22782
22783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22784         LDKCResult_BlindedPayInfoDecodeErrorZ* orig_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(orig);
22785         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
22786         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(orig_conv);
22787         return tag_ptr(ret_conv, true);
22788 }
22789
22790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22791         LDKDelayedPaymentOutputDescriptor o_conv;
22792         o_conv.inner = untag_ptr(o);
22793         o_conv.is_owned = ptr_is_owned(o);
22794         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22795         o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
22796         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
22797         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
22798         return tag_ptr(ret_conv, true);
22799 }
22800
22801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22802         void* e_ptr = untag_ptr(e);
22803         CHECK_ACCESS(e_ptr);
22804         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22805         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22806         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
22807         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
22808         return tag_ptr(ret_conv, true);
22809 }
22810
22811 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22812         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
22813         jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
22814         return ret_conv;
22815 }
22816
22817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22818         if (!ptr_is_owned(_res)) return;
22819         void* _res_ptr = untag_ptr(_res);
22820         CHECK_ACCESS(_res_ptr);
22821         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
22822         FREE(untag_ptr(_res));
22823         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
22824 }
22825
22826 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
22827         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
22828         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
22829         return tag_ptr(ret_conv, true);
22830 }
22831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22832         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
22833         int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
22834         return ret_conv;
22835 }
22836
22837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22838         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
22839         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
22840         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
22841         return tag_ptr(ret_conv, true);
22842 }
22843
22844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22845         LDKStaticPaymentOutputDescriptor o_conv;
22846         o_conv.inner = untag_ptr(o);
22847         o_conv.is_owned = ptr_is_owned(o);
22848         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22849         o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
22850         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
22851         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
22852         return tag_ptr(ret_conv, true);
22853 }
22854
22855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22856         void* e_ptr = untag_ptr(e);
22857         CHECK_ACCESS(e_ptr);
22858         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22859         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22860         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
22861         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
22862         return tag_ptr(ret_conv, true);
22863 }
22864
22865 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22866         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
22867         jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
22868         return ret_conv;
22869 }
22870
22871 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22872         if (!ptr_is_owned(_res)) return;
22873         void* _res_ptr = untag_ptr(_res);
22874         CHECK_ACCESS(_res_ptr);
22875         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
22876         FREE(untag_ptr(_res));
22877         CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
22878 }
22879
22880 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
22881         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
22882         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
22883         return tag_ptr(ret_conv, true);
22884 }
22885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22886         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
22887         int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
22888         return ret_conv;
22889 }
22890
22891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22892         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
22893         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
22894         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
22895         return tag_ptr(ret_conv, true);
22896 }
22897
22898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22899         void* o_ptr = untag_ptr(o);
22900         CHECK_ACCESS(o_ptr);
22901         LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
22902         o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(o));
22903         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
22904         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
22905         return tag_ptr(ret_conv, true);
22906 }
22907
22908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22909         void* e_ptr = untag_ptr(e);
22910         CHECK_ACCESS(e_ptr);
22911         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22912         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22913         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
22914         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
22915         return tag_ptr(ret_conv, true);
22916 }
22917
22918 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22919         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(o);
22920         jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
22921         return ret_conv;
22922 }
22923
22924 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22925         if (!ptr_is_owned(_res)) return;
22926         void* _res_ptr = untag_ptr(_res);
22927         CHECK_ACCESS(_res_ptr);
22928         LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
22929         FREE(untag_ptr(_res));
22930         CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
22931 }
22932
22933 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
22934         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
22935         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
22936         return tag_ptr(ret_conv, true);
22937 }
22938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22939         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
22940         int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
22941         return ret_conv;
22942 }
22943
22944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22945         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
22946         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
22947         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
22948         return tag_ptr(ret_conv, true);
22949 }
22950
22951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22952         LDKCVec_SpendableOutputDescriptorZ _res_constr;
22953         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22954         if (_res_constr.datalen > 0)
22955                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
22956         else
22957                 _res_constr.data = NULL;
22958         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22959         for (size_t b = 0; b < _res_constr.datalen; b++) {
22960                 int64_t _res_conv_27 = _res_vals[b];
22961                 void* _res_conv_27_ptr = untag_ptr(_res_conv_27);
22962                 CHECK_ACCESS(_res_conv_27_ptr);
22963                 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
22964                 FREE(untag_ptr(_res_conv_27));
22965                 _res_constr.data[b] = _res_conv_27_conv;
22966         }
22967         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22968         CVec_SpendableOutputDescriptorZ_free(_res_constr);
22969 }
22970
22971 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22972         LDKCVec_TxOutZ _res_constr;
22973         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22974         if (_res_constr.datalen > 0)
22975                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
22976         else
22977                 _res_constr.data = NULL;
22978         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22979         for (size_t h = 0; h < _res_constr.datalen; h++) {
22980                 int64_t _res_conv_7 = _res_vals[h];
22981                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
22982                 CHECK_ACCESS(_res_conv_7_ptr);
22983                 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
22984                 FREE(untag_ptr(_res_conv_7));
22985                 _res_constr.data[h] = _res_conv_7_conv;
22986         }
22987         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22988         CVec_TxOutZ_free(_res_constr);
22989 }
22990
22991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1some(JNIEnv *env, jclass clz, int32_t o) {
22992         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
22993         *ret_copy = COption_u32Z_some(o);
22994         int64_t ret_ref = tag_ptr(ret_copy, true);
22995         return ret_ref;
22996 }
22997
22998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1none(JNIEnv *env, jclass clz) {
22999         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
23000         *ret_copy = COption_u32Z_none();
23001         int64_t ret_ref = tag_ptr(ret_copy, true);
23002         return ret_ref;
23003 }
23004
23005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
23006         if (!ptr_is_owned(_res)) return;
23007         void* _res_ptr = untag_ptr(_res);
23008         CHECK_ACCESS(_res_ptr);
23009         LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
23010         FREE(untag_ptr(_res));
23011         COption_u32Z_free(_res_conv);
23012 }
23013
23014 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
23015         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
23016         *ret_copy = COption_u32Z_clone(arg);
23017         int64_t ret_ref = tag_ptr(ret_copy, true);
23018         return ret_ref;
23019 }
23020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23021         LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)untag_ptr(arg);
23022         int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
23023         return ret_conv;
23024 }
23025
23026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23027         LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)untag_ptr(orig);
23028         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
23029         *ret_copy = COption_u32Z_clone(orig_conv);
23030         int64_t ret_ref = tag_ptr(ret_copy, true);
23031         return ret_ref;
23032 }
23033
23034 static inline uint64_t C2Tuple_CVec_u8Zu64Z_clone_ptr(LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR arg) {
23035         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
23036         *ret_conv = C2Tuple_CVec_u8Zu64Z_clone(arg);
23037         return tag_ptr(ret_conv, true);
23038 }
23039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8Zu64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23040         LDKC2Tuple_CVec_u8Zu64Z* arg_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(arg);
23041         int64_t ret_conv = C2Tuple_CVec_u8Zu64Z_clone_ptr(arg_conv);
23042         return ret_conv;
23043 }
23044
23045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8Zu64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23046         LDKC2Tuple_CVec_u8Zu64Z* orig_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(orig);
23047         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
23048         *ret_conv = C2Tuple_CVec_u8Zu64Z_clone(orig_conv);
23049         return tag_ptr(ret_conv, true);
23050 }
23051
23052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8Zu64Z_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
23053         LDKCVec_u8Z a_ref;
23054         a_ref.datalen = (*env)->GetArrayLength(env, a);
23055         a_ref.data = MALLOC(a_ref.datalen, "LDKCVec_u8Z Bytes");
23056         (*env)->GetByteArrayRegion(env, a, 0, a_ref.datalen, a_ref.data);
23057         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
23058         *ret_conv = C2Tuple_CVec_u8Zu64Z_new(a_ref, b);
23059         return tag_ptr(ret_conv, true);
23060 }
23061
23062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8Zu64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
23063         if (!ptr_is_owned(_res)) return;
23064         void* _res_ptr = untag_ptr(_res);
23065         CHECK_ACCESS(_res_ptr);
23066         LDKC2Tuple_CVec_u8Zu64Z _res_conv = *(LDKC2Tuple_CVec_u8Zu64Z*)(_res_ptr);
23067         FREE(untag_ptr(_res));
23068         C2Tuple_CVec_u8Zu64Z_free(_res_conv);
23069 }
23070
23071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8Zu64ZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23072         void* o_ptr = untag_ptr(o);
23073         CHECK_ACCESS(o_ptr);
23074         LDKC2Tuple_CVec_u8Zu64Z o_conv = *(LDKC2Tuple_CVec_u8Zu64Z*)(o_ptr);
23075         o_conv = C2Tuple_CVec_u8Zu64Z_clone((LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(o));
23076         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
23077         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_ok(o_conv);
23078         return tag_ptr(ret_conv, true);
23079 }
23080
23081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8Zu64ZNoneZ_1err(JNIEnv *env, jclass clz) {
23082         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
23083         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_err();
23084         return tag_ptr(ret_conv, true);
23085 }
23086
23087 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8Zu64ZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23088         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* o_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(o);
23089         jboolean ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_is_ok(o_conv);
23090         return ret_conv;
23091 }
23092
23093 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8Zu64ZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23094         if (!ptr_is_owned(_res)) return;
23095         void* _res_ptr = untag_ptr(_res);
23096         CHECK_ACCESS(_res_ptr);
23097         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ _res_conv = *(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)(_res_ptr);
23098         FREE(untag_ptr(_res));
23099         CResult_C2Tuple_CVec_u8Zu64ZNoneZ_free(_res_conv);
23100 }
23101
23102 static inline uint64_t CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone_ptr(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR arg) {
23103         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
23104         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(arg);
23105         return tag_ptr(ret_conv, true);
23106 }
23107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8Zu64ZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23108         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* arg_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(arg);
23109         int64_t ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone_ptr(arg_conv);
23110         return ret_conv;
23111 }
23112
23113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8Zu64ZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23114         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* orig_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(orig);
23115         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
23116         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(orig_conv);
23117         return tag_ptr(ret_conv, true);
23118 }
23119
23120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23121         LDKChannelDerivationParameters o_conv;
23122         o_conv.inner = untag_ptr(o);
23123         o_conv.is_owned = ptr_is_owned(o);
23124         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23125         o_conv = ChannelDerivationParameters_clone(&o_conv);
23126         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
23127         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_ok(o_conv);
23128         return tag_ptr(ret_conv, true);
23129 }
23130
23131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23132         void* e_ptr = untag_ptr(e);
23133         CHECK_ACCESS(e_ptr);
23134         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23135         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23136         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
23137         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_err(e_conv);
23138         return tag_ptr(ret_conv, true);
23139 }
23140
23141 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23142         LDKCResult_ChannelDerivationParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(o);
23143         jboolean ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(o_conv);
23144         return ret_conv;
23145 }
23146
23147 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23148         if (!ptr_is_owned(_res)) return;
23149         void* _res_ptr = untag_ptr(_res);
23150         CHECK_ACCESS(_res_ptr);
23151         LDKCResult_ChannelDerivationParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelDerivationParametersDecodeErrorZ*)(_res_ptr);
23152         FREE(untag_ptr(_res));
23153         CResult_ChannelDerivationParametersDecodeErrorZ_free(_res_conv);
23154 }
23155
23156 static inline uint64_t CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR arg) {
23157         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
23158         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(arg);
23159         return tag_ptr(ret_conv, true);
23160 }
23161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23162         LDKCResult_ChannelDerivationParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(arg);
23163         int64_t ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(arg_conv);
23164         return ret_conv;
23165 }
23166
23167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23168         LDKCResult_ChannelDerivationParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(orig);
23169         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
23170         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(orig_conv);
23171         return tag_ptr(ret_conv, true);
23172 }
23173
23174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23175         LDKHTLCDescriptor o_conv;
23176         o_conv.inner = untag_ptr(o);
23177         o_conv.is_owned = ptr_is_owned(o);
23178         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23179         o_conv = HTLCDescriptor_clone(&o_conv);
23180         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
23181         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_ok(o_conv);
23182         return tag_ptr(ret_conv, true);
23183 }
23184
23185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23186         void* e_ptr = untag_ptr(e);
23187         CHECK_ACCESS(e_ptr);
23188         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23189         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23190         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
23191         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_err(e_conv);
23192         return tag_ptr(ret_conv, true);
23193 }
23194
23195 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23196         LDKCResult_HTLCDescriptorDecodeErrorZ* o_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(o);
23197         jboolean ret_conv = CResult_HTLCDescriptorDecodeErrorZ_is_ok(o_conv);
23198         return ret_conv;
23199 }
23200
23201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23202         if (!ptr_is_owned(_res)) return;
23203         void* _res_ptr = untag_ptr(_res);
23204         CHECK_ACCESS(_res_ptr);
23205         LDKCResult_HTLCDescriptorDecodeErrorZ _res_conv = *(LDKCResult_HTLCDescriptorDecodeErrorZ*)(_res_ptr);
23206         FREE(untag_ptr(_res));
23207         CResult_HTLCDescriptorDecodeErrorZ_free(_res_conv);
23208 }
23209
23210 static inline uint64_t CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR arg) {
23211         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
23212         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(arg);
23213         return tag_ptr(ret_conv, true);
23214 }
23215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23216         LDKCResult_HTLCDescriptorDecodeErrorZ* arg_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(arg);
23217         int64_t ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(arg_conv);
23218         return ret_conv;
23219 }
23220
23221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23222         LDKCResult_HTLCDescriptorDecodeErrorZ* orig_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(orig);
23223         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
23224         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(orig_conv);
23225         return tag_ptr(ret_conv, true);
23226 }
23227
23228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1ok(JNIEnv *env, jclass clz) {
23229         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
23230         *ret_conv = CResult_NoneNoneZ_ok();
23231         return tag_ptr(ret_conv, true);
23232 }
23233
23234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1err(JNIEnv *env, jclass clz) {
23235         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
23236         *ret_conv = CResult_NoneNoneZ_err();
23237         return tag_ptr(ret_conv, true);
23238 }
23239
23240 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23241         LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)untag_ptr(o);
23242         jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
23243         return ret_conv;
23244 }
23245
23246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23247         if (!ptr_is_owned(_res)) return;
23248         void* _res_ptr = untag_ptr(_res);
23249         CHECK_ACCESS(_res_ptr);
23250         LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
23251         FREE(untag_ptr(_res));
23252         CResult_NoneNoneZ_free(_res_conv);
23253 }
23254
23255 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
23256         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
23257         *ret_conv = CResult_NoneNoneZ_clone(arg);
23258         return tag_ptr(ret_conv, true);
23259 }
23260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23261         LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)untag_ptr(arg);
23262         int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
23263         return ret_conv;
23264 }
23265
23266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23267         LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)untag_ptr(orig);
23268         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
23269         *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
23270         return tag_ptr(ret_conv, true);
23271 }
23272
23273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
23274         LDKPublicKey o_ref;
23275         CHECK((*env)->GetArrayLength(env, o) == 33);
23276         (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
23277         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
23278         *ret_conv = CResult_PublicKeyNoneZ_ok(o_ref);
23279         return tag_ptr(ret_conv, true);
23280 }
23281
23282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1err(JNIEnv *env, jclass clz) {
23283         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
23284         *ret_conv = CResult_PublicKeyNoneZ_err();
23285         return tag_ptr(ret_conv, true);
23286 }
23287
23288 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23289         LDKCResult_PublicKeyNoneZ* o_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(o);
23290         jboolean ret_conv = CResult_PublicKeyNoneZ_is_ok(o_conv);
23291         return ret_conv;
23292 }
23293
23294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23295         if (!ptr_is_owned(_res)) return;
23296         void* _res_ptr = untag_ptr(_res);
23297         CHECK_ACCESS(_res_ptr);
23298         LDKCResult_PublicKeyNoneZ _res_conv = *(LDKCResult_PublicKeyNoneZ*)(_res_ptr);
23299         FREE(untag_ptr(_res));
23300         CResult_PublicKeyNoneZ_free(_res_conv);
23301 }
23302
23303 static inline uint64_t CResult_PublicKeyNoneZ_clone_ptr(LDKCResult_PublicKeyNoneZ *NONNULL_PTR arg) {
23304         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
23305         *ret_conv = CResult_PublicKeyNoneZ_clone(arg);
23306         return tag_ptr(ret_conv, true);
23307 }
23308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23309         LDKCResult_PublicKeyNoneZ* arg_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(arg);
23310         int64_t ret_conv = CResult_PublicKeyNoneZ_clone_ptr(arg_conv);
23311         return ret_conv;
23312 }
23313
23314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23315         LDKCResult_PublicKeyNoneZ* orig_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(orig);
23316         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
23317         *ret_conv = CResult_PublicKeyNoneZ_clone(orig_conv);
23318         return tag_ptr(ret_conv, true);
23319 }
23320
23321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1BigEndianScalarZ_1some(JNIEnv *env, jclass clz, int64_t o) {
23322         void* o_ptr = untag_ptr(o);
23323         CHECK_ACCESS(o_ptr);
23324         LDKBigEndianScalar o_conv = *(LDKBigEndianScalar*)(o_ptr);
23325         // WARNING: we may need a move here but no clone is available for LDKBigEndianScalar
23326         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
23327         *ret_copy = COption_BigEndianScalarZ_some(o_conv);
23328         int64_t ret_ref = tag_ptr(ret_copy, true);
23329         return ret_ref;
23330 }
23331
23332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1BigEndianScalarZ_1none(JNIEnv *env, jclass clz) {
23333         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
23334         *ret_copy = COption_BigEndianScalarZ_none();
23335         int64_t ret_ref = tag_ptr(ret_copy, true);
23336         return ret_ref;
23337 }
23338
23339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1BigEndianScalarZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23340         if (!ptr_is_owned(_res)) return;
23341         void* _res_ptr = untag_ptr(_res);
23342         CHECK_ACCESS(_res_ptr);
23343         LDKCOption_BigEndianScalarZ _res_conv = *(LDKCOption_BigEndianScalarZ*)(_res_ptr);
23344         FREE(untag_ptr(_res));
23345         COption_BigEndianScalarZ_free(_res_conv);
23346 }
23347
23348 static inline uint64_t COption_BigEndianScalarZ_clone_ptr(LDKCOption_BigEndianScalarZ *NONNULL_PTR arg) {
23349         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
23350         *ret_copy = COption_BigEndianScalarZ_clone(arg);
23351         int64_t ret_ref = tag_ptr(ret_copy, true);
23352         return ret_ref;
23353 }
23354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1BigEndianScalarZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23355         LDKCOption_BigEndianScalarZ* arg_conv = (LDKCOption_BigEndianScalarZ*)untag_ptr(arg);
23356         int64_t ret_conv = COption_BigEndianScalarZ_clone_ptr(arg_conv);
23357         return ret_conv;
23358 }
23359
23360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1BigEndianScalarZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23361         LDKCOption_BigEndianScalarZ* orig_conv = (LDKCOption_BigEndianScalarZ*)untag_ptr(orig);
23362         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
23363         *ret_copy = COption_BigEndianScalarZ_clone(orig_conv);
23364         int64_t ret_ref = tag_ptr(ret_copy, true);
23365         return ret_ref;
23366 }
23367
23368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1U5Z_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
23369         LDKCVec_U5Z _res_constr;
23370         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23371         if (_res_constr.datalen > 0)
23372                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
23373         else
23374                 _res_constr.data = NULL;
23375         int8_t* _res_vals = (*env)->GetByteArrayElements (env, _res, NULL);
23376         for (size_t h = 0; h < _res_constr.datalen; h++) {
23377                 int8_t _res_conv_7 = _res_vals[h];
23378                 
23379                 _res_constr.data[h] = (LDKU5){ ._0 = _res_conv_7 };
23380         }
23381         (*env)->ReleaseByteArrayElements(env, _res, _res_vals, 0);
23382         CVec_U5Z_free(_res_constr);
23383 }
23384
23385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
23386         LDKRecoverableSignature o_ref;
23387         CHECK((*env)->GetArrayLength(env, o) == 68);
23388         (*env)->GetByteArrayRegion(env, o, 0, 68, o_ref.serialized_form);
23389         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
23390         *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
23391         return tag_ptr(ret_conv, true);
23392 }
23393
23394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
23395         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
23396         *ret_conv = CResult_RecoverableSignatureNoneZ_err();
23397         return tag_ptr(ret_conv, true);
23398 }
23399
23400 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23401         LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(o);
23402         jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
23403         return ret_conv;
23404 }
23405
23406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23407         if (!ptr_is_owned(_res)) return;
23408         void* _res_ptr = untag_ptr(_res);
23409         CHECK_ACCESS(_res_ptr);
23410         LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
23411         FREE(untag_ptr(_res));
23412         CResult_RecoverableSignatureNoneZ_free(_res_conv);
23413 }
23414
23415 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
23416         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
23417         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
23418         return tag_ptr(ret_conv, true);
23419 }
23420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23421         LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(arg);
23422         int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
23423         return ret_conv;
23424 }
23425
23426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23427         LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(orig);
23428         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
23429         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
23430         return tag_ptr(ret_conv, true);
23431 }
23432
23433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
23434         LDKSchnorrSignature o_ref;
23435         CHECK((*env)->GetArrayLength(env, o) == 64);
23436         (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
23437         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
23438         *ret_conv = CResult_SchnorrSignatureNoneZ_ok(o_ref);
23439         return tag_ptr(ret_conv, true);
23440 }
23441
23442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
23443         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
23444         *ret_conv = CResult_SchnorrSignatureNoneZ_err();
23445         return tag_ptr(ret_conv, true);
23446 }
23447
23448 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23449         LDKCResult_SchnorrSignatureNoneZ* o_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(o);
23450         jboolean ret_conv = CResult_SchnorrSignatureNoneZ_is_ok(o_conv);
23451         return ret_conv;
23452 }
23453
23454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23455         if (!ptr_is_owned(_res)) return;
23456         void* _res_ptr = untag_ptr(_res);
23457         CHECK_ACCESS(_res_ptr);
23458         LDKCResult_SchnorrSignatureNoneZ _res_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(_res_ptr);
23459         FREE(untag_ptr(_res));
23460         CResult_SchnorrSignatureNoneZ_free(_res_conv);
23461 }
23462
23463 static inline uint64_t CResult_SchnorrSignatureNoneZ_clone_ptr(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR arg) {
23464         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
23465         *ret_conv = CResult_SchnorrSignatureNoneZ_clone(arg);
23466         return tag_ptr(ret_conv, true);
23467 }
23468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23469         LDKCResult_SchnorrSignatureNoneZ* arg_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(arg);
23470         int64_t ret_conv = CResult_SchnorrSignatureNoneZ_clone_ptr(arg_conv);
23471         return ret_conv;
23472 }
23473
23474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23475         LDKCResult_SchnorrSignatureNoneZ* orig_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(orig);
23476         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
23477         *ret_conv = CResult_SchnorrSignatureNoneZ_clone(orig_conv);
23478         return tag_ptr(ret_conv, true);
23479 }
23480
23481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
23482         LDKECDSASignature o_ref;
23483         CHECK((*env)->GetArrayLength(env, o) == 64);
23484         (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
23485         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
23486         *ret_conv = CResult_ECDSASignatureNoneZ_ok(o_ref);
23487         return tag_ptr(ret_conv, true);
23488 }
23489
23490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1err(JNIEnv *env, jclass clz) {
23491         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
23492         *ret_conv = CResult_ECDSASignatureNoneZ_err();
23493         return tag_ptr(ret_conv, true);
23494 }
23495
23496 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23497         LDKCResult_ECDSASignatureNoneZ* o_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(o);
23498         jboolean ret_conv = CResult_ECDSASignatureNoneZ_is_ok(o_conv);
23499         return ret_conv;
23500 }
23501
23502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23503         if (!ptr_is_owned(_res)) return;
23504         void* _res_ptr = untag_ptr(_res);
23505         CHECK_ACCESS(_res_ptr);
23506         LDKCResult_ECDSASignatureNoneZ _res_conv = *(LDKCResult_ECDSASignatureNoneZ*)(_res_ptr);
23507         FREE(untag_ptr(_res));
23508         CResult_ECDSASignatureNoneZ_free(_res_conv);
23509 }
23510
23511 static inline uint64_t CResult_ECDSASignatureNoneZ_clone_ptr(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR arg) {
23512         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
23513         *ret_conv = CResult_ECDSASignatureNoneZ_clone(arg);
23514         return tag_ptr(ret_conv, true);
23515 }
23516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23517         LDKCResult_ECDSASignatureNoneZ* arg_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(arg);
23518         int64_t ret_conv = CResult_ECDSASignatureNoneZ_clone_ptr(arg_conv);
23519         return ret_conv;
23520 }
23521
23522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23523         LDKCResult_ECDSASignatureNoneZ* orig_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(orig);
23524         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
23525         *ret_conv = CResult_ECDSASignatureNoneZ_clone(orig_conv);
23526         return tag_ptr(ret_conv, true);
23527 }
23528
23529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23530         void* o_ptr = untag_ptr(o);
23531         CHECK_ACCESS(o_ptr);
23532         LDKWriteableEcdsaChannelSigner o_conv = *(LDKWriteableEcdsaChannelSigner*)(o_ptr);
23533         if (o_conv.free == LDKWriteableEcdsaChannelSigner_JCalls_free) {
23534                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23535                 LDKWriteableEcdsaChannelSigner_JCalls_cloned(&o_conv);
23536         }
23537         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
23538         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o_conv);
23539         return tag_ptr(ret_conv, true);
23540 }
23541
23542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23543         void* e_ptr = untag_ptr(e);
23544         CHECK_ACCESS(e_ptr);
23545         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23546         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23547         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
23548         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e_conv);
23549         return tag_ptr(ret_conv, true);
23550 }
23551
23552 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23553         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* o_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(o);
23554         jboolean ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o_conv);
23555         return ret_conv;
23556 }
23557
23558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23559         if (!ptr_is_owned(_res)) return;
23560         void* _res_ptr = untag_ptr(_res);
23561         CHECK_ACCESS(_res_ptr);
23562         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(_res_ptr);
23563         FREE(untag_ptr(_res));
23564         CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res_conv);
23565 }
23566
23567 static inline uint64_t CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR arg) {
23568         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
23569         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(arg);
23570         return tag_ptr(ret_conv, true);
23571 }
23572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23573         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* arg_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(arg);
23574         int64_t ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(arg_conv);
23575         return ret_conv;
23576 }
23577
23578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23579         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* orig_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(orig);
23580         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
23581         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig_conv);
23582         return tag_ptr(ret_conv, true);
23583 }
23584
23585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
23586         LDKCVec_u8Z o_ref;
23587         o_ref.datalen = (*env)->GetArrayLength(env, o);
23588         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
23589         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
23590         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
23591         *ret_conv = CResult_CVec_u8ZNoneZ_ok(o_ref);
23592         return tag_ptr(ret_conv, true);
23593 }
23594
23595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1err(JNIEnv *env, jclass clz) {
23596         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
23597         *ret_conv = CResult_CVec_u8ZNoneZ_err();
23598         return tag_ptr(ret_conv, true);
23599 }
23600
23601 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23602         LDKCResult_CVec_u8ZNoneZ* o_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(o);
23603         jboolean ret_conv = CResult_CVec_u8ZNoneZ_is_ok(o_conv);
23604         return ret_conv;
23605 }
23606
23607 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23608         if (!ptr_is_owned(_res)) return;
23609         void* _res_ptr = untag_ptr(_res);
23610         CHECK_ACCESS(_res_ptr);
23611         LDKCResult_CVec_u8ZNoneZ _res_conv = *(LDKCResult_CVec_u8ZNoneZ*)(_res_ptr);
23612         FREE(untag_ptr(_res));
23613         CResult_CVec_u8ZNoneZ_free(_res_conv);
23614 }
23615
23616 static inline uint64_t CResult_CVec_u8ZNoneZ_clone_ptr(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR arg) {
23617         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
23618         *ret_conv = CResult_CVec_u8ZNoneZ_clone(arg);
23619         return tag_ptr(ret_conv, true);
23620 }
23621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23622         LDKCResult_CVec_u8ZNoneZ* arg_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(arg);
23623         int64_t ret_conv = CResult_CVec_u8ZNoneZ_clone_ptr(arg_conv);
23624         return ret_conv;
23625 }
23626
23627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23628         LDKCResult_CVec_u8ZNoneZ* orig_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(orig);
23629         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
23630         *ret_conv = CResult_CVec_u8ZNoneZ_clone(orig_conv);
23631         return tag_ptr(ret_conv, true);
23632 }
23633
23634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23635         LDKShutdownScript o_conv;
23636         o_conv.inner = untag_ptr(o);
23637         o_conv.is_owned = ptr_is_owned(o);
23638         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23639         o_conv = ShutdownScript_clone(&o_conv);
23640         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
23641         *ret_conv = CResult_ShutdownScriptNoneZ_ok(o_conv);
23642         return tag_ptr(ret_conv, true);
23643 }
23644
23645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1err(JNIEnv *env, jclass clz) {
23646         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
23647         *ret_conv = CResult_ShutdownScriptNoneZ_err();
23648         return tag_ptr(ret_conv, true);
23649 }
23650
23651 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23652         LDKCResult_ShutdownScriptNoneZ* o_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(o);
23653         jboolean ret_conv = CResult_ShutdownScriptNoneZ_is_ok(o_conv);
23654         return ret_conv;
23655 }
23656
23657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23658         if (!ptr_is_owned(_res)) return;
23659         void* _res_ptr = untag_ptr(_res);
23660         CHECK_ACCESS(_res_ptr);
23661         LDKCResult_ShutdownScriptNoneZ _res_conv = *(LDKCResult_ShutdownScriptNoneZ*)(_res_ptr);
23662         FREE(untag_ptr(_res));
23663         CResult_ShutdownScriptNoneZ_free(_res_conv);
23664 }
23665
23666 static inline uint64_t CResult_ShutdownScriptNoneZ_clone_ptr(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR arg) {
23667         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
23668         *ret_conv = CResult_ShutdownScriptNoneZ_clone(arg);
23669         return tag_ptr(ret_conv, true);
23670 }
23671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23672         LDKCResult_ShutdownScriptNoneZ* arg_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(arg);
23673         int64_t ret_conv = CResult_ShutdownScriptNoneZ_clone_ptr(arg_conv);
23674         return ret_conv;
23675 }
23676
23677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23678         LDKCResult_ShutdownScriptNoneZ* orig_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(orig);
23679         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
23680         *ret_conv = CResult_ShutdownScriptNoneZ_clone(orig_conv);
23681         return tag_ptr(ret_conv, true);
23682 }
23683
23684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1some(JNIEnv *env, jclass clz, int16_t o) {
23685         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
23686         *ret_copy = COption_u16Z_some(o);
23687         int64_t ret_ref = tag_ptr(ret_copy, true);
23688         return ret_ref;
23689 }
23690
23691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1none(JNIEnv *env, jclass clz) {
23692         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
23693         *ret_copy = COption_u16Z_none();
23694         int64_t ret_ref = tag_ptr(ret_copy, true);
23695         return ret_ref;
23696 }
23697
23698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
23699         if (!ptr_is_owned(_res)) return;
23700         void* _res_ptr = untag_ptr(_res);
23701         CHECK_ACCESS(_res_ptr);
23702         LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
23703         FREE(untag_ptr(_res));
23704         COption_u16Z_free(_res_conv);
23705 }
23706
23707 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
23708         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
23709         *ret_copy = COption_u16Z_clone(arg);
23710         int64_t ret_ref = tag_ptr(ret_copy, true);
23711         return ret_ref;
23712 }
23713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23714         LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)untag_ptr(arg);
23715         int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
23716         return ret_conv;
23717 }
23718
23719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23720         LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)untag_ptr(orig);
23721         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
23722         *ret_copy = COption_u16Z_clone(orig_conv);
23723         int64_t ret_ref = tag_ptr(ret_copy, true);
23724         return ret_ref;
23725 }
23726
23727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1boolZ_1some(JNIEnv *env, jclass clz, jboolean o) {
23728         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
23729         *ret_copy = COption_boolZ_some(o);
23730         int64_t ret_ref = tag_ptr(ret_copy, true);
23731         return ret_ref;
23732 }
23733
23734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1boolZ_1none(JNIEnv *env, jclass clz) {
23735         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
23736         *ret_copy = COption_boolZ_none();
23737         int64_t ret_ref = tag_ptr(ret_copy, true);
23738         return ret_ref;
23739 }
23740
23741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1boolZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23742         if (!ptr_is_owned(_res)) return;
23743         void* _res_ptr = untag_ptr(_res);
23744         CHECK_ACCESS(_res_ptr);
23745         LDKCOption_boolZ _res_conv = *(LDKCOption_boolZ*)(_res_ptr);
23746         FREE(untag_ptr(_res));
23747         COption_boolZ_free(_res_conv);
23748 }
23749
23750 static inline uint64_t COption_boolZ_clone_ptr(LDKCOption_boolZ *NONNULL_PTR arg) {
23751         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
23752         *ret_copy = COption_boolZ_clone(arg);
23753         int64_t ret_ref = tag_ptr(ret_copy, true);
23754         return ret_ref;
23755 }
23756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1boolZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23757         LDKCOption_boolZ* arg_conv = (LDKCOption_boolZ*)untag_ptr(arg);
23758         int64_t ret_conv = COption_boolZ_clone_ptr(arg_conv);
23759         return ret_conv;
23760 }
23761
23762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1boolZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23763         LDKCOption_boolZ* orig_conv = (LDKCOption_boolZ*)untag_ptr(orig);
23764         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
23765         *ret_copy = COption_boolZ_clone(orig_conv);
23766         int64_t ret_ref = tag_ptr(ret_copy, true);
23767         return ret_ref;
23768 }
23769
23770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WitnessNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
23771         LDKWitness o_ref;
23772         o_ref.datalen = (*env)->GetArrayLength(env, o);
23773         o_ref.data = MALLOC(o_ref.datalen, "LDKWitness Bytes");
23774         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
23775         o_ref.data_is_owned = true;
23776         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
23777         *ret_conv = CResult_WitnessNoneZ_ok(o_ref);
23778         return tag_ptr(ret_conv, true);
23779 }
23780
23781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WitnessNoneZ_1err(JNIEnv *env, jclass clz) {
23782         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
23783         *ret_conv = CResult_WitnessNoneZ_err();
23784         return tag_ptr(ret_conv, true);
23785 }
23786
23787 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WitnessNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23788         LDKCResult_WitnessNoneZ* o_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(o);
23789         jboolean ret_conv = CResult_WitnessNoneZ_is_ok(o_conv);
23790         return ret_conv;
23791 }
23792
23793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WitnessNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23794         if (!ptr_is_owned(_res)) return;
23795         void* _res_ptr = untag_ptr(_res);
23796         CHECK_ACCESS(_res_ptr);
23797         LDKCResult_WitnessNoneZ _res_conv = *(LDKCResult_WitnessNoneZ*)(_res_ptr);
23798         FREE(untag_ptr(_res));
23799         CResult_WitnessNoneZ_free(_res_conv);
23800 }
23801
23802 static inline uint64_t CResult_WitnessNoneZ_clone_ptr(LDKCResult_WitnessNoneZ *NONNULL_PTR arg) {
23803         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
23804         *ret_conv = CResult_WitnessNoneZ_clone(arg);
23805         return tag_ptr(ret_conv, true);
23806 }
23807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WitnessNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23808         LDKCResult_WitnessNoneZ* arg_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(arg);
23809         int64_t ret_conv = CResult_WitnessNoneZ_clone_ptr(arg_conv);
23810         return ret_conv;
23811 }
23812
23813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WitnessNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23814         LDKCResult_WitnessNoneZ* orig_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(orig);
23815         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
23816         *ret_conv = CResult_WitnessNoneZ_clone(orig_conv);
23817         return tag_ptr(ret_conv, true);
23818 }
23819
23820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ECDSASignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
23821         LDKCVec_ECDSASignatureZ _res_constr;
23822         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23823         if (_res_constr.datalen > 0)
23824                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
23825         else
23826                 _res_constr.data = NULL;
23827         for (size_t i = 0; i < _res_constr.datalen; i++) {
23828                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
23829                 LDKECDSASignature _res_conv_8_ref;
23830                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 64);
23831                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 64, _res_conv_8_ref.compact_form);
23832                 _res_constr.data[i] = _res_conv_8_ref;
23833         }
23834         CVec_ECDSASignatureZ_free(_res_constr);
23835 }
23836
23837 static inline uint64_t C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR arg) {
23838         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
23839         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(arg);
23840         return tag_ptr(ret_conv, true);
23841 }
23842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23843         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* arg_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(arg);
23844         int64_t ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(arg_conv);
23845         return ret_conv;
23846 }
23847
23848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23849         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* orig_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(orig);
23850         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
23851         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(orig_conv);
23852         return tag_ptr(ret_conv, true);
23853 }
23854
23855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
23856         LDKECDSASignature a_ref;
23857         CHECK((*env)->GetArrayLength(env, a) == 64);
23858         (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
23859         LDKCVec_ECDSASignatureZ b_constr;
23860         b_constr.datalen = (*env)->GetArrayLength(env, b);
23861         if (b_constr.datalen > 0)
23862                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
23863         else
23864                 b_constr.data = NULL;
23865         for (size_t i = 0; i < b_constr.datalen; i++) {
23866                 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
23867                 LDKECDSASignature b_conv_8_ref;
23868                 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
23869                 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
23870                 b_constr.data[i] = b_conv_8_ref;
23871         }
23872         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
23873         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(a_ref, b_constr);
23874         return tag_ptr(ret_conv, true);
23875 }
23876
23877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23878         if (!ptr_is_owned(_res)) return;
23879         void* _res_ptr = untag_ptr(_res);
23880         CHECK_ACCESS(_res_ptr);
23881         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ _res_conv = *(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)(_res_ptr);
23882         FREE(untag_ptr(_res));
23883         C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(_res_conv);
23884 }
23885
23886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23887         void* o_ptr = untag_ptr(o);
23888         CHECK_ACCESS(o_ptr);
23889         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ o_conv = *(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)(o_ptr);
23890         o_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone((LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(o));
23891         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
23892         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(o_conv);
23893         return tag_ptr(ret_conv, true);
23894 }
23895
23896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
23897         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
23898         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err();
23899         return tag_ptr(ret_conv, true);
23900 }
23901
23902 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23903         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(o);
23904         jboolean ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(o_conv);
23905         return ret_conv;
23906 }
23907
23908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23909         if (!ptr_is_owned(_res)) return;
23910         void* _res_ptr = untag_ptr(_res);
23911         CHECK_ACCESS(_res_ptr);
23912         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(_res_ptr);
23913         FREE(untag_ptr(_res));
23914         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(_res_conv);
23915 }
23916
23917 static inline uint64_t CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR arg) {
23918         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
23919         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(arg);
23920         return tag_ptr(ret_conv, true);
23921 }
23922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23923         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(arg);
23924         int64_t ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(arg_conv);
23925         return ret_conv;
23926 }
23927
23928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23929         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(orig);
23930         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
23931         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(orig_conv);
23932         return tag_ptr(ret_conv, true);
23933 }
23934
23935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23936         LDKInMemorySigner o_conv;
23937         o_conv.inner = untag_ptr(o);
23938         o_conv.is_owned = ptr_is_owned(o);
23939         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23940         o_conv = InMemorySigner_clone(&o_conv);
23941         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
23942         *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
23943         return tag_ptr(ret_conv, true);
23944 }
23945
23946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23947         void* e_ptr = untag_ptr(e);
23948         CHECK_ACCESS(e_ptr);
23949         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23950         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23951         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
23952         *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
23953         return tag_ptr(ret_conv, true);
23954 }
23955
23956 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23957         LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(o);
23958         jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
23959         return ret_conv;
23960 }
23961
23962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23963         if (!ptr_is_owned(_res)) return;
23964         void* _res_ptr = untag_ptr(_res);
23965         CHECK_ACCESS(_res_ptr);
23966         LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
23967         FREE(untag_ptr(_res));
23968         CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
23969 }
23970
23971 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
23972         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
23973         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
23974         return tag_ptr(ret_conv, true);
23975 }
23976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23977         LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(arg);
23978         int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
23979         return ret_conv;
23980 }
23981
23982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23983         LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(orig);
23984         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
23985         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
23986         return tag_ptr(ret_conv, true);
23987 }
23988
23989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
23990         LDKTransaction o_ref;
23991         o_ref.datalen = (*env)->GetArrayLength(env, o);
23992         o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
23993         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
23994         o_ref.data_is_owned = true;
23995         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
23996         *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
23997         return tag_ptr(ret_conv, true);
23998 }
23999
24000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err(JNIEnv *env, jclass clz) {
24001         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
24002         *ret_conv = CResult_TransactionNoneZ_err();
24003         return tag_ptr(ret_conv, true);
24004 }
24005
24006 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24007         LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(o);
24008         jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
24009         return ret_conv;
24010 }
24011
24012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24013         if (!ptr_is_owned(_res)) return;
24014         void* _res_ptr = untag_ptr(_res);
24015         CHECK_ACCESS(_res_ptr);
24016         LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
24017         FREE(untag_ptr(_res));
24018         CResult_TransactionNoneZ_free(_res_conv);
24019 }
24020
24021 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
24022         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
24023         *ret_conv = CResult_TransactionNoneZ_clone(arg);
24024         return tag_ptr(ret_conv, true);
24025 }
24026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24027         LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(arg);
24028         int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
24029         return ret_conv;
24030 }
24031
24032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24033         LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(orig);
24034         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
24035         *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
24036         return tag_ptr(ret_conv, true);
24037 }
24038
24039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1WriteableScoreZ_1some(JNIEnv *env, jclass clz, int64_t o) {
24040         void* o_ptr = untag_ptr(o);
24041         CHECK_ACCESS(o_ptr);
24042         LDKWriteableScore o_conv = *(LDKWriteableScore*)(o_ptr);
24043         if (o_conv.free == LDKWriteableScore_JCalls_free) {
24044                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24045                 LDKWriteableScore_JCalls_cloned(&o_conv);
24046         }
24047         LDKCOption_WriteableScoreZ *ret_copy = MALLOC(sizeof(LDKCOption_WriteableScoreZ), "LDKCOption_WriteableScoreZ");
24048         *ret_copy = COption_WriteableScoreZ_some(o_conv);
24049         int64_t ret_ref = tag_ptr(ret_copy, true);
24050         return ret_ref;
24051 }
24052
24053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1WriteableScoreZ_1none(JNIEnv *env, jclass clz) {
24054         LDKCOption_WriteableScoreZ *ret_copy = MALLOC(sizeof(LDKCOption_WriteableScoreZ), "LDKCOption_WriteableScoreZ");
24055         *ret_copy = COption_WriteableScoreZ_none();
24056         int64_t ret_ref = tag_ptr(ret_copy, true);
24057         return ret_ref;
24058 }
24059
24060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1WriteableScoreZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24061         if (!ptr_is_owned(_res)) return;
24062         void* _res_ptr = untag_ptr(_res);
24063         CHECK_ACCESS(_res_ptr);
24064         LDKCOption_WriteableScoreZ _res_conv = *(LDKCOption_WriteableScoreZ*)(_res_ptr);
24065         FREE(untag_ptr(_res));
24066         COption_WriteableScoreZ_free(_res_conv);
24067 }
24068
24069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1ok(JNIEnv *env, jclass clz) {
24070         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
24071         *ret_conv = CResult_NoneIOErrorZ_ok();
24072         return tag_ptr(ret_conv, true);
24073 }
24074
24075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
24076         LDKIOError e_conv = LDKIOError_from_java(env, e);
24077         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
24078         *ret_conv = CResult_NoneIOErrorZ_err(e_conv);
24079         return tag_ptr(ret_conv, true);
24080 }
24081
24082 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24083         LDKCResult_NoneIOErrorZ* o_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(o);
24084         jboolean ret_conv = CResult_NoneIOErrorZ_is_ok(o_conv);
24085         return ret_conv;
24086 }
24087
24088 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24089         if (!ptr_is_owned(_res)) return;
24090         void* _res_ptr = untag_ptr(_res);
24091         CHECK_ACCESS(_res_ptr);
24092         LDKCResult_NoneIOErrorZ _res_conv = *(LDKCResult_NoneIOErrorZ*)(_res_ptr);
24093         FREE(untag_ptr(_res));
24094         CResult_NoneIOErrorZ_free(_res_conv);
24095 }
24096
24097 static inline uint64_t CResult_NoneIOErrorZ_clone_ptr(LDKCResult_NoneIOErrorZ *NONNULL_PTR arg) {
24098         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
24099         *ret_conv = CResult_NoneIOErrorZ_clone(arg);
24100         return tag_ptr(ret_conv, true);
24101 }
24102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24103         LDKCResult_NoneIOErrorZ* arg_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(arg);
24104         int64_t ret_conv = CResult_NoneIOErrorZ_clone_ptr(arg_conv);
24105         return ret_conv;
24106 }
24107
24108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24109         LDKCResult_NoneIOErrorZ* orig_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(orig);
24110         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
24111         *ret_conv = CResult_NoneIOErrorZ_clone(orig_conv);
24112         return tag_ptr(ret_conv, true);
24113 }
24114
24115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24116         LDKCVec_ChannelDetailsZ _res_constr;
24117         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24118         if (_res_constr.datalen > 0)
24119                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
24120         else
24121                 _res_constr.data = NULL;
24122         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24123         for (size_t q = 0; q < _res_constr.datalen; q++) {
24124                 int64_t _res_conv_16 = _res_vals[q];
24125                 LDKChannelDetails _res_conv_16_conv;
24126                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
24127                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
24128                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
24129                 _res_constr.data[q] = _res_conv_16_conv;
24130         }
24131         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24132         CVec_ChannelDetailsZ_free(_res_constr);
24133 }
24134
24135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24136         LDKRoute o_conv;
24137         o_conv.inner = untag_ptr(o);
24138         o_conv.is_owned = ptr_is_owned(o);
24139         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24140         o_conv = Route_clone(&o_conv);
24141         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
24142         *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
24143         return tag_ptr(ret_conv, true);
24144 }
24145
24146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24147         LDKLightningError e_conv;
24148         e_conv.inner = untag_ptr(e);
24149         e_conv.is_owned = ptr_is_owned(e);
24150         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
24151         e_conv = LightningError_clone(&e_conv);
24152         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
24153         *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
24154         return tag_ptr(ret_conv, true);
24155 }
24156
24157 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24158         LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(o);
24159         jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
24160         return ret_conv;
24161 }
24162
24163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24164         if (!ptr_is_owned(_res)) return;
24165         void* _res_ptr = untag_ptr(_res);
24166         CHECK_ACCESS(_res_ptr);
24167         LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
24168         FREE(untag_ptr(_res));
24169         CResult_RouteLightningErrorZ_free(_res_conv);
24170 }
24171
24172 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
24173         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
24174         *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
24175         return tag_ptr(ret_conv, true);
24176 }
24177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24178         LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(arg);
24179         int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
24180         return ret_conv;
24181 }
24182
24183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24184         LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(orig);
24185         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
24186         *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
24187         return tag_ptr(ret_conv, true);
24188 }
24189
24190 static inline uint64_t C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR arg) {
24191         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
24192         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(arg);
24193         return tag_ptr(ret_conv, true);
24194 }
24195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24196         LDKC2Tuple_BlindedPayInfoBlindedPathZ* arg_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(arg);
24197         int64_t ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(arg_conv);
24198         return ret_conv;
24199 }
24200
24201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24202         LDKC2Tuple_BlindedPayInfoBlindedPathZ* orig_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(orig);
24203         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
24204         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(orig_conv);
24205         return tag_ptr(ret_conv, true);
24206 }
24207
24208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24209         LDKBlindedPayInfo a_conv;
24210         a_conv.inner = untag_ptr(a);
24211         a_conv.is_owned = ptr_is_owned(a);
24212         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24213         a_conv = BlindedPayInfo_clone(&a_conv);
24214         LDKBlindedPath b_conv;
24215         b_conv.inner = untag_ptr(b);
24216         b_conv.is_owned = ptr_is_owned(b);
24217         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24218         b_conv = BlindedPath_clone(&b_conv);
24219         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
24220         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_new(a_conv, b_conv);
24221         return tag_ptr(ret_conv, true);
24222 }
24223
24224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24225         if (!ptr_is_owned(_res)) return;
24226         void* _res_ptr = untag_ptr(_res);
24227         CHECK_ACCESS(_res_ptr);
24228         LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_ptr);
24229         FREE(untag_ptr(_res));
24230         C2Tuple_BlindedPayInfoBlindedPathZ_free(_res_conv);
24231 }
24232
24233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24234         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ _res_constr;
24235         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24236         if (_res_constr.datalen > 0)
24237                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
24238         else
24239                 _res_constr.data = NULL;
24240         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24241         for (size_t l = 0; l < _res_constr.datalen; l++) {
24242                 int64_t _res_conv_37 = _res_vals[l];
24243                 void* _res_conv_37_ptr = untag_ptr(_res_conv_37);
24244                 CHECK_ACCESS(_res_conv_37_ptr);
24245                 LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_conv_37_ptr);
24246                 FREE(untag_ptr(_res_conv_37));
24247                 _res_constr.data[l] = _res_conv_37_conv;
24248         }
24249         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24250         CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(_res_constr);
24251 }
24252
24253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
24254         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ o_constr;
24255         o_constr.datalen = (*env)->GetArrayLength(env, o);
24256         if (o_constr.datalen > 0)
24257                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
24258         else
24259                 o_constr.data = NULL;
24260         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
24261         for (size_t l = 0; l < o_constr.datalen; l++) {
24262                 int64_t o_conv_37 = o_vals[l];
24263                 void* o_conv_37_ptr = untag_ptr(o_conv_37);
24264                 CHECK_ACCESS(o_conv_37_ptr);
24265                 LDKC2Tuple_BlindedPayInfoBlindedPathZ o_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(o_conv_37_ptr);
24266                 o_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(o_conv_37));
24267                 o_constr.data[l] = o_conv_37_conv;
24268         }
24269         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
24270         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
24271         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_ok(o_constr);
24272         return tag_ptr(ret_conv, true);
24273 }
24274
24275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZNoneZ_1err(JNIEnv *env, jclass clz) {
24276         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
24277         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_err();
24278         return tag_ptr(ret_conv, true);
24279 }
24280
24281 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24282         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* o_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(o);
24283         jboolean ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_is_ok(o_conv);
24284         return ret_conv;
24285 }
24286
24287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24288         if (!ptr_is_owned(_res)) return;
24289         void* _res_ptr = untag_ptr(_res);
24290         CHECK_ACCESS(_res_ptr);
24291         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)(_res_ptr);
24292         FREE(untag_ptr(_res));
24293         CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_free(_res_conv);
24294 }
24295
24296 static inline uint64_t CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone_ptr(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ *NONNULL_PTR arg) {
24297         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
24298         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone(arg);
24299         return tag_ptr(ret_conv, true);
24300 }
24301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24302         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* arg_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(arg);
24303         int64_t ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone_ptr(arg_conv);
24304         return ret_conv;
24305 }
24306
24307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24308         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* orig_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(orig);
24309         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
24310         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone(orig_conv);
24311         return tag_ptr(ret_conv, true);
24312 }
24313
24314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
24315         LDKCVec_PublicKeyZ _res_constr;
24316         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24317         if (_res_constr.datalen > 0)
24318                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
24319         else
24320                 _res_constr.data = NULL;
24321         for (size_t i = 0; i < _res_constr.datalen; i++) {
24322                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
24323                 LDKPublicKey _res_conv_8_ref;
24324                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 33);
24325                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 33, _res_conv_8_ref.compressed_form);
24326                 _res_constr.data[i] = _res_conv_8_ref;
24327         }
24328         CVec_PublicKeyZ_free(_res_constr);
24329 }
24330
24331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24332         LDKOnionMessagePath o_conv;
24333         o_conv.inner = untag_ptr(o);
24334         o_conv.is_owned = ptr_is_owned(o);
24335         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24336         o_conv = OnionMessagePath_clone(&o_conv);
24337         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
24338         *ret_conv = CResult_OnionMessagePathNoneZ_ok(o_conv);
24339         return tag_ptr(ret_conv, true);
24340 }
24341
24342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1err(JNIEnv *env, jclass clz) {
24343         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
24344         *ret_conv = CResult_OnionMessagePathNoneZ_err();
24345         return tag_ptr(ret_conv, true);
24346 }
24347
24348 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24349         LDKCResult_OnionMessagePathNoneZ* o_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(o);
24350         jboolean ret_conv = CResult_OnionMessagePathNoneZ_is_ok(o_conv);
24351         return ret_conv;
24352 }
24353
24354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24355         if (!ptr_is_owned(_res)) return;
24356         void* _res_ptr = untag_ptr(_res);
24357         CHECK_ACCESS(_res_ptr);
24358         LDKCResult_OnionMessagePathNoneZ _res_conv = *(LDKCResult_OnionMessagePathNoneZ*)(_res_ptr);
24359         FREE(untag_ptr(_res));
24360         CResult_OnionMessagePathNoneZ_free(_res_conv);
24361 }
24362
24363 static inline uint64_t CResult_OnionMessagePathNoneZ_clone_ptr(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR arg) {
24364         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
24365         *ret_conv = CResult_OnionMessagePathNoneZ_clone(arg);
24366         return tag_ptr(ret_conv, true);
24367 }
24368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24369         LDKCResult_OnionMessagePathNoneZ* arg_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(arg);
24370         int64_t ret_conv = CResult_OnionMessagePathNoneZ_clone_ptr(arg_conv);
24371         return ret_conv;
24372 }
24373
24374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24375         LDKCResult_OnionMessagePathNoneZ* orig_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(orig);
24376         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
24377         *ret_conv = CResult_OnionMessagePathNoneZ_clone(orig_conv);
24378         return tag_ptr(ret_conv, true);
24379 }
24380
24381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1BlindedPathZNoneZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
24382         LDKCVec_BlindedPathZ o_constr;
24383         o_constr.datalen = (*env)->GetArrayLength(env, o);
24384         if (o_constr.datalen > 0)
24385                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKBlindedPath), "LDKCVec_BlindedPathZ Elements");
24386         else
24387                 o_constr.data = NULL;
24388         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
24389         for (size_t n = 0; n < o_constr.datalen; n++) {
24390                 int64_t o_conv_13 = o_vals[n];
24391                 LDKBlindedPath o_conv_13_conv;
24392                 o_conv_13_conv.inner = untag_ptr(o_conv_13);
24393                 o_conv_13_conv.is_owned = ptr_is_owned(o_conv_13);
24394                 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv_13_conv);
24395                 o_conv_13_conv = BlindedPath_clone(&o_conv_13_conv);
24396                 o_constr.data[n] = o_conv_13_conv;
24397         }
24398         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
24399         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
24400         *ret_conv = CResult_CVec_BlindedPathZNoneZ_ok(o_constr);
24401         return tag_ptr(ret_conv, true);
24402 }
24403
24404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1BlindedPathZNoneZ_1err(JNIEnv *env, jclass clz) {
24405         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
24406         *ret_conv = CResult_CVec_BlindedPathZNoneZ_err();
24407         return tag_ptr(ret_conv, true);
24408 }
24409
24410 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1BlindedPathZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24411         LDKCResult_CVec_BlindedPathZNoneZ* o_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(o);
24412         jboolean ret_conv = CResult_CVec_BlindedPathZNoneZ_is_ok(o_conv);
24413         return ret_conv;
24414 }
24415
24416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1BlindedPathZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24417         if (!ptr_is_owned(_res)) return;
24418         void* _res_ptr = untag_ptr(_res);
24419         CHECK_ACCESS(_res_ptr);
24420         LDKCResult_CVec_BlindedPathZNoneZ _res_conv = *(LDKCResult_CVec_BlindedPathZNoneZ*)(_res_ptr);
24421         FREE(untag_ptr(_res));
24422         CResult_CVec_BlindedPathZNoneZ_free(_res_conv);
24423 }
24424
24425 static inline uint64_t CResult_CVec_BlindedPathZNoneZ_clone_ptr(LDKCResult_CVec_BlindedPathZNoneZ *NONNULL_PTR arg) {
24426         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
24427         *ret_conv = CResult_CVec_BlindedPathZNoneZ_clone(arg);
24428         return tag_ptr(ret_conv, true);
24429 }
24430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1BlindedPathZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24431         LDKCResult_CVec_BlindedPathZNoneZ* arg_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(arg);
24432         int64_t ret_conv = CResult_CVec_BlindedPathZNoneZ_clone_ptr(arg_conv);
24433         return ret_conv;
24434 }
24435
24436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1BlindedPathZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24437         LDKCResult_CVec_BlindedPathZNoneZ* orig_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(orig);
24438         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
24439         *ret_conv = CResult_CVec_BlindedPathZNoneZ_clone(orig_conv);
24440         return tag_ptr(ret_conv, true);
24441 }
24442
24443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24444         LDKInFlightHtlcs o_conv;
24445         o_conv.inner = untag_ptr(o);
24446         o_conv.is_owned = ptr_is_owned(o);
24447         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24448         o_conv = InFlightHtlcs_clone(&o_conv);
24449         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
24450         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_ok(o_conv);
24451         return tag_ptr(ret_conv, true);
24452 }
24453
24454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24455         void* e_ptr = untag_ptr(e);
24456         CHECK_ACCESS(e_ptr);
24457         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24458         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24459         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
24460         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_err(e_conv);
24461         return tag_ptr(ret_conv, true);
24462 }
24463
24464 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24465         LDKCResult_InFlightHtlcsDecodeErrorZ* o_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(o);
24466         jboolean ret_conv = CResult_InFlightHtlcsDecodeErrorZ_is_ok(o_conv);
24467         return ret_conv;
24468 }
24469
24470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24471         if (!ptr_is_owned(_res)) return;
24472         void* _res_ptr = untag_ptr(_res);
24473         CHECK_ACCESS(_res_ptr);
24474         LDKCResult_InFlightHtlcsDecodeErrorZ _res_conv = *(LDKCResult_InFlightHtlcsDecodeErrorZ*)(_res_ptr);
24475         FREE(untag_ptr(_res));
24476         CResult_InFlightHtlcsDecodeErrorZ_free(_res_conv);
24477 }
24478
24479 static inline uint64_t CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR arg) {
24480         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
24481         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(arg);
24482         return tag_ptr(ret_conv, true);
24483 }
24484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24485         LDKCResult_InFlightHtlcsDecodeErrorZ* arg_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(arg);
24486         int64_t ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(arg_conv);
24487         return ret_conv;
24488 }
24489
24490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24491         LDKCResult_InFlightHtlcsDecodeErrorZ* orig_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(orig);
24492         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
24493         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(orig_conv);
24494         return tag_ptr(ret_conv, true);
24495 }
24496
24497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24498         LDKRouteHop o_conv;
24499         o_conv.inner = untag_ptr(o);
24500         o_conv.is_owned = ptr_is_owned(o);
24501         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24502         o_conv = RouteHop_clone(&o_conv);
24503         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
24504         *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
24505         return tag_ptr(ret_conv, true);
24506 }
24507
24508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24509         void* e_ptr = untag_ptr(e);
24510         CHECK_ACCESS(e_ptr);
24511         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24512         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24513         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
24514         *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
24515         return tag_ptr(ret_conv, true);
24516 }
24517
24518 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24519         LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(o);
24520         jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
24521         return ret_conv;
24522 }
24523
24524 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24525         if (!ptr_is_owned(_res)) return;
24526         void* _res_ptr = untag_ptr(_res);
24527         CHECK_ACCESS(_res_ptr);
24528         LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
24529         FREE(untag_ptr(_res));
24530         CResult_RouteHopDecodeErrorZ_free(_res_conv);
24531 }
24532
24533 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
24534         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
24535         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
24536         return tag_ptr(ret_conv, true);
24537 }
24538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24539         LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(arg);
24540         int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
24541         return ret_conv;
24542 }
24543
24544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24545         LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(orig);
24546         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
24547         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
24548         return tag_ptr(ret_conv, true);
24549 }
24550
24551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BlindedHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24552         LDKCVec_BlindedHopZ _res_constr;
24553         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24554         if (_res_constr.datalen > 0)
24555                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
24556         else
24557                 _res_constr.data = NULL;
24558         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24559         for (size_t m = 0; m < _res_constr.datalen; m++) {
24560                 int64_t _res_conv_12 = _res_vals[m];
24561                 LDKBlindedHop _res_conv_12_conv;
24562                 _res_conv_12_conv.inner = untag_ptr(_res_conv_12);
24563                 _res_conv_12_conv.is_owned = ptr_is_owned(_res_conv_12);
24564                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv);
24565                 _res_constr.data[m] = _res_conv_12_conv;
24566         }
24567         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24568         CVec_BlindedHopZ_free(_res_constr);
24569 }
24570
24571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24572         LDKBlindedTail o_conv;
24573         o_conv.inner = untag_ptr(o);
24574         o_conv.is_owned = ptr_is_owned(o);
24575         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24576         o_conv = BlindedTail_clone(&o_conv);
24577         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
24578         *ret_conv = CResult_BlindedTailDecodeErrorZ_ok(o_conv);
24579         return tag_ptr(ret_conv, true);
24580 }
24581
24582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24583         void* e_ptr = untag_ptr(e);
24584         CHECK_ACCESS(e_ptr);
24585         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24586         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24587         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
24588         *ret_conv = CResult_BlindedTailDecodeErrorZ_err(e_conv);
24589         return tag_ptr(ret_conv, true);
24590 }
24591
24592 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24593         LDKCResult_BlindedTailDecodeErrorZ* o_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(o);
24594         jboolean ret_conv = CResult_BlindedTailDecodeErrorZ_is_ok(o_conv);
24595         return ret_conv;
24596 }
24597
24598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24599         if (!ptr_is_owned(_res)) return;
24600         void* _res_ptr = untag_ptr(_res);
24601         CHECK_ACCESS(_res_ptr);
24602         LDKCResult_BlindedTailDecodeErrorZ _res_conv = *(LDKCResult_BlindedTailDecodeErrorZ*)(_res_ptr);
24603         FREE(untag_ptr(_res));
24604         CResult_BlindedTailDecodeErrorZ_free(_res_conv);
24605 }
24606
24607 static inline uint64_t CResult_BlindedTailDecodeErrorZ_clone_ptr(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR arg) {
24608         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
24609         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(arg);
24610         return tag_ptr(ret_conv, true);
24611 }
24612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24613         LDKCResult_BlindedTailDecodeErrorZ* arg_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(arg);
24614         int64_t ret_conv = CResult_BlindedTailDecodeErrorZ_clone_ptr(arg_conv);
24615         return ret_conv;
24616 }
24617
24618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24619         LDKCResult_BlindedTailDecodeErrorZ* orig_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(orig);
24620         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
24621         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(orig_conv);
24622         return tag_ptr(ret_conv, true);
24623 }
24624
24625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24626         LDKCVec_RouteHopZ _res_constr;
24627         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24628         if (_res_constr.datalen > 0)
24629                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
24630         else
24631                 _res_constr.data = NULL;
24632         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24633         for (size_t k = 0; k < _res_constr.datalen; k++) {
24634                 int64_t _res_conv_10 = _res_vals[k];
24635                 LDKRouteHop _res_conv_10_conv;
24636                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
24637                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
24638                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
24639                 _res_constr.data[k] = _res_conv_10_conv;
24640         }
24641         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24642         CVec_RouteHopZ_free(_res_constr);
24643 }
24644
24645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PathZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24646         LDKCVec_PathZ _res_constr;
24647         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24648         if (_res_constr.datalen > 0)
24649                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
24650         else
24651                 _res_constr.data = NULL;
24652         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24653         for (size_t g = 0; g < _res_constr.datalen; g++) {
24654                 int64_t _res_conv_6 = _res_vals[g];
24655                 LDKPath _res_conv_6_conv;
24656                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
24657                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
24658                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
24659                 _res_constr.data[g] = _res_conv_6_conv;
24660         }
24661         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24662         CVec_PathZ_free(_res_constr);
24663 }
24664
24665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24666         LDKRoute o_conv;
24667         o_conv.inner = untag_ptr(o);
24668         o_conv.is_owned = ptr_is_owned(o);
24669         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24670         o_conv = Route_clone(&o_conv);
24671         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
24672         *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
24673         return tag_ptr(ret_conv, true);
24674 }
24675
24676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24677         void* e_ptr = untag_ptr(e);
24678         CHECK_ACCESS(e_ptr);
24679         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24680         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24681         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
24682         *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
24683         return tag_ptr(ret_conv, true);
24684 }
24685
24686 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24687         LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(o);
24688         jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
24689         return ret_conv;
24690 }
24691
24692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_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         LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
24697         FREE(untag_ptr(_res));
24698         CResult_RouteDecodeErrorZ_free(_res_conv);
24699 }
24700
24701 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
24702         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
24703         *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
24704         return tag_ptr(ret_conv, true);
24705 }
24706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24707         LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(arg);
24708         int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
24709         return ret_conv;
24710 }
24711
24712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24713         LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(orig);
24714         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
24715         *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
24716         return tag_ptr(ret_conv, true);
24717 }
24718
24719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24720         LDKRouteParameters o_conv;
24721         o_conv.inner = untag_ptr(o);
24722         o_conv.is_owned = ptr_is_owned(o);
24723         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24724         o_conv = RouteParameters_clone(&o_conv);
24725         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
24726         *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
24727         return tag_ptr(ret_conv, true);
24728 }
24729
24730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24731         void* e_ptr = untag_ptr(e);
24732         CHECK_ACCESS(e_ptr);
24733         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24734         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24735         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
24736         *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
24737         return tag_ptr(ret_conv, true);
24738 }
24739
24740 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24741         LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(o);
24742         jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
24743         return ret_conv;
24744 }
24745
24746 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24747         if (!ptr_is_owned(_res)) return;
24748         void* _res_ptr = untag_ptr(_res);
24749         CHECK_ACCESS(_res_ptr);
24750         LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
24751         FREE(untag_ptr(_res));
24752         CResult_RouteParametersDecodeErrorZ_free(_res_conv);
24753 }
24754
24755 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
24756         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
24757         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
24758         return tag_ptr(ret_conv, true);
24759 }
24760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24761         LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(arg);
24762         int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
24763         return ret_conv;
24764 }
24765
24766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24767         LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(orig);
24768         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
24769         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
24770         return tag_ptr(ret_conv, true);
24771 }
24772
24773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24774         LDKCVec_u64Z _res_constr;
24775         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24776         if (_res_constr.datalen > 0)
24777                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
24778         else
24779                 _res_constr.data = NULL;
24780         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24781         for (size_t g = 0; g < _res_constr.datalen; g++) {
24782                 int64_t _res_conv_6 = _res_vals[g];
24783                 _res_constr.data[g] = _res_conv_6;
24784         }
24785         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24786         CVec_u64Z_free(_res_constr);
24787 }
24788
24789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24790         LDKPaymentParameters o_conv;
24791         o_conv.inner = untag_ptr(o);
24792         o_conv.is_owned = ptr_is_owned(o);
24793         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24794         o_conv = PaymentParameters_clone(&o_conv);
24795         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
24796         *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
24797         return tag_ptr(ret_conv, true);
24798 }
24799
24800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24801         void* e_ptr = untag_ptr(e);
24802         CHECK_ACCESS(e_ptr);
24803         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24804         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24805         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
24806         *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
24807         return tag_ptr(ret_conv, true);
24808 }
24809
24810 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24811         LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(o);
24812         jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
24813         return ret_conv;
24814 }
24815
24816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24817         if (!ptr_is_owned(_res)) return;
24818         void* _res_ptr = untag_ptr(_res);
24819         CHECK_ACCESS(_res_ptr);
24820         LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
24821         FREE(untag_ptr(_res));
24822         CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
24823 }
24824
24825 static inline uint64_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
24826         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
24827         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
24828         return tag_ptr(ret_conv, true);
24829 }
24830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24831         LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(arg);
24832         int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
24833         return ret_conv;
24834 }
24835
24836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24837         LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(orig);
24838         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
24839         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
24840         return tag_ptr(ret_conv, true);
24841 }
24842
24843 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24844         LDKCVec_RouteHintZ _res_constr;
24845         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24846         if (_res_constr.datalen > 0)
24847                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
24848         else
24849                 _res_constr.data = NULL;
24850         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24851         for (size_t l = 0; l < _res_constr.datalen; l++) {
24852                 int64_t _res_conv_11 = _res_vals[l];
24853                 LDKRouteHint _res_conv_11_conv;
24854                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
24855                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
24856                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
24857                 _res_constr.data[l] = _res_conv_11_conv;
24858         }
24859         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24860         CVec_RouteHintZ_free(_res_constr);
24861 }
24862
24863 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24864         LDKCVec_RouteHintHopZ _res_constr;
24865         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24866         if (_res_constr.datalen > 0)
24867                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
24868         else
24869                 _res_constr.data = NULL;
24870         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24871         for (size_t o = 0; o < _res_constr.datalen; o++) {
24872                 int64_t _res_conv_14 = _res_vals[o];
24873                 LDKRouteHintHop _res_conv_14_conv;
24874                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
24875                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
24876                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
24877                 _res_constr.data[o] = _res_conv_14_conv;
24878         }
24879         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24880         CVec_RouteHintHopZ_free(_res_constr);
24881 }
24882
24883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24884         LDKRouteHint o_conv;
24885         o_conv.inner = untag_ptr(o);
24886         o_conv.is_owned = ptr_is_owned(o);
24887         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24888         o_conv = RouteHint_clone(&o_conv);
24889         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
24890         *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
24891         return tag_ptr(ret_conv, true);
24892 }
24893
24894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24895         void* e_ptr = untag_ptr(e);
24896         CHECK_ACCESS(e_ptr);
24897         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24898         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24899         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
24900         *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
24901         return tag_ptr(ret_conv, true);
24902 }
24903
24904 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24905         LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(o);
24906         jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
24907         return ret_conv;
24908 }
24909
24910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24911         if (!ptr_is_owned(_res)) return;
24912         void* _res_ptr = untag_ptr(_res);
24913         CHECK_ACCESS(_res_ptr);
24914         LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
24915         FREE(untag_ptr(_res));
24916         CResult_RouteHintDecodeErrorZ_free(_res_conv);
24917 }
24918
24919 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
24920         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
24921         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
24922         return tag_ptr(ret_conv, true);
24923 }
24924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24925         LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(arg);
24926         int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
24927         return ret_conv;
24928 }
24929
24930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24931         LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(orig);
24932         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
24933         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
24934         return tag_ptr(ret_conv, true);
24935 }
24936
24937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24938         LDKRouteHintHop o_conv;
24939         o_conv.inner = untag_ptr(o);
24940         o_conv.is_owned = ptr_is_owned(o);
24941         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24942         o_conv = RouteHintHop_clone(&o_conv);
24943         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
24944         *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
24945         return tag_ptr(ret_conv, true);
24946 }
24947
24948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24949         void* e_ptr = untag_ptr(e);
24950         CHECK_ACCESS(e_ptr);
24951         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24952         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24953         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
24954         *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
24955         return tag_ptr(ret_conv, true);
24956 }
24957
24958 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24959         LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(o);
24960         jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
24961         return ret_conv;
24962 }
24963
24964 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24965         if (!ptr_is_owned(_res)) return;
24966         void* _res_ptr = untag_ptr(_res);
24967         CHECK_ACCESS(_res_ptr);
24968         LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
24969         FREE(untag_ptr(_res));
24970         CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
24971 }
24972
24973 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
24974         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
24975         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
24976         return tag_ptr(ret_conv, true);
24977 }
24978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24979         LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(arg);
24980         int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
24981         return ret_conv;
24982 }
24983
24984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24985         LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(orig);
24986         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
24987         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
24988         return tag_ptr(ret_conv, true);
24989 }
24990
24991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24992         LDKFixedPenaltyScorer o_conv;
24993         o_conv.inner = untag_ptr(o);
24994         o_conv.is_owned = ptr_is_owned(o);
24995         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24996         o_conv = FixedPenaltyScorer_clone(&o_conv);
24997         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
24998         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
24999         return tag_ptr(ret_conv, true);
25000 }
25001
25002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25003         void* e_ptr = untag_ptr(e);
25004         CHECK_ACCESS(e_ptr);
25005         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25006         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25007         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
25008         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
25009         return tag_ptr(ret_conv, true);
25010 }
25011
25012 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25013         LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(o);
25014         jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
25015         return ret_conv;
25016 }
25017
25018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25019         if (!ptr_is_owned(_res)) return;
25020         void* _res_ptr = untag_ptr(_res);
25021         CHECK_ACCESS(_res_ptr);
25022         LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
25023         FREE(untag_ptr(_res));
25024         CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
25025 }
25026
25027 static inline uint64_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
25028         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
25029         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
25030         return tag_ptr(ret_conv, true);
25031 }
25032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25033         LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(arg);
25034         int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
25035         return ret_conv;
25036 }
25037
25038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25039         LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(orig);
25040         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
25041         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
25042         return tag_ptr(ret_conv, true);
25043 }
25044
25045 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeIdZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25046         LDKCVec_NodeIdZ _res_constr;
25047         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25048         if (_res_constr.datalen > 0)
25049                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
25050         else
25051                 _res_constr.data = NULL;
25052         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25053         for (size_t i = 0; i < _res_constr.datalen; i++) {
25054                 int64_t _res_conv_8 = _res_vals[i];
25055                 LDKNodeId _res_conv_8_conv;
25056                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
25057                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
25058                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
25059                 _res_constr.data[i] = _res_conv_8_conv;
25060         }
25061         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25062         CVec_NodeIdZ_free(_res_constr);
25063 }
25064
25065 static inline uint64_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
25066         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
25067         *ret_conv = C2Tuple_u64u64Z_clone(arg);
25068         return tag_ptr(ret_conv, true);
25069 }
25070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25071         LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(arg);
25072         int64_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
25073         return ret_conv;
25074 }
25075
25076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25077         LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(orig);
25078         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
25079         *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
25080         return tag_ptr(ret_conv, true);
25081 }
25082
25083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25084         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
25085         *ret_conv = C2Tuple_u64u64Z_new(a, b);
25086         return tag_ptr(ret_conv, true);
25087 }
25088
25089 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
25090         if (!ptr_is_owned(_res)) return;
25091         void* _res_ptr = untag_ptr(_res);
25092         CHECK_ACCESS(_res_ptr);
25093         LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
25094         FREE(untag_ptr(_res));
25095         C2Tuple_u64u64Z_free(_res_conv);
25096 }
25097
25098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
25099         void* o_ptr = untag_ptr(o);
25100         CHECK_ACCESS(o_ptr);
25101         LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
25102         o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)untag_ptr(o));
25103         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
25104         *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
25105         int64_t ret_ref = tag_ptr(ret_copy, true);
25106         return ret_ref;
25107 }
25108
25109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1none(JNIEnv *env, jclass clz) {
25110         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
25111         *ret_copy = COption_C2Tuple_u64u64ZZ_none();
25112         int64_t ret_ref = tag_ptr(ret_copy, true);
25113         return ret_ref;
25114 }
25115
25116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25117         if (!ptr_is_owned(_res)) return;
25118         void* _res_ptr = untag_ptr(_res);
25119         CHECK_ACCESS(_res_ptr);
25120         LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
25121         FREE(untag_ptr(_res));
25122         COption_C2Tuple_u64u64ZZ_free(_res_conv);
25123 }
25124
25125 static inline uint64_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
25126         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
25127         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
25128         int64_t ret_ref = tag_ptr(ret_copy, true);
25129         return ret_ref;
25130 }
25131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25132         LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(arg);
25133         int64_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
25134         return ret_conv;
25135 }
25136
25137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25138         LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(orig);
25139         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
25140         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
25141         int64_t ret_ref = tag_ptr(ret_copy, true);
25142         return ret_ref;
25143 }
25144
25145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1new(JNIEnv *env, jclass clz, int16_tArray a, int16_tArray b) {
25146         LDKThirtyTwoU16s a_ref;
25147         CHECK((*env)->GetArrayLength(env, a) == 32);
25148         (*env)->GetShortArrayRegion(env, a, 0, 32, a_ref.data);
25149         LDKThirtyTwoU16s b_ref;
25150         CHECK((*env)->GetArrayLength(env, b) == 32);
25151         (*env)->GetShortArrayRegion(env, b, 0, 32, b_ref.data);
25152         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
25153         *ret_conv = C2Tuple_Z_new(a_ref, b_ref);
25154         return tag_ptr(ret_conv, true);
25155 }
25156
25157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
25158         if (!ptr_is_owned(_res)) return;
25159         void* _res_ptr = untag_ptr(_res);
25160         CHECK_ACCESS(_res_ptr);
25161         LDKC2Tuple_Z _res_conv = *(LDKC2Tuple_Z*)(_res_ptr);
25162         FREE(untag_ptr(_res));
25163         C2Tuple_Z_free(_res_conv);
25164 }
25165
25166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u1632_1u1632Z_1new(JNIEnv *env, jclass clz, int16_tArray a, int16_tArray b) {
25167         LDKThirtyTwoU16s a_ref;
25168         CHECK((*env)->GetArrayLength(env, a) == 32);
25169         (*env)->GetShortArrayRegion(env, a, 0, 32, a_ref.data);
25170         LDKThirtyTwoU16s b_ref;
25171         CHECK((*env)->GetArrayLength(env, b) == 32);
25172         (*env)->GetShortArrayRegion(env, b, 0, 32, b_ref.data);
25173         LDKC2Tuple__u1632_u1632Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u1632_u1632Z), "LDKC2Tuple__u1632_u1632Z");
25174         *ret_conv = C2Tuple__u1632_u1632Z_new(a_ref, b_ref);
25175         return tag_ptr(ret_conv, true);
25176 }
25177
25178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u1632_1u1632Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
25179         if (!ptr_is_owned(_res)) return;
25180         void* _res_ptr = untag_ptr(_res);
25181         CHECK_ACCESS(_res_ptr);
25182         LDKC2Tuple__u1632_u1632Z _res_conv = *(LDKC2Tuple__u1632_u1632Z*)(_res_ptr);
25183         FREE(untag_ptr(_res));
25184         C2Tuple__u1632_u1632Z_free(_res_conv);
25185 }
25186
25187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1ThirtyTwoU16sThirtyTwoU16sZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
25188         void* o_ptr = untag_ptr(o);
25189         CHECK_ACCESS(o_ptr);
25190         LDKC2Tuple__u1632_u1632Z o_conv = *(LDKC2Tuple__u1632_u1632Z*)(o_ptr);
25191         // WARNING: we may need a move here but no clone is available for LDKC2Tuple__u1632_u1632Z
25192         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
25193         *ret_copy = COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(o_conv);
25194         int64_t ret_ref = tag_ptr(ret_copy, true);
25195         return ret_ref;
25196 }
25197
25198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1ThirtyTwoU16sThirtyTwoU16sZZ_1none(JNIEnv *env, jclass clz) {
25199         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
25200         *ret_copy = COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none();
25201         int64_t ret_ref = tag_ptr(ret_copy, true);
25202         return ret_ref;
25203 }
25204
25205 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1ThirtyTwoU16sThirtyTwoU16sZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25206         if (!ptr_is_owned(_res)) return;
25207         void* _res_ptr = untag_ptr(_res);
25208         CHECK_ACCESS(_res_ptr);
25209         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ _res_conv = *(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)(_res_ptr);
25210         FREE(untag_ptr(_res));
25211         COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(_res_conv);
25212 }
25213
25214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1f64Z_1some(JNIEnv *env, jclass clz, double o) {
25215         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
25216         *ret_copy = COption_f64Z_some(o);
25217         int64_t ret_ref = tag_ptr(ret_copy, true);
25218         return ret_ref;
25219 }
25220
25221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1f64Z_1none(JNIEnv *env, jclass clz) {
25222         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
25223         *ret_copy = COption_f64Z_none();
25224         int64_t ret_ref = tag_ptr(ret_copy, true);
25225         return ret_ref;
25226 }
25227
25228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1f64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
25229         if (!ptr_is_owned(_res)) return;
25230         void* _res_ptr = untag_ptr(_res);
25231         CHECK_ACCESS(_res_ptr);
25232         LDKCOption_f64Z _res_conv = *(LDKCOption_f64Z*)(_res_ptr);
25233         FREE(untag_ptr(_res));
25234         COption_f64Z_free(_res_conv);
25235 }
25236
25237 static inline uint64_t COption_f64Z_clone_ptr(LDKCOption_f64Z *NONNULL_PTR arg) {
25238         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
25239         *ret_copy = COption_f64Z_clone(arg);
25240         int64_t ret_ref = tag_ptr(ret_copy, true);
25241         return ret_ref;
25242 }
25243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1f64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25244         LDKCOption_f64Z* arg_conv = (LDKCOption_f64Z*)untag_ptr(arg);
25245         int64_t ret_conv = COption_f64Z_clone_ptr(arg_conv);
25246         return ret_conv;
25247 }
25248
25249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1f64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25250         LDKCOption_f64Z* orig_conv = (LDKCOption_f64Z*)untag_ptr(orig);
25251         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
25252         *ret_copy = COption_f64Z_clone(orig_conv);
25253         int64_t ret_ref = tag_ptr(ret_copy, true);
25254         return ret_ref;
25255 }
25256
25257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25258         LDKProbabilisticScorer o_conv;
25259         o_conv.inner = untag_ptr(o);
25260         o_conv.is_owned = ptr_is_owned(o);
25261         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25262         // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
25263         
25264         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
25265         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
25266         return tag_ptr(ret_conv, true);
25267 }
25268
25269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25270         void* e_ptr = untag_ptr(e);
25271         CHECK_ACCESS(e_ptr);
25272         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25273         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25274         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
25275         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
25276         return tag_ptr(ret_conv, true);
25277 }
25278
25279 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25280         LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(o);
25281         jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
25282         return ret_conv;
25283 }
25284
25285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25286         if (!ptr_is_owned(_res)) return;
25287         void* _res_ptr = untag_ptr(_res);
25288         CHECK_ACCESS(_res_ptr);
25289         LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
25290         FREE(untag_ptr(_res));
25291         CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
25292 }
25293
25294 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
25295         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
25296         *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
25297         return tag_ptr(ret_conv, true);
25298 }
25299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25300         LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(arg);
25301         int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
25302         return ret_conv;
25303 }
25304
25305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25306         LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(orig);
25307         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
25308         *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
25309         return tag_ptr(ret_conv, true);
25310 }
25311
25312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
25313         LDKTransaction b_ref;
25314         b_ref.datalen = (*env)->GetArrayLength(env, b);
25315         b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
25316         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
25317         b_ref.data_is_owned = true;
25318         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
25319         *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
25320         return tag_ptr(ret_conv, true);
25321 }
25322
25323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25324         if (!ptr_is_owned(_res)) return;
25325         void* _res_ptr = untag_ptr(_res);
25326         CHECK_ACCESS(_res_ptr);
25327         LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
25328         FREE(untag_ptr(_res));
25329         C2Tuple_usizeTransactionZ_free(_res_conv);
25330 }
25331
25332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25333         LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
25334         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25335         if (_res_constr.datalen > 0)
25336                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
25337         else
25338                 _res_constr.data = NULL;
25339         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25340         for (size_t c = 0; c < _res_constr.datalen; c++) {
25341                 int64_t _res_conv_28 = _res_vals[c];
25342                 void* _res_conv_28_ptr = untag_ptr(_res_conv_28);
25343                 CHECK_ACCESS(_res_conv_28_ptr);
25344                 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
25345                 FREE(untag_ptr(_res_conv_28));
25346                 _res_constr.data[c] = _res_conv_28_conv;
25347         }
25348         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25349         CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
25350 }
25351
25352 static inline uint64_t C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone_ptr(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR arg) {
25353         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
25354         *ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(arg);
25355         return tag_ptr(ret_conv, true);
25356 }
25357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesu32COption_1ThirtyTwoBytesZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25358         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* arg_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(arg);
25359         int64_t ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone_ptr(arg_conv);
25360         return ret_conv;
25361 }
25362
25363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesu32COption_1ThirtyTwoBytesZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25364         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* orig_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(orig);
25365         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
25366         *ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(orig_conv);
25367         return tag_ptr(ret_conv, true);
25368 }
25369
25370 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) {
25371         LDKThirtyTwoBytes a_ref;
25372         CHECK((*env)->GetArrayLength(env, a) == 32);
25373         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
25374         void* c_ptr = untag_ptr(c);
25375         CHECK_ACCESS(c_ptr);
25376         LDKCOption_ThirtyTwoBytesZ c_conv = *(LDKCOption_ThirtyTwoBytesZ*)(c_ptr);
25377         c_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(c));
25378         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
25379         *ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_new(a_ref, b, c_conv);
25380         return tag_ptr(ret_conv, true);
25381 }
25382
25383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesu32COption_1ThirtyTwoBytesZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25384         if (!ptr_is_owned(_res)) return;
25385         void* _res_ptr = untag_ptr(_res);
25386         CHECK_ACCESS(_res_ptr);
25387         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ _res_conv = *(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)(_res_ptr);
25388         FREE(untag_ptr(_res));
25389         C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_free(_res_conv);
25390 }
25391
25392 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ThirtyTwoBytesu32COption_1ThirtyTwoBytesZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25393         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ _res_constr;
25394         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25395         if (_res_constr.datalen > 0)
25396                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ Elements");
25397         else
25398                 _res_constr.data = NULL;
25399         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25400         for (size_t c = 0; c < _res_constr.datalen; c++) {
25401                 int64_t _res_conv_54 = _res_vals[c];
25402                 void* _res_conv_54_ptr = untag_ptr(_res_conv_54);
25403                 CHECK_ACCESS(_res_conv_54_ptr);
25404                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ _res_conv_54_conv = *(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)(_res_conv_54_ptr);
25405                 FREE(untag_ptr(_res_conv_54));
25406                 _res_constr.data[c] = _res_conv_54_conv;
25407         }
25408         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25409         CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_free(_res_constr);
25410 }
25411
25412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1ok(JNIEnv *env, jclass clz, jclass o) {
25413         LDKChannelMonitorUpdateStatus o_conv = LDKChannelMonitorUpdateStatus_from_java(env, o);
25414         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
25415         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_ok(o_conv);
25416         return tag_ptr(ret_conv, true);
25417 }
25418
25419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1err(JNIEnv *env, jclass clz) {
25420         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
25421         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_err();
25422         return tag_ptr(ret_conv, true);
25423 }
25424
25425 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25426         LDKCResult_ChannelMonitorUpdateStatusNoneZ* o_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(o);
25427         jboolean ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(o_conv);
25428         return ret_conv;
25429 }
25430
25431 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25432         if (!ptr_is_owned(_res)) return;
25433         void* _res_ptr = untag_ptr(_res);
25434         CHECK_ACCESS(_res_ptr);
25435         LDKCResult_ChannelMonitorUpdateStatusNoneZ _res_conv = *(LDKCResult_ChannelMonitorUpdateStatusNoneZ*)(_res_ptr);
25436         FREE(untag_ptr(_res));
25437         CResult_ChannelMonitorUpdateStatusNoneZ_free(_res_conv);
25438 }
25439
25440 static inline uint64_t CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR arg) {
25441         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
25442         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone(arg);
25443         return tag_ptr(ret_conv, true);
25444 }
25445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25446         LDKCResult_ChannelMonitorUpdateStatusNoneZ* arg_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(arg);
25447         int64_t ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(arg_conv);
25448         return ret_conv;
25449 }
25450
25451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25452         LDKCResult_ChannelMonitorUpdateStatusNoneZ* orig_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(orig);
25453         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
25454         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone(orig_conv);
25455         return tag_ptr(ret_conv, true);
25456 }
25457
25458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25459         LDKCVec_MonitorEventZ _res_constr;
25460         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25461         if (_res_constr.datalen > 0)
25462                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
25463         else
25464                 _res_constr.data = NULL;
25465         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25466         for (size_t o = 0; o < _res_constr.datalen; o++) {
25467                 int64_t _res_conv_14 = _res_vals[o];
25468                 void* _res_conv_14_ptr = untag_ptr(_res_conv_14);
25469                 CHECK_ACCESS(_res_conv_14_ptr);
25470                 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
25471                 FREE(untag_ptr(_res_conv_14));
25472                 _res_constr.data[o] = _res_conv_14_conv;
25473         }
25474         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25475         CVec_MonitorEventZ_free(_res_constr);
25476 }
25477
25478 static inline uint64_t C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) {
25479         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
25480         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(arg);
25481         return tag_ptr(ret_conv, true);
25482 }
25483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25484         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(arg);
25485         int64_t ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv);
25486         return ret_conv;
25487 }
25488
25489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25490         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(orig);
25491         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
25492         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig_conv);
25493         return tag_ptr(ret_conv, true);
25494 }
25495
25496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_tArray b, int8_tArray c) {
25497         LDKOutPoint a_conv;
25498         a_conv.inner = untag_ptr(a);
25499         a_conv.is_owned = ptr_is_owned(a);
25500         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25501         a_conv = OutPoint_clone(&a_conv);
25502         LDKCVec_MonitorEventZ b_constr;
25503         b_constr.datalen = (*env)->GetArrayLength(env, b);
25504         if (b_constr.datalen > 0)
25505                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
25506         else
25507                 b_constr.data = NULL;
25508         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
25509         for (size_t o = 0; o < b_constr.datalen; o++) {
25510                 int64_t b_conv_14 = b_vals[o];
25511                 void* b_conv_14_ptr = untag_ptr(b_conv_14);
25512                 CHECK_ACCESS(b_conv_14_ptr);
25513                 LDKMonitorEvent b_conv_14_conv = *(LDKMonitorEvent*)(b_conv_14_ptr);
25514                 b_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(b_conv_14));
25515                 b_constr.data[o] = b_conv_14_conv;
25516         }
25517         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
25518         LDKPublicKey c_ref;
25519         CHECK((*env)->GetArrayLength(env, c) == 33);
25520         (*env)->GetByteArrayRegion(env, c, 0, 33, c_ref.compressed_form);
25521         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
25522         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a_conv, b_constr, c_ref);
25523         return tag_ptr(ret_conv, true);
25524 }
25525
25526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25527         if (!ptr_is_owned(_res)) return;
25528         void* _res_ptr = untag_ptr(_res);
25529         CHECK_ACCESS(_res_ptr);
25530         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_ptr);
25531         FREE(untag_ptr(_res));
25532         C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res_conv);
25533 }
25534
25535 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25536         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res_constr;
25537         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25538         if (_res_constr.datalen > 0)
25539                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
25540         else
25541                 _res_constr.data = NULL;
25542         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25543         for (size_t x = 0; x < _res_constr.datalen; x++) {
25544                 int64_t _res_conv_49 = _res_vals[x];
25545                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
25546                 CHECK_ACCESS(_res_conv_49_ptr);
25547                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_conv_49_ptr);
25548                 FREE(untag_ptr(_res_conv_49));
25549                 _res_constr.data[x] = _res_conv_49_conv;
25550         }
25551         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25552         CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res_constr);
25553 }
25554
25555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25556         LDKInitFeatures o_conv;
25557         o_conv.inner = untag_ptr(o);
25558         o_conv.is_owned = ptr_is_owned(o);
25559         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25560         o_conv = InitFeatures_clone(&o_conv);
25561         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
25562         *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
25563         return tag_ptr(ret_conv, true);
25564 }
25565
25566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25567         void* e_ptr = untag_ptr(e);
25568         CHECK_ACCESS(e_ptr);
25569         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25570         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25571         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
25572         *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
25573         return tag_ptr(ret_conv, true);
25574 }
25575
25576 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25577         LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(o);
25578         jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
25579         return ret_conv;
25580 }
25581
25582 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25583         if (!ptr_is_owned(_res)) return;
25584         void* _res_ptr = untag_ptr(_res);
25585         CHECK_ACCESS(_res_ptr);
25586         LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
25587         FREE(untag_ptr(_res));
25588         CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
25589 }
25590
25591 static inline uint64_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
25592         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
25593         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
25594         return tag_ptr(ret_conv, true);
25595 }
25596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25597         LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(arg);
25598         int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
25599         return ret_conv;
25600 }
25601
25602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25603         LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(orig);
25604         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
25605         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
25606         return tag_ptr(ret_conv, true);
25607 }
25608
25609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25610         LDKChannelFeatures o_conv;
25611         o_conv.inner = untag_ptr(o);
25612         o_conv.is_owned = ptr_is_owned(o);
25613         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25614         o_conv = ChannelFeatures_clone(&o_conv);
25615         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
25616         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
25617         return tag_ptr(ret_conv, true);
25618 }
25619
25620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25621         void* e_ptr = untag_ptr(e);
25622         CHECK_ACCESS(e_ptr);
25623         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25624         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25625         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
25626         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
25627         return tag_ptr(ret_conv, true);
25628 }
25629
25630 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25631         LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(o);
25632         jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
25633         return ret_conv;
25634 }
25635
25636 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25637         if (!ptr_is_owned(_res)) return;
25638         void* _res_ptr = untag_ptr(_res);
25639         CHECK_ACCESS(_res_ptr);
25640         LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
25641         FREE(untag_ptr(_res));
25642         CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
25643 }
25644
25645 static inline uint64_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
25646         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
25647         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
25648         return tag_ptr(ret_conv, true);
25649 }
25650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25651         LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(arg);
25652         int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
25653         return ret_conv;
25654 }
25655
25656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25657         LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(orig);
25658         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
25659         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
25660         return tag_ptr(ret_conv, true);
25661 }
25662
25663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25664         LDKNodeFeatures o_conv;
25665         o_conv.inner = untag_ptr(o);
25666         o_conv.is_owned = ptr_is_owned(o);
25667         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25668         o_conv = NodeFeatures_clone(&o_conv);
25669         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
25670         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
25671         return tag_ptr(ret_conv, true);
25672 }
25673
25674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25675         void* e_ptr = untag_ptr(e);
25676         CHECK_ACCESS(e_ptr);
25677         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25678         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25679         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
25680         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
25681         return tag_ptr(ret_conv, true);
25682 }
25683
25684 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25685         LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(o);
25686         jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
25687         return ret_conv;
25688 }
25689
25690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25691         if (!ptr_is_owned(_res)) return;
25692         void* _res_ptr = untag_ptr(_res);
25693         CHECK_ACCESS(_res_ptr);
25694         LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
25695         FREE(untag_ptr(_res));
25696         CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
25697 }
25698
25699 static inline uint64_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
25700         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
25701         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
25702         return tag_ptr(ret_conv, true);
25703 }
25704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25705         LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(arg);
25706         int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
25707         return ret_conv;
25708 }
25709
25710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25711         LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(orig);
25712         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
25713         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
25714         return tag_ptr(ret_conv, true);
25715 }
25716
25717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25718         LDKBolt11InvoiceFeatures o_conv;
25719         o_conv.inner = untag_ptr(o);
25720         o_conv.is_owned = ptr_is_owned(o);
25721         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25722         o_conv = Bolt11InvoiceFeatures_clone(&o_conv);
25723         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
25724         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(o_conv);
25725         return tag_ptr(ret_conv, true);
25726 }
25727
25728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25729         void* e_ptr = untag_ptr(e);
25730         CHECK_ACCESS(e_ptr);
25731         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25732         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25733         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
25734         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(e_conv);
25735         return tag_ptr(ret_conv, true);
25736 }
25737
25738 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25739         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
25740         jboolean ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
25741         return ret_conv;
25742 }
25743
25744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25745         if (!ptr_is_owned(_res)) return;
25746         void* _res_ptr = untag_ptr(_res);
25747         CHECK_ACCESS(_res_ptr);
25748         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
25749         FREE(untag_ptr(_res));
25750         CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(_res_conv);
25751 }
25752
25753 static inline uint64_t CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
25754         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
25755         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(arg);
25756         return tag_ptr(ret_conv, true);
25757 }
25758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25759         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
25760         int64_t ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
25761         return ret_conv;
25762 }
25763
25764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25765         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
25766         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
25767         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
25768         return tag_ptr(ret_conv, true);
25769 }
25770
25771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25772         LDKBolt12InvoiceFeatures o_conv;
25773         o_conv.inner = untag_ptr(o);
25774         o_conv.is_owned = ptr_is_owned(o);
25775         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25776         o_conv = Bolt12InvoiceFeatures_clone(&o_conv);
25777         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
25778         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(o_conv);
25779         return tag_ptr(ret_conv, true);
25780 }
25781
25782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25783         void* e_ptr = untag_ptr(e);
25784         CHECK_ACCESS(e_ptr);
25785         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25786         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25787         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
25788         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(e_conv);
25789         return tag_ptr(ret_conv, true);
25790 }
25791
25792 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25793         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
25794         jboolean ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
25795         return ret_conv;
25796 }
25797
25798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25799         if (!ptr_is_owned(_res)) return;
25800         void* _res_ptr = untag_ptr(_res);
25801         CHECK_ACCESS(_res_ptr);
25802         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
25803         FREE(untag_ptr(_res));
25804         CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(_res_conv);
25805 }
25806
25807 static inline uint64_t CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
25808         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
25809         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(arg);
25810         return tag_ptr(ret_conv, true);
25811 }
25812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25813         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
25814         int64_t ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
25815         return ret_conv;
25816 }
25817
25818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25819         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
25820         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
25821         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
25822         return tag_ptr(ret_conv, true);
25823 }
25824
25825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25826         LDKBlindedHopFeatures o_conv;
25827         o_conv.inner = untag_ptr(o);
25828         o_conv.is_owned = ptr_is_owned(o);
25829         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25830         o_conv = BlindedHopFeatures_clone(&o_conv);
25831         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
25832         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_ok(o_conv);
25833         return tag_ptr(ret_conv, true);
25834 }
25835
25836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25837         void* e_ptr = untag_ptr(e);
25838         CHECK_ACCESS(e_ptr);
25839         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25840         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25841         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
25842         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_err(e_conv);
25843         return tag_ptr(ret_conv, true);
25844 }
25845
25846 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25847         LDKCResult_BlindedHopFeaturesDecodeErrorZ* o_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(o);
25848         jboolean ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o_conv);
25849         return ret_conv;
25850 }
25851
25852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25853         if (!ptr_is_owned(_res)) return;
25854         void* _res_ptr = untag_ptr(_res);
25855         CHECK_ACCESS(_res_ptr);
25856         LDKCResult_BlindedHopFeaturesDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopFeaturesDecodeErrorZ*)(_res_ptr);
25857         FREE(untag_ptr(_res));
25858         CResult_BlindedHopFeaturesDecodeErrorZ_free(_res_conv);
25859 }
25860
25861 static inline uint64_t CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR arg) {
25862         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
25863         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(arg);
25864         return tag_ptr(ret_conv, true);
25865 }
25866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25867         LDKCResult_BlindedHopFeaturesDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(arg);
25868         int64_t ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(arg_conv);
25869         return ret_conv;
25870 }
25871
25872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25873         LDKCResult_BlindedHopFeaturesDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(orig);
25874         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
25875         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig_conv);
25876         return tag_ptr(ret_conv, true);
25877 }
25878
25879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25880         LDKChannelTypeFeatures o_conv;
25881         o_conv.inner = untag_ptr(o);
25882         o_conv.is_owned = ptr_is_owned(o);
25883         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25884         o_conv = ChannelTypeFeatures_clone(&o_conv);
25885         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
25886         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
25887         return tag_ptr(ret_conv, true);
25888 }
25889
25890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25891         void* e_ptr = untag_ptr(e);
25892         CHECK_ACCESS(e_ptr);
25893         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25894         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25895         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
25896         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
25897         return tag_ptr(ret_conv, true);
25898 }
25899
25900 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25901         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(o);
25902         jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
25903         return ret_conv;
25904 }
25905
25906 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25907         if (!ptr_is_owned(_res)) return;
25908         void* _res_ptr = untag_ptr(_res);
25909         CHECK_ACCESS(_res_ptr);
25910         LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
25911         FREE(untag_ptr(_res));
25912         CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
25913 }
25914
25915 static inline uint64_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
25916         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
25917         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
25918         return tag_ptr(ret_conv, true);
25919 }
25920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25921         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(arg);
25922         int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
25923         return ret_conv;
25924 }
25925
25926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25927         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(orig);
25928         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
25929         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
25930         return tag_ptr(ret_conv, true);
25931 }
25932
25933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25934         LDKOffer o_conv;
25935         o_conv.inner = untag_ptr(o);
25936         o_conv.is_owned = ptr_is_owned(o);
25937         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25938         o_conv = Offer_clone(&o_conv);
25939         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
25940         *ret_conv = CResult_OfferBolt12ParseErrorZ_ok(o_conv);
25941         return tag_ptr(ret_conv, true);
25942 }
25943
25944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25945         LDKBolt12ParseError e_conv;
25946         e_conv.inner = untag_ptr(e);
25947         e_conv.is_owned = ptr_is_owned(e);
25948         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
25949         e_conv = Bolt12ParseError_clone(&e_conv);
25950         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
25951         *ret_conv = CResult_OfferBolt12ParseErrorZ_err(e_conv);
25952         return tag_ptr(ret_conv, true);
25953 }
25954
25955 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25956         LDKCResult_OfferBolt12ParseErrorZ* o_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(o);
25957         jboolean ret_conv = CResult_OfferBolt12ParseErrorZ_is_ok(o_conv);
25958         return ret_conv;
25959 }
25960
25961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25962         if (!ptr_is_owned(_res)) return;
25963         void* _res_ptr = untag_ptr(_res);
25964         CHECK_ACCESS(_res_ptr);
25965         LDKCResult_OfferBolt12ParseErrorZ _res_conv = *(LDKCResult_OfferBolt12ParseErrorZ*)(_res_ptr);
25966         FREE(untag_ptr(_res));
25967         CResult_OfferBolt12ParseErrorZ_free(_res_conv);
25968 }
25969
25970 static inline uint64_t CResult_OfferBolt12ParseErrorZ_clone_ptr(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR arg) {
25971         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
25972         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(arg);
25973         return tag_ptr(ret_conv, true);
25974 }
25975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25976         LDKCResult_OfferBolt12ParseErrorZ* arg_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(arg);
25977         int64_t ret_conv = CResult_OfferBolt12ParseErrorZ_clone_ptr(arg_conv);
25978         return ret_conv;
25979 }
25980
25981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25982         LDKCResult_OfferBolt12ParseErrorZ* orig_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(orig);
25983         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
25984         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(orig_conv);
25985         return tag_ptr(ret_conv, true);
25986 }
25987
25988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
25989         LDKPublicKey o_ref;
25990         CHECK((*env)->GetArrayLength(env, o) == 33);
25991         (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
25992         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
25993         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_ok(o_ref);
25994         return tag_ptr(ret_conv, true);
25995 }
25996
25997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
25998         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
25999         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
26000         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_err(e_conv);
26001         return tag_ptr(ret_conv, true);
26002 }
26003
26004 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26005         LDKCResult_PublicKeySecp256k1ErrorZ* o_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(o);
26006         jboolean ret_conv = CResult_PublicKeySecp256k1ErrorZ_is_ok(o_conv);
26007         return ret_conv;
26008 }
26009
26010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26011         if (!ptr_is_owned(_res)) return;
26012         void* _res_ptr = untag_ptr(_res);
26013         CHECK_ACCESS(_res_ptr);
26014         LDKCResult_PublicKeySecp256k1ErrorZ _res_conv = *(LDKCResult_PublicKeySecp256k1ErrorZ*)(_res_ptr);
26015         FREE(untag_ptr(_res));
26016         CResult_PublicKeySecp256k1ErrorZ_free(_res_conv);
26017 }
26018
26019 static inline uint64_t CResult_PublicKeySecp256k1ErrorZ_clone_ptr(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR arg) {
26020         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
26021         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone(arg);
26022         return tag_ptr(ret_conv, true);
26023 }
26024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26025         LDKCResult_PublicKeySecp256k1ErrorZ* arg_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(arg);
26026         int64_t ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone_ptr(arg_conv);
26027         return ret_conv;
26028 }
26029
26030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26031         LDKCResult_PublicKeySecp256k1ErrorZ* orig_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(orig);
26032         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
26033         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone(orig_conv);
26034         return tag_ptr(ret_conv, true);
26035 }
26036
26037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26038         LDKNodeId o_conv;
26039         o_conv.inner = untag_ptr(o);
26040         o_conv.is_owned = ptr_is_owned(o);
26041         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26042         o_conv = NodeId_clone(&o_conv);
26043         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
26044         *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
26045         return tag_ptr(ret_conv, true);
26046 }
26047
26048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26049         void* e_ptr = untag_ptr(e);
26050         CHECK_ACCESS(e_ptr);
26051         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26052         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26053         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
26054         *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
26055         return tag_ptr(ret_conv, true);
26056 }
26057
26058 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26059         LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(o);
26060         jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
26061         return ret_conv;
26062 }
26063
26064 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26065         if (!ptr_is_owned(_res)) return;
26066         void* _res_ptr = untag_ptr(_res);
26067         CHECK_ACCESS(_res_ptr);
26068         LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
26069         FREE(untag_ptr(_res));
26070         CResult_NodeIdDecodeErrorZ_free(_res_conv);
26071 }
26072
26073 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
26074         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
26075         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
26076         return tag_ptr(ret_conv, true);
26077 }
26078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26079         LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(arg);
26080         int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
26081         return ret_conv;
26082 }
26083
26084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26085         LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(orig);
26086         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
26087         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
26088         return tag_ptr(ret_conv, true);
26089 }
26090
26091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1some(JNIEnv *env, jclass clz, int64_t o) {
26092         void* o_ptr = untag_ptr(o);
26093         CHECK_ACCESS(o_ptr);
26094         LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
26095         o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o));
26096         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
26097         *ret_copy = COption_NetworkUpdateZ_some(o_conv);
26098         int64_t ret_ref = tag_ptr(ret_copy, true);
26099         return ret_ref;
26100 }
26101
26102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1none(JNIEnv *env, jclass clz) {
26103         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
26104         *ret_copy = COption_NetworkUpdateZ_none();
26105         int64_t ret_ref = tag_ptr(ret_copy, true);
26106         return ret_ref;
26107 }
26108
26109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26110         if (!ptr_is_owned(_res)) return;
26111         void* _res_ptr = untag_ptr(_res);
26112         CHECK_ACCESS(_res_ptr);
26113         LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
26114         FREE(untag_ptr(_res));
26115         COption_NetworkUpdateZ_free(_res_conv);
26116 }
26117
26118 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
26119         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
26120         *ret_copy = COption_NetworkUpdateZ_clone(arg);
26121         int64_t ret_ref = tag_ptr(ret_copy, true);
26122         return ret_ref;
26123 }
26124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26125         LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg);
26126         int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
26127         return ret_conv;
26128 }
26129
26130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26131         LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig);
26132         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
26133         *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
26134         int64_t ret_ref = tag_ptr(ret_copy, true);
26135         return ret_ref;
26136 }
26137
26138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26139         void* o_ptr = untag_ptr(o);
26140         CHECK_ACCESS(o_ptr);
26141         LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
26142         o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(o));
26143         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
26144         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
26145         return tag_ptr(ret_conv, true);
26146 }
26147
26148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26149         void* e_ptr = untag_ptr(e);
26150         CHECK_ACCESS(e_ptr);
26151         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26152         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26153         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
26154         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
26155         return tag_ptr(ret_conv, true);
26156 }
26157
26158 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26159         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(o);
26160         jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
26161         return ret_conv;
26162 }
26163
26164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26165         if (!ptr_is_owned(_res)) return;
26166         void* _res_ptr = untag_ptr(_res);
26167         CHECK_ACCESS(_res_ptr);
26168         LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
26169         FREE(untag_ptr(_res));
26170         CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
26171 }
26172
26173 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
26174         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
26175         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
26176         return tag_ptr(ret_conv, true);
26177 }
26178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26179         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(arg);
26180         int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
26181         return ret_conv;
26182 }
26183
26184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26185         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(orig);
26186         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
26187         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
26188         return tag_ptr(ret_conv, true);
26189 }
26190
26191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1UtxoLookupZ_1some(JNIEnv *env, jclass clz, int64_t o) {
26192         void* o_ptr = untag_ptr(o);
26193         CHECK_ACCESS(o_ptr);
26194         LDKUtxoLookup o_conv = *(LDKUtxoLookup*)(o_ptr);
26195         if (o_conv.free == LDKUtxoLookup_JCalls_free) {
26196                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26197                 LDKUtxoLookup_JCalls_cloned(&o_conv);
26198         }
26199         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
26200         *ret_copy = COption_UtxoLookupZ_some(o_conv);
26201         int64_t ret_ref = tag_ptr(ret_copy, true);
26202         return ret_ref;
26203 }
26204
26205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1UtxoLookupZ_1none(JNIEnv *env, jclass clz) {
26206         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
26207         *ret_copy = COption_UtxoLookupZ_none();
26208         int64_t ret_ref = tag_ptr(ret_copy, true);
26209         return ret_ref;
26210 }
26211
26212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1UtxoLookupZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26213         if (!ptr_is_owned(_res)) return;
26214         void* _res_ptr = untag_ptr(_res);
26215         CHECK_ACCESS(_res_ptr);
26216         LDKCOption_UtxoLookupZ _res_conv = *(LDKCOption_UtxoLookupZ*)(_res_ptr);
26217         FREE(untag_ptr(_res));
26218         COption_UtxoLookupZ_free(_res_conv);
26219 }
26220
26221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
26222         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
26223         *ret_conv = CResult_NoneLightningErrorZ_ok();
26224         return tag_ptr(ret_conv, true);
26225 }
26226
26227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26228         LDKLightningError e_conv;
26229         e_conv.inner = untag_ptr(e);
26230         e_conv.is_owned = ptr_is_owned(e);
26231         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
26232         e_conv = LightningError_clone(&e_conv);
26233         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
26234         *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
26235         return tag_ptr(ret_conv, true);
26236 }
26237
26238 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26239         LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(o);
26240         jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
26241         return ret_conv;
26242 }
26243
26244 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26245         if (!ptr_is_owned(_res)) return;
26246         void* _res_ptr = untag_ptr(_res);
26247         CHECK_ACCESS(_res_ptr);
26248         LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
26249         FREE(untag_ptr(_res));
26250         CResult_NoneLightningErrorZ_free(_res_conv);
26251 }
26252
26253 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
26254         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
26255         *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
26256         return tag_ptr(ret_conv, true);
26257 }
26258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26259         LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(arg);
26260         int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
26261         return ret_conv;
26262 }
26263
26264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26265         LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(orig);
26266         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
26267         *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
26268         return tag_ptr(ret_conv, true);
26269 }
26270
26271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
26272         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
26273         *ret_conv = CResult_boolLightningErrorZ_ok(o);
26274         return tag_ptr(ret_conv, true);
26275 }
26276
26277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26278         LDKLightningError e_conv;
26279         e_conv.inner = untag_ptr(e);
26280         e_conv.is_owned = ptr_is_owned(e);
26281         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
26282         e_conv = LightningError_clone(&e_conv);
26283         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
26284         *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
26285         return tag_ptr(ret_conv, true);
26286 }
26287
26288 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26289         LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(o);
26290         jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
26291         return ret_conv;
26292 }
26293
26294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26295         if (!ptr_is_owned(_res)) return;
26296         void* _res_ptr = untag_ptr(_res);
26297         CHECK_ACCESS(_res_ptr);
26298         LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
26299         FREE(untag_ptr(_res));
26300         CResult_boolLightningErrorZ_free(_res_conv);
26301 }
26302
26303 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
26304         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
26305         *ret_conv = CResult_boolLightningErrorZ_clone(arg);
26306         return tag_ptr(ret_conv, true);
26307 }
26308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26309         LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(arg);
26310         int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
26311         return ret_conv;
26312 }
26313
26314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26315         LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(orig);
26316         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
26317         *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
26318         return tag_ptr(ret_conv, true);
26319 }
26320
26321 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
26322         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
26323         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
26324         return tag_ptr(ret_conv, true);
26325 }
26326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26327         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(arg);
26328         int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
26329         return ret_conv;
26330 }
26331
26332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26333         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(orig);
26334         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
26335         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
26336         return tag_ptr(ret_conv, true);
26337 }
26338
26339 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) {
26340         LDKChannelAnnouncement a_conv;
26341         a_conv.inner = untag_ptr(a);
26342         a_conv.is_owned = ptr_is_owned(a);
26343         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26344         a_conv = ChannelAnnouncement_clone(&a_conv);
26345         LDKChannelUpdate b_conv;
26346         b_conv.inner = untag_ptr(b);
26347         b_conv.is_owned = ptr_is_owned(b);
26348         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
26349         b_conv = ChannelUpdate_clone(&b_conv);
26350         LDKChannelUpdate c_conv;
26351         c_conv.inner = untag_ptr(c);
26352         c_conv.is_owned = ptr_is_owned(c);
26353         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
26354         c_conv = ChannelUpdate_clone(&c_conv);
26355         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
26356         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
26357         return tag_ptr(ret_conv, true);
26358 }
26359
26360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26361         if (!ptr_is_owned(_res)) return;
26362         void* _res_ptr = untag_ptr(_res);
26363         CHECK_ACCESS(_res_ptr);
26364         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
26365         FREE(untag_ptr(_res));
26366         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
26367 }
26368
26369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
26370         void* o_ptr = untag_ptr(o);
26371         CHECK_ACCESS(o_ptr);
26372         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(o_ptr);
26373         o_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(o));
26374         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
26375         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o_conv);
26376         int64_t ret_ref = tag_ptr(ret_copy, true);
26377         return ret_ref;
26378 }
26379
26380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1none(JNIEnv *env, jclass clz) {
26381         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
26382         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none();
26383         int64_t ret_ref = tag_ptr(ret_copy, true);
26384         return ret_ref;
26385 }
26386
26387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26388         if (!ptr_is_owned(_res)) return;
26389         void* _res_ptr = untag_ptr(_res);
26390         CHECK_ACCESS(_res_ptr);
26391         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(_res_ptr);
26392         FREE(untag_ptr(_res));
26393         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_conv);
26394 }
26395
26396 static inline uint64_t COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR arg) {
26397         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
26398         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(arg);
26399         int64_t ret_ref = tag_ptr(ret_copy, true);
26400         return ret_ref;
26401 }
26402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26403         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* arg_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(arg);
26404         int64_t ret_conv = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(arg_conv);
26405         return ret_conv;
26406 }
26407
26408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26409         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* orig_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(orig);
26410         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
26411         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig_conv);
26412         int64_t ret_ref = tag_ptr(ret_copy, true);
26413         return ret_ref;
26414 }
26415
26416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26417         LDKCVec_MessageSendEventZ _res_constr;
26418         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26419         if (_res_constr.datalen > 0)
26420                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
26421         else
26422                 _res_constr.data = NULL;
26423         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26424         for (size_t s = 0; s < _res_constr.datalen; s++) {
26425                 int64_t _res_conv_18 = _res_vals[s];
26426                 void* _res_conv_18_ptr = untag_ptr(_res_conv_18);
26427                 CHECK_ACCESS(_res_conv_18_ptr);
26428                 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
26429                 FREE(untag_ptr(_res_conv_18));
26430                 _res_constr.data[s] = _res_conv_18_conv;
26431         }
26432         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26433         CVec_MessageSendEventZ_free(_res_constr);
26434 }
26435
26436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26437         LDKChannelUpdateInfo o_conv;
26438         o_conv.inner = untag_ptr(o);
26439         o_conv.is_owned = ptr_is_owned(o);
26440         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26441         o_conv = ChannelUpdateInfo_clone(&o_conv);
26442         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
26443         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
26444         return tag_ptr(ret_conv, true);
26445 }
26446
26447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26448         void* e_ptr = untag_ptr(e);
26449         CHECK_ACCESS(e_ptr);
26450         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26451         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26452         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
26453         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
26454         return tag_ptr(ret_conv, true);
26455 }
26456
26457 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26458         LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(o);
26459         jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
26460         return ret_conv;
26461 }
26462
26463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26464         if (!ptr_is_owned(_res)) return;
26465         void* _res_ptr = untag_ptr(_res);
26466         CHECK_ACCESS(_res_ptr);
26467         LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
26468         FREE(untag_ptr(_res));
26469         CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
26470 }
26471
26472 static inline uint64_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
26473         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
26474         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
26475         return tag_ptr(ret_conv, true);
26476 }
26477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26478         LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(arg);
26479         int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
26480         return ret_conv;
26481 }
26482
26483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26484         LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(orig);
26485         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
26486         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
26487         return tag_ptr(ret_conv, true);
26488 }
26489
26490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26491         LDKChannelInfo o_conv;
26492         o_conv.inner = untag_ptr(o);
26493         o_conv.is_owned = ptr_is_owned(o);
26494         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26495         o_conv = ChannelInfo_clone(&o_conv);
26496         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
26497         *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
26498         return tag_ptr(ret_conv, true);
26499 }
26500
26501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26502         void* e_ptr = untag_ptr(e);
26503         CHECK_ACCESS(e_ptr);
26504         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26505         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26506         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
26507         *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
26508         return tag_ptr(ret_conv, true);
26509 }
26510
26511 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26512         LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(o);
26513         jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
26514         return ret_conv;
26515 }
26516
26517 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26518         if (!ptr_is_owned(_res)) return;
26519         void* _res_ptr = untag_ptr(_res);
26520         CHECK_ACCESS(_res_ptr);
26521         LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
26522         FREE(untag_ptr(_res));
26523         CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
26524 }
26525
26526 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
26527         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
26528         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
26529         return tag_ptr(ret_conv, true);
26530 }
26531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26532         LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(arg);
26533         int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
26534         return ret_conv;
26535 }
26536
26537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26538         LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(orig);
26539         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
26540         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
26541         return tag_ptr(ret_conv, true);
26542 }
26543
26544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26545         LDKRoutingFees o_conv;
26546         o_conv.inner = untag_ptr(o);
26547         o_conv.is_owned = ptr_is_owned(o);
26548         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26549         o_conv = RoutingFees_clone(&o_conv);
26550         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
26551         *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
26552         return tag_ptr(ret_conv, true);
26553 }
26554
26555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26556         void* e_ptr = untag_ptr(e);
26557         CHECK_ACCESS(e_ptr);
26558         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26559         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26560         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
26561         *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
26562         return tag_ptr(ret_conv, true);
26563 }
26564
26565 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26566         LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(o);
26567         jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
26568         return ret_conv;
26569 }
26570
26571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26572         if (!ptr_is_owned(_res)) return;
26573         void* _res_ptr = untag_ptr(_res);
26574         CHECK_ACCESS(_res_ptr);
26575         LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
26576         FREE(untag_ptr(_res));
26577         CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
26578 }
26579
26580 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
26581         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
26582         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
26583         return tag_ptr(ret_conv, true);
26584 }
26585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26586         LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(arg);
26587         int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
26588         return ret_conv;
26589 }
26590
26591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26592         LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(orig);
26593         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
26594         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
26595         return tag_ptr(ret_conv, true);
26596 }
26597
26598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SocketAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26599         LDKCVec_SocketAddressZ _res_constr;
26600         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26601         if (_res_constr.datalen > 0)
26602                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
26603         else
26604                 _res_constr.data = NULL;
26605         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26606         for (size_t p = 0; p < _res_constr.datalen; p++) {
26607                 int64_t _res_conv_15 = _res_vals[p];
26608                 void* _res_conv_15_ptr = untag_ptr(_res_conv_15);
26609                 CHECK_ACCESS(_res_conv_15_ptr);
26610                 LDKSocketAddress _res_conv_15_conv = *(LDKSocketAddress*)(_res_conv_15_ptr);
26611                 FREE(untag_ptr(_res_conv_15));
26612                 _res_constr.data[p] = _res_conv_15_conv;
26613         }
26614         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26615         CVec_SocketAddressZ_free(_res_constr);
26616 }
26617
26618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26619         LDKNodeAnnouncementInfo o_conv;
26620         o_conv.inner = untag_ptr(o);
26621         o_conv.is_owned = ptr_is_owned(o);
26622         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26623         o_conv = NodeAnnouncementInfo_clone(&o_conv);
26624         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
26625         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
26626         return tag_ptr(ret_conv, true);
26627 }
26628
26629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26630         void* e_ptr = untag_ptr(e);
26631         CHECK_ACCESS(e_ptr);
26632         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26633         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26634         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
26635         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
26636         return tag_ptr(ret_conv, true);
26637 }
26638
26639 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26640         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(o);
26641         jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
26642         return ret_conv;
26643 }
26644
26645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26646         if (!ptr_is_owned(_res)) return;
26647         void* _res_ptr = untag_ptr(_res);
26648         CHECK_ACCESS(_res_ptr);
26649         LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
26650         FREE(untag_ptr(_res));
26651         CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
26652 }
26653
26654 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
26655         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
26656         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
26657         return tag_ptr(ret_conv, true);
26658 }
26659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26660         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(arg);
26661         int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
26662         return ret_conv;
26663 }
26664
26665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26666         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(orig);
26667         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
26668         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
26669         return tag_ptr(ret_conv, true);
26670 }
26671
26672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26673         LDKNodeAlias o_conv;
26674         o_conv.inner = untag_ptr(o);
26675         o_conv.is_owned = ptr_is_owned(o);
26676         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26677         o_conv = NodeAlias_clone(&o_conv);
26678         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
26679         *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
26680         return tag_ptr(ret_conv, true);
26681 }
26682
26683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26684         void* e_ptr = untag_ptr(e);
26685         CHECK_ACCESS(e_ptr);
26686         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26687         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26688         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
26689         *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
26690         return tag_ptr(ret_conv, true);
26691 }
26692
26693 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26694         LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(o);
26695         jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
26696         return ret_conv;
26697 }
26698
26699 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26700         if (!ptr_is_owned(_res)) return;
26701         void* _res_ptr = untag_ptr(_res);
26702         CHECK_ACCESS(_res_ptr);
26703         LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
26704         FREE(untag_ptr(_res));
26705         CResult_NodeAliasDecodeErrorZ_free(_res_conv);
26706 }
26707
26708 static inline uint64_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
26709         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
26710         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
26711         return tag_ptr(ret_conv, true);
26712 }
26713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26714         LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(arg);
26715         int64_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
26716         return ret_conv;
26717 }
26718
26719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26720         LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(orig);
26721         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
26722         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
26723         return tag_ptr(ret_conv, true);
26724 }
26725
26726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26727         LDKNodeInfo o_conv;
26728         o_conv.inner = untag_ptr(o);
26729         o_conv.is_owned = ptr_is_owned(o);
26730         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26731         o_conv = NodeInfo_clone(&o_conv);
26732         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
26733         *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
26734         return tag_ptr(ret_conv, true);
26735 }
26736
26737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26738         void* e_ptr = untag_ptr(e);
26739         CHECK_ACCESS(e_ptr);
26740         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26741         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26742         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
26743         *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
26744         return tag_ptr(ret_conv, true);
26745 }
26746
26747 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26748         LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(o);
26749         jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
26750         return ret_conv;
26751 }
26752
26753 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26754         if (!ptr_is_owned(_res)) return;
26755         void* _res_ptr = untag_ptr(_res);
26756         CHECK_ACCESS(_res_ptr);
26757         LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
26758         FREE(untag_ptr(_res));
26759         CResult_NodeInfoDecodeErrorZ_free(_res_conv);
26760 }
26761
26762 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
26763         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
26764         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
26765         return tag_ptr(ret_conv, true);
26766 }
26767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26768         LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(arg);
26769         int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
26770         return ret_conv;
26771 }
26772
26773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26774         LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(orig);
26775         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
26776         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
26777         return tag_ptr(ret_conv, true);
26778 }
26779
26780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26781         LDKNetworkGraph o_conv;
26782         o_conv.inner = untag_ptr(o);
26783         o_conv.is_owned = ptr_is_owned(o);
26784         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26785         // WARNING: we need a move here but no clone is available for LDKNetworkGraph
26786         
26787         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
26788         *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
26789         return tag_ptr(ret_conv, true);
26790 }
26791
26792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26793         void* e_ptr = untag_ptr(e);
26794         CHECK_ACCESS(e_ptr);
26795         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26796         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26797         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
26798         *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
26799         return tag_ptr(ret_conv, true);
26800 }
26801
26802 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26803         LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(o);
26804         jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
26805         return ret_conv;
26806 }
26807
26808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26809         if (!ptr_is_owned(_res)) return;
26810         void* _res_ptr = untag_ptr(_res);
26811         CHECK_ACCESS(_res_ptr);
26812         LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
26813         FREE(untag_ptr(_res));
26814         CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
26815 }
26816
26817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZZ_1some(JNIEnv *env, jclass clz, int64_tArray o) {
26818         LDKCVec_SocketAddressZ o_constr;
26819         o_constr.datalen = (*env)->GetArrayLength(env, o);
26820         if (o_constr.datalen > 0)
26821                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
26822         else
26823                 o_constr.data = NULL;
26824         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
26825         for (size_t p = 0; p < o_constr.datalen; p++) {
26826                 int64_t o_conv_15 = o_vals[p];
26827                 void* o_conv_15_ptr = untag_ptr(o_conv_15);
26828                 CHECK_ACCESS(o_conv_15_ptr);
26829                 LDKSocketAddress o_conv_15_conv = *(LDKSocketAddress*)(o_conv_15_ptr);
26830                 o_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o_conv_15));
26831                 o_constr.data[p] = o_conv_15_conv;
26832         }
26833         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
26834         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
26835         *ret_copy = COption_CVec_SocketAddressZZ_some(o_constr);
26836         int64_t ret_ref = tag_ptr(ret_copy, true);
26837         return ret_ref;
26838 }
26839
26840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZZ_1none(JNIEnv *env, jclass clz) {
26841         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
26842         *ret_copy = COption_CVec_SocketAddressZZ_none();
26843         int64_t ret_ref = tag_ptr(ret_copy, true);
26844         return ret_ref;
26845 }
26846
26847 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26848         if (!ptr_is_owned(_res)) return;
26849         void* _res_ptr = untag_ptr(_res);
26850         CHECK_ACCESS(_res_ptr);
26851         LDKCOption_CVec_SocketAddressZZ _res_conv = *(LDKCOption_CVec_SocketAddressZZ*)(_res_ptr);
26852         FREE(untag_ptr(_res));
26853         COption_CVec_SocketAddressZZ_free(_res_conv);
26854 }
26855
26856 static inline uint64_t COption_CVec_SocketAddressZZ_clone_ptr(LDKCOption_CVec_SocketAddressZZ *NONNULL_PTR arg) {
26857         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
26858         *ret_copy = COption_CVec_SocketAddressZZ_clone(arg);
26859         int64_t ret_ref = tag_ptr(ret_copy, true);
26860         return ret_ref;
26861 }
26862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26863         LDKCOption_CVec_SocketAddressZZ* arg_conv = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(arg);
26864         int64_t ret_conv = COption_CVec_SocketAddressZZ_clone_ptr(arg_conv);
26865         return ret_conv;
26866 }
26867
26868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26869         LDKCOption_CVec_SocketAddressZZ* orig_conv = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(orig);
26870         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
26871         *ret_copy = COption_CVec_SocketAddressZZ_clone(orig_conv);
26872         int64_t ret_ref = tag_ptr(ret_copy, true);
26873         return ret_ref;
26874 }
26875
26876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoInboundHTLCErrZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26877         LDKPendingHTLCInfo o_conv;
26878         o_conv.inner = untag_ptr(o);
26879         o_conv.is_owned = ptr_is_owned(o);
26880         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26881         o_conv = PendingHTLCInfo_clone(&o_conv);
26882         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
26883         *ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_ok(o_conv);
26884         return tag_ptr(ret_conv, true);
26885 }
26886
26887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoInboundHTLCErrZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26888         LDKInboundHTLCErr e_conv;
26889         e_conv.inner = untag_ptr(e);
26890         e_conv.is_owned = ptr_is_owned(e);
26891         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
26892         // WARNING: we need a move here but no clone is available for LDKInboundHTLCErr
26893         
26894         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
26895         *ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_err(e_conv);
26896         return tag_ptr(ret_conv, true);
26897 }
26898
26899 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoInboundHTLCErrZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26900         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* o_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(o);
26901         jboolean ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_is_ok(o_conv);
26902         return ret_conv;
26903 }
26904
26905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoInboundHTLCErrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26906         if (!ptr_is_owned(_res)) return;
26907         void* _res_ptr = untag_ptr(_res);
26908         CHECK_ACCESS(_res_ptr);
26909         LDKCResult_PendingHTLCInfoInboundHTLCErrZ _res_conv = *(LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)(_res_ptr);
26910         FREE(untag_ptr(_res));
26911         CResult_PendingHTLCInfoInboundHTLCErrZ_free(_res_conv);
26912 }
26913
26914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCOutputInCommitmentZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26915         LDKCVec_HTLCOutputInCommitmentZ _res_constr;
26916         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26917         if (_res_constr.datalen > 0)
26918                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
26919         else
26920                 _res_constr.data = NULL;
26921         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26922         for (size_t y = 0; y < _res_constr.datalen; y++) {
26923                 int64_t _res_conv_24 = _res_vals[y];
26924                 LDKHTLCOutputInCommitment _res_conv_24_conv;
26925                 _res_conv_24_conv.inner = untag_ptr(_res_conv_24);
26926                 _res_conv_24_conv.is_owned = ptr_is_owned(_res_conv_24);
26927                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_24_conv);
26928                 _res_constr.data[y] = _res_conv_24_conv;
26929         }
26930         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26931         CVec_HTLCOutputInCommitmentZ_free(_res_constr);
26932 }
26933
26934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26935         LDKCVec_HTLCDescriptorZ _res_constr;
26936         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26937         if (_res_constr.datalen > 0)
26938                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
26939         else
26940                 _res_constr.data = NULL;
26941         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26942         for (size_t q = 0; q < _res_constr.datalen; q++) {
26943                 int64_t _res_conv_16 = _res_vals[q];
26944                 LDKHTLCDescriptor _res_conv_16_conv;
26945                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
26946                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
26947                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
26948                 _res_constr.data[q] = _res_conv_16_conv;
26949         }
26950         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26951         CVec_HTLCDescriptorZ_free(_res_constr);
26952 }
26953
26954 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UtxoZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26955         LDKCVec_UtxoZ _res_constr;
26956         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26957         if (_res_constr.datalen > 0)
26958                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
26959         else
26960                 _res_constr.data = NULL;
26961         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26962         for (size_t g = 0; g < _res_constr.datalen; g++) {
26963                 int64_t _res_conv_6 = _res_vals[g];
26964                 LDKUtxo _res_conv_6_conv;
26965                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
26966                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
26967                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
26968                 _res_constr.data[g] = _res_conv_6_conv;
26969         }
26970         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26971         CVec_UtxoZ_free(_res_constr);
26972 }
26973
26974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1some(JNIEnv *env, jclass clz, int64_t o) {
26975         void* o_ptr = untag_ptr(o);
26976         CHECK_ACCESS(o_ptr);
26977         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
26978         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
26979         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
26980         *ret_copy = COption_TxOutZ_some(o_conv);
26981         int64_t ret_ref = tag_ptr(ret_copy, true);
26982         return ret_ref;
26983 }
26984
26985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1none(JNIEnv *env, jclass clz) {
26986         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
26987         *ret_copy = COption_TxOutZ_none();
26988         int64_t ret_ref = tag_ptr(ret_copy, true);
26989         return ret_ref;
26990 }
26991
26992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26993         if (!ptr_is_owned(_res)) return;
26994         void* _res_ptr = untag_ptr(_res);
26995         CHECK_ACCESS(_res_ptr);
26996         LDKCOption_TxOutZ _res_conv = *(LDKCOption_TxOutZ*)(_res_ptr);
26997         FREE(untag_ptr(_res));
26998         COption_TxOutZ_free(_res_conv);
26999 }
27000
27001 static inline uint64_t COption_TxOutZ_clone_ptr(LDKCOption_TxOutZ *NONNULL_PTR arg) {
27002         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
27003         *ret_copy = COption_TxOutZ_clone(arg);
27004         int64_t ret_ref = tag_ptr(ret_copy, true);
27005         return ret_ref;
27006 }
27007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27008         LDKCOption_TxOutZ* arg_conv = (LDKCOption_TxOutZ*)untag_ptr(arg);
27009         int64_t ret_conv = COption_TxOutZ_clone_ptr(arg_conv);
27010         return ret_conv;
27011 }
27012
27013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27014         LDKCOption_TxOutZ* orig_conv = (LDKCOption_TxOutZ*)untag_ptr(orig);
27015         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
27016         *ret_copy = COption_TxOutZ_clone(orig_conv);
27017         int64_t ret_ref = tag_ptr(ret_copy, true);
27018         return ret_ref;
27019 }
27020
27021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1InputZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27022         LDKCVec_InputZ _res_constr;
27023         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27024         if (_res_constr.datalen > 0)
27025                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
27026         else
27027                 _res_constr.data = NULL;
27028         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27029         for (size_t h = 0; h < _res_constr.datalen; h++) {
27030                 int64_t _res_conv_7 = _res_vals[h];
27031                 LDKInput _res_conv_7_conv;
27032                 _res_conv_7_conv.inner = untag_ptr(_res_conv_7);
27033                 _res_conv_7_conv.is_owned = ptr_is_owned(_res_conv_7);
27034                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_7_conv);
27035                 _res_constr.data[h] = _res_conv_7_conv;
27036         }
27037         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27038         CVec_InputZ_free(_res_constr);
27039 }
27040
27041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27042         LDKCoinSelection o_conv;
27043         o_conv.inner = untag_ptr(o);
27044         o_conv.is_owned = ptr_is_owned(o);
27045         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27046         o_conv = CoinSelection_clone(&o_conv);
27047         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
27048         *ret_conv = CResult_CoinSelectionNoneZ_ok(o_conv);
27049         return tag_ptr(ret_conv, true);
27050 }
27051
27052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1err(JNIEnv *env, jclass clz) {
27053         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
27054         *ret_conv = CResult_CoinSelectionNoneZ_err();
27055         return tag_ptr(ret_conv, true);
27056 }
27057
27058 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27059         LDKCResult_CoinSelectionNoneZ* o_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(o);
27060         jboolean ret_conv = CResult_CoinSelectionNoneZ_is_ok(o_conv);
27061         return ret_conv;
27062 }
27063
27064 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27065         if (!ptr_is_owned(_res)) return;
27066         void* _res_ptr = untag_ptr(_res);
27067         CHECK_ACCESS(_res_ptr);
27068         LDKCResult_CoinSelectionNoneZ _res_conv = *(LDKCResult_CoinSelectionNoneZ*)(_res_ptr);
27069         FREE(untag_ptr(_res));
27070         CResult_CoinSelectionNoneZ_free(_res_conv);
27071 }
27072
27073 static inline uint64_t CResult_CoinSelectionNoneZ_clone_ptr(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR arg) {
27074         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
27075         *ret_conv = CResult_CoinSelectionNoneZ_clone(arg);
27076         return tag_ptr(ret_conv, true);
27077 }
27078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27079         LDKCResult_CoinSelectionNoneZ* arg_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(arg);
27080         int64_t ret_conv = CResult_CoinSelectionNoneZ_clone_ptr(arg_conv);
27081         return ret_conv;
27082 }
27083
27084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27085         LDKCResult_CoinSelectionNoneZ* orig_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(orig);
27086         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
27087         *ret_conv = CResult_CoinSelectionNoneZ_clone(orig_conv);
27088         return tag_ptr(ret_conv, true);
27089 }
27090
27091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
27092         LDKCVec_UtxoZ o_constr;
27093         o_constr.datalen = (*env)->GetArrayLength(env, o);
27094         if (o_constr.datalen > 0)
27095                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
27096         else
27097                 o_constr.data = NULL;
27098         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
27099         for (size_t g = 0; g < o_constr.datalen; g++) {
27100                 int64_t o_conv_6 = o_vals[g];
27101                 LDKUtxo o_conv_6_conv;
27102                 o_conv_6_conv.inner = untag_ptr(o_conv_6);
27103                 o_conv_6_conv.is_owned = ptr_is_owned(o_conv_6);
27104                 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv_6_conv);
27105                 o_conv_6_conv = Utxo_clone(&o_conv_6_conv);
27106                 o_constr.data[g] = o_conv_6_conv;
27107         }
27108         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
27109         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
27110         *ret_conv = CResult_CVec_UtxoZNoneZ_ok(o_constr);
27111         return tag_ptr(ret_conv, true);
27112 }
27113
27114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1err(JNIEnv *env, jclass clz) {
27115         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
27116         *ret_conv = CResult_CVec_UtxoZNoneZ_err();
27117         return tag_ptr(ret_conv, true);
27118 }
27119
27120 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27121         LDKCResult_CVec_UtxoZNoneZ* o_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(o);
27122         jboolean ret_conv = CResult_CVec_UtxoZNoneZ_is_ok(o_conv);
27123         return ret_conv;
27124 }
27125
27126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27127         if (!ptr_is_owned(_res)) return;
27128         void* _res_ptr = untag_ptr(_res);
27129         CHECK_ACCESS(_res_ptr);
27130         LDKCResult_CVec_UtxoZNoneZ _res_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(_res_ptr);
27131         FREE(untag_ptr(_res));
27132         CResult_CVec_UtxoZNoneZ_free(_res_conv);
27133 }
27134
27135 static inline uint64_t CResult_CVec_UtxoZNoneZ_clone_ptr(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR arg) {
27136         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
27137         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(arg);
27138         return tag_ptr(ret_conv, true);
27139 }
27140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27141         LDKCResult_CVec_UtxoZNoneZ* arg_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(arg);
27142         int64_t ret_conv = CResult_CVec_UtxoZNoneZ_clone_ptr(arg_conv);
27143         return ret_conv;
27144 }
27145
27146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27147         LDKCResult_CVec_UtxoZNoneZ* orig_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(orig);
27148         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
27149         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(orig_conv);
27150         return tag_ptr(ret_conv, true);
27151 }
27152
27153 static inline uint64_t C2Tuple_u64u16Z_clone_ptr(LDKC2Tuple_u64u16Z *NONNULL_PTR arg) {
27154         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
27155         *ret_conv = C2Tuple_u64u16Z_clone(arg);
27156         return tag_ptr(ret_conv, true);
27157 }
27158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27159         LDKC2Tuple_u64u16Z* arg_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(arg);
27160         int64_t ret_conv = C2Tuple_u64u16Z_clone_ptr(arg_conv);
27161         return ret_conv;
27162 }
27163
27164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27165         LDKC2Tuple_u64u16Z* orig_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(orig);
27166         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
27167         *ret_conv = C2Tuple_u64u16Z_clone(orig_conv);
27168         return tag_ptr(ret_conv, true);
27169 }
27170
27171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1new(JNIEnv *env, jclass clz, int64_t a, int16_t b) {
27172         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
27173         *ret_conv = C2Tuple_u64u16Z_new(a, b);
27174         return tag_ptr(ret_conv, true);
27175 }
27176
27177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
27178         if (!ptr_is_owned(_res)) return;
27179         void* _res_ptr = untag_ptr(_res);
27180         CHECK_ACCESS(_res_ptr);
27181         LDKC2Tuple_u64u16Z _res_conv = *(LDKC2Tuple_u64u16Z*)(_res_ptr);
27182         FREE(untag_ptr(_res));
27183         C2Tuple_u64u16Z_free(_res_conv);
27184 }
27185
27186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u16ZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
27187         void* o_ptr = untag_ptr(o);
27188         CHECK_ACCESS(o_ptr);
27189         LDKC2Tuple_u64u16Z o_conv = *(LDKC2Tuple_u64u16Z*)(o_ptr);
27190         o_conv = C2Tuple_u64u16Z_clone((LDKC2Tuple_u64u16Z*)untag_ptr(o));
27191         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
27192         *ret_copy = COption_C2Tuple_u64u16ZZ_some(o_conv);
27193         int64_t ret_ref = tag_ptr(ret_copy, true);
27194         return ret_ref;
27195 }
27196
27197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u16ZZ_1none(JNIEnv *env, jclass clz) {
27198         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
27199         *ret_copy = COption_C2Tuple_u64u16ZZ_none();
27200         int64_t ret_ref = tag_ptr(ret_copy, true);
27201         return ret_ref;
27202 }
27203
27204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u16ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27205         if (!ptr_is_owned(_res)) return;
27206         void* _res_ptr = untag_ptr(_res);
27207         CHECK_ACCESS(_res_ptr);
27208         LDKCOption_C2Tuple_u64u16ZZ _res_conv = *(LDKCOption_C2Tuple_u64u16ZZ*)(_res_ptr);
27209         FREE(untag_ptr(_res));
27210         COption_C2Tuple_u64u16ZZ_free(_res_conv);
27211 }
27212
27213 static inline uint64_t COption_C2Tuple_u64u16ZZ_clone_ptr(LDKCOption_C2Tuple_u64u16ZZ *NONNULL_PTR arg) {
27214         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
27215         *ret_copy = COption_C2Tuple_u64u16ZZ_clone(arg);
27216         int64_t ret_ref = tag_ptr(ret_copy, true);
27217         return ret_ref;
27218 }
27219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u16ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27220         LDKCOption_C2Tuple_u64u16ZZ* arg_conv = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(arg);
27221         int64_t ret_conv = COption_C2Tuple_u64u16ZZ_clone_ptr(arg_conv);
27222         return ret_conv;
27223 }
27224
27225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u16ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27226         LDKCOption_C2Tuple_u64u16ZZ* orig_conv = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(orig);
27227         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
27228         *ret_copy = COption_C2Tuple_u64u16ZZ_clone(orig_conv);
27229         int64_t ret_ref = tag_ptr(ret_copy, true);
27230         return ret_ref;
27231 }
27232
27233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1some(JNIEnv *env, jclass clz, jclass o) {
27234         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_java(env, o);
27235         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
27236         *ret_copy = COption_ChannelShutdownStateZ_some(o_conv);
27237         int64_t ret_ref = tag_ptr(ret_copy, true);
27238         return ret_ref;
27239 }
27240
27241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1none(JNIEnv *env, jclass clz) {
27242         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
27243         *ret_copy = COption_ChannelShutdownStateZ_none();
27244         int64_t ret_ref = tag_ptr(ret_copy, true);
27245         return ret_ref;
27246 }
27247
27248 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27249         if (!ptr_is_owned(_res)) return;
27250         void* _res_ptr = untag_ptr(_res);
27251         CHECK_ACCESS(_res_ptr);
27252         LDKCOption_ChannelShutdownStateZ _res_conv = *(LDKCOption_ChannelShutdownStateZ*)(_res_ptr);
27253         FREE(untag_ptr(_res));
27254         COption_ChannelShutdownStateZ_free(_res_conv);
27255 }
27256
27257 static inline uint64_t COption_ChannelShutdownStateZ_clone_ptr(LDKCOption_ChannelShutdownStateZ *NONNULL_PTR arg) {
27258         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
27259         *ret_copy = COption_ChannelShutdownStateZ_clone(arg);
27260         int64_t ret_ref = tag_ptr(ret_copy, true);
27261         return ret_ref;
27262 }
27263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27264         LDKCOption_ChannelShutdownStateZ* arg_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(arg);
27265         int64_t ret_conv = COption_ChannelShutdownStateZ_clone_ptr(arg_conv);
27266         return ret_conv;
27267 }
27268
27269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27270         LDKCOption_ChannelShutdownStateZ* orig_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(orig);
27271         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
27272         *ret_copy = COption_ChannelShutdownStateZ_clone(orig_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_CResult_1ThirtyTwoBytesAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
27278         LDKThirtyTwoBytes o_ref;
27279         CHECK((*env)->GetArrayLength(env, o) == 32);
27280         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
27281         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
27282         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_ok(o_ref);
27283         return tag_ptr(ret_conv, true);
27284 }
27285
27286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27287         void* e_ptr = untag_ptr(e);
27288         CHECK_ACCESS(e_ptr);
27289         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
27290         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
27291         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
27292         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_err(e_conv);
27293         return tag_ptr(ret_conv, true);
27294 }
27295
27296 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27297         LDKCResult_ThirtyTwoBytesAPIErrorZ* o_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(o);
27298         jboolean ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_is_ok(o_conv);
27299         return ret_conv;
27300 }
27301
27302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27303         if (!ptr_is_owned(_res)) return;
27304         void* _res_ptr = untag_ptr(_res);
27305         CHECK_ACCESS(_res_ptr);
27306         LDKCResult_ThirtyTwoBytesAPIErrorZ _res_conv = *(LDKCResult_ThirtyTwoBytesAPIErrorZ*)(_res_ptr);
27307         FREE(untag_ptr(_res));
27308         CResult_ThirtyTwoBytesAPIErrorZ_free(_res_conv);
27309 }
27310
27311 static inline uint64_t CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR arg) {
27312         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
27313         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone(arg);
27314         return tag_ptr(ret_conv, true);
27315 }
27316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27317         LDKCResult_ThirtyTwoBytesAPIErrorZ* arg_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(arg);
27318         int64_t ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(arg_conv);
27319         return ret_conv;
27320 }
27321
27322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27323         LDKCResult_ThirtyTwoBytesAPIErrorZ* orig_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(orig);
27324         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
27325         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone(orig_conv);
27326         return tag_ptr(ret_conv, true);
27327 }
27328
27329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RecentPaymentDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27330         LDKCVec_RecentPaymentDetailsZ _res_constr;
27331         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27332         if (_res_constr.datalen > 0)
27333                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRecentPaymentDetails), "LDKCVec_RecentPaymentDetailsZ Elements");
27334         else
27335                 _res_constr.data = NULL;
27336         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27337         for (size_t w = 0; w < _res_constr.datalen; w++) {
27338                 int64_t _res_conv_22 = _res_vals[w];
27339                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
27340                 CHECK_ACCESS(_res_conv_22_ptr);
27341                 LDKRecentPaymentDetails _res_conv_22_conv = *(LDKRecentPaymentDetails*)(_res_conv_22_ptr);
27342                 FREE(untag_ptr(_res_conv_22));
27343                 _res_constr.data[w] = _res_conv_22_conv;
27344         }
27345         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27346         CVec_RecentPaymentDetailsZ_free(_res_constr);
27347 }
27348
27349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
27350         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
27351         *ret_conv = CResult_NonePaymentSendFailureZ_ok();
27352         return tag_ptr(ret_conv, true);
27353 }
27354
27355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27356         void* e_ptr = untag_ptr(e);
27357         CHECK_ACCESS(e_ptr);
27358         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
27359         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
27360         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
27361         *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
27362         return tag_ptr(ret_conv, true);
27363 }
27364
27365 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27366         LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o);
27367         jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
27368         return ret_conv;
27369 }
27370
27371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27372         if (!ptr_is_owned(_res)) return;
27373         void* _res_ptr = untag_ptr(_res);
27374         CHECK_ACCESS(_res_ptr);
27375         LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
27376         FREE(untag_ptr(_res));
27377         CResult_NonePaymentSendFailureZ_free(_res_conv);
27378 }
27379
27380 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
27381         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
27382         *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
27383         return tag_ptr(ret_conv, true);
27384 }
27385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27386         LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg);
27387         int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
27388         return ret_conv;
27389 }
27390
27391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27392         LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig);
27393         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
27394         *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
27395         return tag_ptr(ret_conv, true);
27396 }
27397
27398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1ok(JNIEnv *env, jclass clz) {
27399         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
27400         *ret_conv = CResult_NoneRetryableSendFailureZ_ok();
27401         return tag_ptr(ret_conv, true);
27402 }
27403
27404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1err(JNIEnv *env, jclass clz, jclass e) {
27405         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_java(env, e);
27406         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
27407         *ret_conv = CResult_NoneRetryableSendFailureZ_err(e_conv);
27408         return tag_ptr(ret_conv, true);
27409 }
27410
27411 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27412         LDKCResult_NoneRetryableSendFailureZ* o_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(o);
27413         jboolean ret_conv = CResult_NoneRetryableSendFailureZ_is_ok(o_conv);
27414         return ret_conv;
27415 }
27416
27417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27418         if (!ptr_is_owned(_res)) return;
27419         void* _res_ptr = untag_ptr(_res);
27420         CHECK_ACCESS(_res_ptr);
27421         LDKCResult_NoneRetryableSendFailureZ _res_conv = *(LDKCResult_NoneRetryableSendFailureZ*)(_res_ptr);
27422         FREE(untag_ptr(_res));
27423         CResult_NoneRetryableSendFailureZ_free(_res_conv);
27424 }
27425
27426 static inline uint64_t CResult_NoneRetryableSendFailureZ_clone_ptr(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR arg) {
27427         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
27428         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(arg);
27429         return tag_ptr(ret_conv, true);
27430 }
27431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27432         LDKCResult_NoneRetryableSendFailureZ* arg_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(arg);
27433         int64_t ret_conv = CResult_NoneRetryableSendFailureZ_clone_ptr(arg_conv);
27434         return ret_conv;
27435 }
27436
27437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27438         LDKCResult_NoneRetryableSendFailureZ* orig_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(orig);
27439         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
27440         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(orig_conv);
27441         return tag_ptr(ret_conv, true);
27442 }
27443
27444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
27445         LDKThirtyTwoBytes o_ref;
27446         CHECK((*env)->GetArrayLength(env, o) == 32);
27447         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
27448         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
27449         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(o_ref);
27450         return tag_ptr(ret_conv, true);
27451 }
27452
27453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27454         void* e_ptr = untag_ptr(e);
27455         CHECK_ACCESS(e_ptr);
27456         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
27457         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
27458         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
27459         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_err(e_conv);
27460         return tag_ptr(ret_conv, true);
27461 }
27462
27463 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27464         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* o_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(o);
27465         jboolean ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(o_conv);
27466         return ret_conv;
27467 }
27468
27469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27470         if (!ptr_is_owned(_res)) return;
27471         void* _res_ptr = untag_ptr(_res);
27472         CHECK_ACCESS(_res_ptr);
27473         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ _res_conv = *(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)(_res_ptr);
27474         FREE(untag_ptr(_res));
27475         CResult_ThirtyTwoBytesPaymentSendFailureZ_free(_res_conv);
27476 }
27477
27478 static inline uint64_t CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR arg) {
27479         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
27480         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(arg);
27481         return tag_ptr(ret_conv, true);
27482 }
27483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27484         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* arg_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(arg);
27485         int64_t ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(arg_conv);
27486         return ret_conv;
27487 }
27488
27489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27490         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* orig_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(orig);
27491         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
27492         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(orig_conv);
27493         return tag_ptr(ret_conv, true);
27494 }
27495
27496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
27497         LDKThirtyTwoBytes o_ref;
27498         CHECK((*env)->GetArrayLength(env, o) == 32);
27499         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
27500         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
27501         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(o_ref);
27502         return tag_ptr(ret_conv, true);
27503 }
27504
27505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1err(JNIEnv *env, jclass clz, jclass e) {
27506         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_java(env, e);
27507         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
27508         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_err(e_conv);
27509         return tag_ptr(ret_conv, true);
27510 }
27511
27512 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27513         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* o_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(o);
27514         jboolean ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(o_conv);
27515         return ret_conv;
27516 }
27517
27518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27519         if (!ptr_is_owned(_res)) return;
27520         void* _res_ptr = untag_ptr(_res);
27521         CHECK_ACCESS(_res_ptr);
27522         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ _res_conv = *(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)(_res_ptr);
27523         FREE(untag_ptr(_res));
27524         CResult_ThirtyTwoBytesRetryableSendFailureZ_free(_res_conv);
27525 }
27526
27527 static inline uint64_t CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR arg) {
27528         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
27529         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(arg);
27530         return tag_ptr(ret_conv, true);
27531 }
27532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27533         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* arg_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(arg);
27534         int64_t ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(arg_conv);
27535         return ret_conv;
27536 }
27537
27538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27539         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* orig_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(orig);
27540         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
27541         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(orig_conv);
27542         return tag_ptr(ret_conv, true);
27543 }
27544
27545 static inline uint64_t C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR arg) {
27546         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
27547         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(arg);
27548         return tag_ptr(ret_conv, true);
27549 }
27550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27551         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(arg);
27552         int64_t ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(arg_conv);
27553         return ret_conv;
27554 }
27555
27556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27557         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(orig);
27558         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
27559         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(orig_conv);
27560         return tag_ptr(ret_conv, true);
27561 }
27562
27563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
27564         LDKThirtyTwoBytes a_ref;
27565         CHECK((*env)->GetArrayLength(env, a) == 32);
27566         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
27567         LDKThirtyTwoBytes b_ref;
27568         CHECK((*env)->GetArrayLength(env, b) == 32);
27569         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
27570         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
27571         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(a_ref, b_ref);
27572         return tag_ptr(ret_conv, true);
27573 }
27574
27575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27576         if (!ptr_is_owned(_res)) return;
27577         void* _res_ptr = untag_ptr(_res);
27578         CHECK_ACCESS(_res_ptr);
27579         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(_res_ptr);
27580         FREE(untag_ptr(_res));
27581         C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(_res_conv);
27582 }
27583
27584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27585         void* o_ptr = untag_ptr(o);
27586         CHECK_ACCESS(o_ptr);
27587         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_ptr);
27588         o_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o));
27589         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
27590         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(o_conv);
27591         return tag_ptr(ret_conv, true);
27592 }
27593
27594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27595         void* e_ptr = untag_ptr(e);
27596         CHECK_ACCESS(e_ptr);
27597         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
27598         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
27599         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
27600         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(e_conv);
27601         return tag_ptr(ret_conv, true);
27602 }
27603
27604 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27605         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(o);
27606         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(o_conv);
27607         return ret_conv;
27608 }
27609
27610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27611         if (!ptr_is_owned(_res)) return;
27612         void* _res_ptr = untag_ptr(_res);
27613         CHECK_ACCESS(_res_ptr);
27614         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)(_res_ptr);
27615         FREE(untag_ptr(_res));
27616         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(_res_conv);
27617 }
27618
27619 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR arg) {
27620         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
27621         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(arg);
27622         return tag_ptr(ret_conv, true);
27623 }
27624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27625         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(arg);
27626         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(arg_conv);
27627         return ret_conv;
27628 }
27629
27630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27631         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(orig);
27632         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
27633         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(orig_conv);
27634         return tag_ptr(ret_conv, true);
27635 }
27636
27637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27638         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ _res_constr;
27639         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27640         if (_res_constr.datalen > 0)
27641                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
27642         else
27643                 _res_constr.data = NULL;
27644         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27645         for (size_t o = 0; o < _res_constr.datalen; o++) {
27646                 int64_t _res_conv_40 = _res_vals[o];
27647                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
27648                 CHECK_ACCESS(_res_conv_40_ptr);
27649                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(_res_conv_40_ptr);
27650                 FREE(untag_ptr(_res_conv_40));
27651                 _res_constr.data[o] = _res_conv_40_conv;
27652         }
27653         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27654         CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(_res_constr);
27655 }
27656
27657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
27658         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ o_constr;
27659         o_constr.datalen = (*env)->GetArrayLength(env, o);
27660         if (o_constr.datalen > 0)
27661                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
27662         else
27663                 o_constr.data = NULL;
27664         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
27665         for (size_t o = 0; o < o_constr.datalen; o++) {
27666                 int64_t o_conv_40 = o_vals[o];
27667                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
27668                 CHECK_ACCESS(o_conv_40_ptr);
27669                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_conv_40_ptr);
27670                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o_conv_40));
27671                 o_constr.data[o] = o_conv_40_conv;
27672         }
27673         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
27674         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
27675         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(o_constr);
27676         return tag_ptr(ret_conv, true);
27677 }
27678
27679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27680         void* e_ptr = untag_ptr(e);
27681         CHECK_ACCESS(e_ptr);
27682         LDKProbeSendFailure e_conv = *(LDKProbeSendFailure*)(e_ptr);
27683         e_conv = ProbeSendFailure_clone((LDKProbeSendFailure*)untag_ptr(e));
27684         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
27685         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(e_conv);
27686         return tag_ptr(ret_conv, true);
27687 }
27688
27689 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27690         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(o);
27691         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(o_conv);
27692         return ret_conv;
27693 }
27694
27695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27696         if (!ptr_is_owned(_res)) return;
27697         void* _res_ptr = untag_ptr(_res);
27698         CHECK_ACCESS(_res_ptr);
27699         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)(_res_ptr);
27700         FREE(untag_ptr(_res));
27701         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(_res_conv);
27702 }
27703
27704 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR arg) {
27705         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
27706         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(arg);
27707         return tag_ptr(ret_conv, true);
27708 }
27709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27710         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(arg);
27711         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(arg_conv);
27712         return ret_conv;
27713 }
27714
27715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27716         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(orig);
27717         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
27718         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(orig_conv);
27719         return tag_ptr(ret_conv, true);
27720 }
27721
27722 static inline uint64_t C2Tuple_ThirtyTwoBytesPublicKeyZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *NONNULL_PTR arg) {
27723         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKC2Tuple_ThirtyTwoBytesPublicKeyZ");
27724         *ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(arg);
27725         return tag_ptr(ret_conv, true);
27726 }
27727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesPublicKeyZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27728         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(arg);
27729         int64_t ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone_ptr(arg_conv);
27730         return ret_conv;
27731 }
27732
27733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesPublicKeyZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27734         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(orig);
27735         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKC2Tuple_ThirtyTwoBytesPublicKeyZ");
27736         *ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(orig_conv);
27737         return tag_ptr(ret_conv, true);
27738 }
27739
27740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesPublicKeyZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
27741         LDKThirtyTwoBytes a_ref;
27742         CHECK((*env)->GetArrayLength(env, a) == 32);
27743         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
27744         LDKPublicKey b_ref;
27745         CHECK((*env)->GetArrayLength(env, b) == 33);
27746         (*env)->GetByteArrayRegion(env, b, 0, 33, b_ref.compressed_form);
27747         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKC2Tuple_ThirtyTwoBytesPublicKeyZ");
27748         *ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_new(a_ref, b_ref);
27749         return tag_ptr(ret_conv, true);
27750 }
27751
27752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesPublicKeyZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27753         if (!ptr_is_owned(_res)) return;
27754         void* _res_ptr = untag_ptr(_res);
27755         CHECK_ACCESS(_res_ptr);
27756         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)(_res_ptr);
27757         FREE(untag_ptr(_res));
27758         C2Tuple_ThirtyTwoBytesPublicKeyZ_free(_res_conv);
27759 }
27760
27761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesPublicKeyZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27762         LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ _res_constr;
27763         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27764         if (_res_constr.datalen > 0)
27765                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ Elements");
27766         else
27767                 _res_constr.data = NULL;
27768         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27769         for (size_t j = 0; j < _res_constr.datalen; j++) {
27770                 int64_t _res_conv_35 = _res_vals[j];
27771                 void* _res_conv_35_ptr = untag_ptr(_res_conv_35);
27772                 CHECK_ACCESS(_res_conv_35_ptr);
27773                 LDKC2Tuple_ThirtyTwoBytesPublicKeyZ _res_conv_35_conv = *(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)(_res_conv_35_ptr);
27774                 FREE(untag_ptr(_res_conv_35));
27775                 _res_constr.data[j] = _res_conv_35_conv;
27776         }
27777         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27778         CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_free(_res_constr);
27779 }
27780
27781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1StrZ_1some(JNIEnv *env, jclass clz, jstring o) {
27782         LDKStr o_conv = java_to_owned_str(env, o);
27783         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
27784         *ret_copy = COption_StrZ_some(o_conv);
27785         int64_t ret_ref = tag_ptr(ret_copy, true);
27786         return ret_ref;
27787 }
27788
27789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1StrZ_1none(JNIEnv *env, jclass clz) {
27790         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
27791         *ret_copy = COption_StrZ_none();
27792         int64_t ret_ref = tag_ptr(ret_copy, true);
27793         return ret_ref;
27794 }
27795
27796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1StrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27797         if (!ptr_is_owned(_res)) return;
27798         void* _res_ptr = untag_ptr(_res);
27799         CHECK_ACCESS(_res_ptr);
27800         LDKCOption_StrZ _res_conv = *(LDKCOption_StrZ*)(_res_ptr);
27801         FREE(untag_ptr(_res));
27802         COption_StrZ_free(_res_conv);
27803 }
27804
27805 static inline uint64_t COption_StrZ_clone_ptr(LDKCOption_StrZ *NONNULL_PTR arg) {
27806         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
27807         *ret_copy = COption_StrZ_clone(arg);
27808         int64_t ret_ref = tag_ptr(ret_copy, true);
27809         return ret_ref;
27810 }
27811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1StrZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27812         LDKCOption_StrZ* arg_conv = (LDKCOption_StrZ*)untag_ptr(arg);
27813         int64_t ret_conv = COption_StrZ_clone_ptr(arg_conv);
27814         return ret_conv;
27815 }
27816
27817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1StrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27818         LDKCOption_StrZ* orig_conv = (LDKCOption_StrZ*)untag_ptr(orig);
27819         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
27820         *ret_copy = COption_StrZ_clone(orig_conv);
27821         int64_t ret_ref = tag_ptr(ret_copy, true);
27822         return ret_ref;
27823 }
27824
27825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
27826         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
27827         *ret_conv = CResult_NoneBolt12SemanticErrorZ_ok();
27828         return tag_ptr(ret_conv, true);
27829 }
27830
27831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
27832         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_java(env, e);
27833         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
27834         *ret_conv = CResult_NoneBolt12SemanticErrorZ_err(e_conv);
27835         return tag_ptr(ret_conv, true);
27836 }
27837
27838 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27839         LDKCResult_NoneBolt12SemanticErrorZ* o_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(o);
27840         jboolean ret_conv = CResult_NoneBolt12SemanticErrorZ_is_ok(o_conv);
27841         return ret_conv;
27842 }
27843
27844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27845         if (!ptr_is_owned(_res)) return;
27846         void* _res_ptr = untag_ptr(_res);
27847         CHECK_ACCESS(_res_ptr);
27848         LDKCResult_NoneBolt12SemanticErrorZ _res_conv = *(LDKCResult_NoneBolt12SemanticErrorZ*)(_res_ptr);
27849         FREE(untag_ptr(_res));
27850         CResult_NoneBolt12SemanticErrorZ_free(_res_conv);
27851 }
27852
27853 static inline uint64_t CResult_NoneBolt12SemanticErrorZ_clone_ptr(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR arg) {
27854         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
27855         *ret_conv = CResult_NoneBolt12SemanticErrorZ_clone(arg);
27856         return tag_ptr(ret_conv, true);
27857 }
27858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27859         LDKCResult_NoneBolt12SemanticErrorZ* arg_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(arg);
27860         int64_t ret_conv = CResult_NoneBolt12SemanticErrorZ_clone_ptr(arg_conv);
27861         return ret_conv;
27862 }
27863
27864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27865         LDKCResult_NoneBolt12SemanticErrorZ* orig_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(orig);
27866         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
27867         *ret_conv = CResult_NoneBolt12SemanticErrorZ_clone(orig_conv);
27868         return tag_ptr(ret_conv, true);
27869 }
27870
27871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27872         void* o_ptr = untag_ptr(o);
27873         CHECK_ACCESS(o_ptr);
27874         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_ptr);
27875         o_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o));
27876         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
27877         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(o_conv);
27878         return tag_ptr(ret_conv, true);
27879 }
27880
27881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1err(JNIEnv *env, jclass clz) {
27882         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
27883         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err();
27884         return tag_ptr(ret_conv, true);
27885 }
27886
27887 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27888         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(o);
27889         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(o_conv);
27890         return ret_conv;
27891 }
27892
27893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27894         if (!ptr_is_owned(_res)) return;
27895         void* _res_ptr = untag_ptr(_res);
27896         CHECK_ACCESS(_res_ptr);
27897         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)(_res_ptr);
27898         FREE(untag_ptr(_res));
27899         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(_res_conv);
27900 }
27901
27902 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR arg) {
27903         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
27904         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(arg);
27905         return tag_ptr(ret_conv, true);
27906 }
27907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27908         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(arg);
27909         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(arg_conv);
27910         return ret_conv;
27911 }
27912
27913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27914         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(orig);
27915         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
27916         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(orig_conv);
27917         return tag_ptr(ret_conv, true);
27918 }
27919
27920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1some(JNIEnv *env, jclass clz, int64_t o) {
27921         void* o_ptr = untag_ptr(o);
27922         CHECK_ACCESS(o_ptr);
27923         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
27924         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
27925         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
27926         *ret_copy = COption_OffersMessageZ_some(o_conv);
27927         int64_t ret_ref = tag_ptr(ret_copy, true);
27928         return ret_ref;
27929 }
27930
27931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1none(JNIEnv *env, jclass clz) {
27932         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
27933         *ret_copy = COption_OffersMessageZ_none();
27934         int64_t ret_ref = tag_ptr(ret_copy, true);
27935         return ret_ref;
27936 }
27937
27938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27939         if (!ptr_is_owned(_res)) return;
27940         void* _res_ptr = untag_ptr(_res);
27941         CHECK_ACCESS(_res_ptr);
27942         LDKCOption_OffersMessageZ _res_conv = *(LDKCOption_OffersMessageZ*)(_res_ptr);
27943         FREE(untag_ptr(_res));
27944         COption_OffersMessageZ_free(_res_conv);
27945 }
27946
27947 static inline uint64_t COption_OffersMessageZ_clone_ptr(LDKCOption_OffersMessageZ *NONNULL_PTR arg) {
27948         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
27949         *ret_copy = COption_OffersMessageZ_clone(arg);
27950         int64_t ret_ref = tag_ptr(ret_copy, true);
27951         return ret_ref;
27952 }
27953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27954         LDKCOption_OffersMessageZ* arg_conv = (LDKCOption_OffersMessageZ*)untag_ptr(arg);
27955         int64_t ret_conv = COption_OffersMessageZ_clone_ptr(arg_conv);
27956         return ret_conv;
27957 }
27958
27959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27960         LDKCOption_OffersMessageZ* orig_conv = (LDKCOption_OffersMessageZ*)untag_ptr(orig);
27961         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
27962         *ret_copy = COption_OffersMessageZ_clone(orig_conv);
27963         int64_t ret_ref = tag_ptr(ret_copy, true);
27964         return ret_ref;
27965 }
27966
27967 static inline uint64_t C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR arg) {
27968         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
27969         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(arg);
27970         return tag_ptr(ret_conv, true);
27971 }
27972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27973         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* arg_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(arg);
27974         int64_t ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(arg_conv);
27975         return ret_conv;
27976 }
27977
27978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27979         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* orig_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(orig);
27980         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
27981         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(orig_conv);
27982         return tag_ptr(ret_conv, true);
27983 }
27984
27985 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) {
27986         void* a_ptr = untag_ptr(a);
27987         CHECK_ACCESS(a_ptr);
27988         LDKOffersMessage a_conv = *(LDKOffersMessage*)(a_ptr);
27989         a_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(a));
27990         void* b_ptr = untag_ptr(b);
27991         CHECK_ACCESS(b_ptr);
27992         LDKDestination b_conv = *(LDKDestination*)(b_ptr);
27993         b_conv = Destination_clone((LDKDestination*)untag_ptr(b));
27994         LDKBlindedPath c_conv;
27995         c_conv.inner = untag_ptr(c);
27996         c_conv.is_owned = ptr_is_owned(c);
27997         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
27998         c_conv = BlindedPath_clone(&c_conv);
27999         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
28000         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_new(a_conv, b_conv, c_conv);
28001         return tag_ptr(ret_conv, true);
28002 }
28003
28004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28005         if (!ptr_is_owned(_res)) return;
28006         void* _res_ptr = untag_ptr(_res);
28007         CHECK_ACCESS(_res_ptr);
28008         LDKC3Tuple_OffersMessageDestinationBlindedPathZ _res_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(_res_ptr);
28009         FREE(untag_ptr(_res));
28010         C3Tuple_OffersMessageDestinationBlindedPathZ_free(_res_conv);
28011 }
28012
28013 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1OffersMessageDestinationBlindedPathZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
28014         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ _res_constr;
28015         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
28016         if (_res_constr.datalen > 0)
28017                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ Elements");
28018         else
28019                 _res_constr.data = NULL;
28020         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
28021         for (size_t x = 0; x < _res_constr.datalen; x++) {
28022                 int64_t _res_conv_49 = _res_vals[x];
28023                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
28024                 CHECK_ACCESS(_res_conv_49_ptr);
28025                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ _res_conv_49_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(_res_conv_49_ptr);
28026                 FREE(untag_ptr(_res_conv_49));
28027                 _res_constr.data[x] = _res_conv_49_conv;
28028         }
28029         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
28030         CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(_res_constr);
28031 }
28032
28033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28034         LDKCounterpartyForwardingInfo o_conv;
28035         o_conv.inner = untag_ptr(o);
28036         o_conv.is_owned = ptr_is_owned(o);
28037         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28038         o_conv = CounterpartyForwardingInfo_clone(&o_conv);
28039         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
28040         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
28041         return tag_ptr(ret_conv, true);
28042 }
28043
28044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28045         void* e_ptr = untag_ptr(e);
28046         CHECK_ACCESS(e_ptr);
28047         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28048         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28049         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
28050         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
28051         return tag_ptr(ret_conv, true);
28052 }
28053
28054 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28055         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(o);
28056         jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
28057         return ret_conv;
28058 }
28059
28060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28061         if (!ptr_is_owned(_res)) return;
28062         void* _res_ptr = untag_ptr(_res);
28063         CHECK_ACCESS(_res_ptr);
28064         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
28065         FREE(untag_ptr(_res));
28066         CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
28067 }
28068
28069 static inline uint64_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
28070         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
28071         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
28072         return tag_ptr(ret_conv, true);
28073 }
28074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28075         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(arg);
28076         int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
28077         return ret_conv;
28078 }
28079
28080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28081         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(orig);
28082         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
28083         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
28084         return tag_ptr(ret_conv, true);
28085 }
28086
28087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28088         LDKChannelCounterparty o_conv;
28089         o_conv.inner = untag_ptr(o);
28090         o_conv.is_owned = ptr_is_owned(o);
28091         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28092         o_conv = ChannelCounterparty_clone(&o_conv);
28093         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
28094         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
28095         return tag_ptr(ret_conv, true);
28096 }
28097
28098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28099         void* e_ptr = untag_ptr(e);
28100         CHECK_ACCESS(e_ptr);
28101         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28102         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28103         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
28104         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
28105         return tag_ptr(ret_conv, true);
28106 }
28107
28108 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28109         LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(o);
28110         jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
28111         return ret_conv;
28112 }
28113
28114 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28115         if (!ptr_is_owned(_res)) return;
28116         void* _res_ptr = untag_ptr(_res);
28117         CHECK_ACCESS(_res_ptr);
28118         LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
28119         FREE(untag_ptr(_res));
28120         CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
28121 }
28122
28123 static inline uint64_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
28124         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
28125         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
28126         return tag_ptr(ret_conv, true);
28127 }
28128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28129         LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(arg);
28130         int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
28131         return ret_conv;
28132 }
28133
28134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28135         LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(orig);
28136         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
28137         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
28138         return tag_ptr(ret_conv, true);
28139 }
28140
28141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28142         LDKChannelDetails o_conv;
28143         o_conv.inner = untag_ptr(o);
28144         o_conv.is_owned = ptr_is_owned(o);
28145         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28146         o_conv = ChannelDetails_clone(&o_conv);
28147         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
28148         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
28149         return tag_ptr(ret_conv, true);
28150 }
28151
28152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28153         void* e_ptr = untag_ptr(e);
28154         CHECK_ACCESS(e_ptr);
28155         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28156         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28157         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
28158         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
28159         return tag_ptr(ret_conv, true);
28160 }
28161
28162 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28163         LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(o);
28164         jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
28165         return ret_conv;
28166 }
28167
28168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28169         if (!ptr_is_owned(_res)) return;
28170         void* _res_ptr = untag_ptr(_res);
28171         CHECK_ACCESS(_res_ptr);
28172         LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
28173         FREE(untag_ptr(_res));
28174         CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
28175 }
28176
28177 static inline uint64_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
28178         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
28179         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
28180         return tag_ptr(ret_conv, true);
28181 }
28182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28183         LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(arg);
28184         int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
28185         return ret_conv;
28186 }
28187
28188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28189         LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(orig);
28190         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
28191         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
28192         return tag_ptr(ret_conv, true);
28193 }
28194
28195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28196         LDKPhantomRouteHints o_conv;
28197         o_conv.inner = untag_ptr(o);
28198         o_conv.is_owned = ptr_is_owned(o);
28199         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28200         o_conv = PhantomRouteHints_clone(&o_conv);
28201         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
28202         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
28203         return tag_ptr(ret_conv, true);
28204 }
28205
28206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28207         void* e_ptr = untag_ptr(e);
28208         CHECK_ACCESS(e_ptr);
28209         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28210         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28211         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
28212         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
28213         return tag_ptr(ret_conv, true);
28214 }
28215
28216 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28217         LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(o);
28218         jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
28219         return ret_conv;
28220 }
28221
28222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28223         if (!ptr_is_owned(_res)) return;
28224         void* _res_ptr = untag_ptr(_res);
28225         CHECK_ACCESS(_res_ptr);
28226         LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
28227         FREE(untag_ptr(_res));
28228         CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
28229 }
28230
28231 static inline uint64_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
28232         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
28233         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
28234         return tag_ptr(ret_conv, true);
28235 }
28236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28237         LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(arg);
28238         int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
28239         return ret_conv;
28240 }
28241
28242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28243         LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(orig);
28244         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
28245         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
28246         return tag_ptr(ret_conv, true);
28247 }
28248
28249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedForwardDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28250         LDKBlindedForward o_conv;
28251         o_conv.inner = untag_ptr(o);
28252         o_conv.is_owned = ptr_is_owned(o);
28253         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28254         o_conv = BlindedForward_clone(&o_conv);
28255         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
28256         *ret_conv = CResult_BlindedForwardDecodeErrorZ_ok(o_conv);
28257         return tag_ptr(ret_conv, true);
28258 }
28259
28260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedForwardDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28261         void* e_ptr = untag_ptr(e);
28262         CHECK_ACCESS(e_ptr);
28263         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28264         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28265         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
28266         *ret_conv = CResult_BlindedForwardDecodeErrorZ_err(e_conv);
28267         return tag_ptr(ret_conv, true);
28268 }
28269
28270 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedForwardDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28271         LDKCResult_BlindedForwardDecodeErrorZ* o_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(o);
28272         jboolean ret_conv = CResult_BlindedForwardDecodeErrorZ_is_ok(o_conv);
28273         return ret_conv;
28274 }
28275
28276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedForwardDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28277         if (!ptr_is_owned(_res)) return;
28278         void* _res_ptr = untag_ptr(_res);
28279         CHECK_ACCESS(_res_ptr);
28280         LDKCResult_BlindedForwardDecodeErrorZ _res_conv = *(LDKCResult_BlindedForwardDecodeErrorZ*)(_res_ptr);
28281         FREE(untag_ptr(_res));
28282         CResult_BlindedForwardDecodeErrorZ_free(_res_conv);
28283 }
28284
28285 static inline uint64_t CResult_BlindedForwardDecodeErrorZ_clone_ptr(LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR arg) {
28286         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
28287         *ret_conv = CResult_BlindedForwardDecodeErrorZ_clone(arg);
28288         return tag_ptr(ret_conv, true);
28289 }
28290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedForwardDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28291         LDKCResult_BlindedForwardDecodeErrorZ* arg_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(arg);
28292         int64_t ret_conv = CResult_BlindedForwardDecodeErrorZ_clone_ptr(arg_conv);
28293         return ret_conv;
28294 }
28295
28296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedForwardDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28297         LDKCResult_BlindedForwardDecodeErrorZ* orig_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(orig);
28298         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
28299         *ret_conv = CResult_BlindedForwardDecodeErrorZ_clone(orig_conv);
28300         return tag_ptr(ret_conv, true);
28301 }
28302
28303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCRoutingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28304         void* o_ptr = untag_ptr(o);
28305         CHECK_ACCESS(o_ptr);
28306         LDKPendingHTLCRouting o_conv = *(LDKPendingHTLCRouting*)(o_ptr);
28307         o_conv = PendingHTLCRouting_clone((LDKPendingHTLCRouting*)untag_ptr(o));
28308         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
28309         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_ok(o_conv);
28310         return tag_ptr(ret_conv, true);
28311 }
28312
28313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCRoutingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28314         void* e_ptr = untag_ptr(e);
28315         CHECK_ACCESS(e_ptr);
28316         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28317         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28318         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
28319         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_err(e_conv);
28320         return tag_ptr(ret_conv, true);
28321 }
28322
28323 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCRoutingDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28324         LDKCResult_PendingHTLCRoutingDecodeErrorZ* o_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(o);
28325         jboolean ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_is_ok(o_conv);
28326         return ret_conv;
28327 }
28328
28329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCRoutingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28330         if (!ptr_is_owned(_res)) return;
28331         void* _res_ptr = untag_ptr(_res);
28332         CHECK_ACCESS(_res_ptr);
28333         LDKCResult_PendingHTLCRoutingDecodeErrorZ _res_conv = *(LDKCResult_PendingHTLCRoutingDecodeErrorZ*)(_res_ptr);
28334         FREE(untag_ptr(_res));
28335         CResult_PendingHTLCRoutingDecodeErrorZ_free(_res_conv);
28336 }
28337
28338 static inline uint64_t CResult_PendingHTLCRoutingDecodeErrorZ_clone_ptr(LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR arg) {
28339         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
28340         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_clone(arg);
28341         return tag_ptr(ret_conv, true);
28342 }
28343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCRoutingDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28344         LDKCResult_PendingHTLCRoutingDecodeErrorZ* arg_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(arg);
28345         int64_t ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_clone_ptr(arg_conv);
28346         return ret_conv;
28347 }
28348
28349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCRoutingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28350         LDKCResult_PendingHTLCRoutingDecodeErrorZ* orig_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(orig);
28351         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
28352         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_clone(orig_conv);
28353         return tag_ptr(ret_conv, true);
28354 }
28355
28356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28357         LDKPendingHTLCInfo o_conv;
28358         o_conv.inner = untag_ptr(o);
28359         o_conv.is_owned = ptr_is_owned(o);
28360         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28361         o_conv = PendingHTLCInfo_clone(&o_conv);
28362         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
28363         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_ok(o_conv);
28364         return tag_ptr(ret_conv, true);
28365 }
28366
28367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28368         void* e_ptr = untag_ptr(e);
28369         CHECK_ACCESS(e_ptr);
28370         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28371         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28372         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
28373         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_err(e_conv);
28374         return tag_ptr(ret_conv, true);
28375 }
28376
28377 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28378         LDKCResult_PendingHTLCInfoDecodeErrorZ* o_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(o);
28379         jboolean ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_is_ok(o_conv);
28380         return ret_conv;
28381 }
28382
28383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28384         if (!ptr_is_owned(_res)) return;
28385         void* _res_ptr = untag_ptr(_res);
28386         CHECK_ACCESS(_res_ptr);
28387         LDKCResult_PendingHTLCInfoDecodeErrorZ _res_conv = *(LDKCResult_PendingHTLCInfoDecodeErrorZ*)(_res_ptr);
28388         FREE(untag_ptr(_res));
28389         CResult_PendingHTLCInfoDecodeErrorZ_free(_res_conv);
28390 }
28391
28392 static inline uint64_t CResult_PendingHTLCInfoDecodeErrorZ_clone_ptr(LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR arg) {
28393         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
28394         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_clone(arg);
28395         return tag_ptr(ret_conv, true);
28396 }
28397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28398         LDKCResult_PendingHTLCInfoDecodeErrorZ* arg_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(arg);
28399         int64_t ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_clone_ptr(arg_conv);
28400         return ret_conv;
28401 }
28402
28403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28404         LDKCResult_PendingHTLCInfoDecodeErrorZ* orig_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(orig);
28405         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
28406         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_clone(orig_conv);
28407         return tag_ptr(ret_conv, true);
28408 }
28409
28410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedFailureDecodeErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
28411         LDKBlindedFailure o_conv = LDKBlindedFailure_from_java(env, o);
28412         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
28413         *ret_conv = CResult_BlindedFailureDecodeErrorZ_ok(o_conv);
28414         return tag_ptr(ret_conv, true);
28415 }
28416
28417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedFailureDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28418         void* e_ptr = untag_ptr(e);
28419         CHECK_ACCESS(e_ptr);
28420         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28421         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28422         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
28423         *ret_conv = CResult_BlindedFailureDecodeErrorZ_err(e_conv);
28424         return tag_ptr(ret_conv, true);
28425 }
28426
28427 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedFailureDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28428         LDKCResult_BlindedFailureDecodeErrorZ* o_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(o);
28429         jboolean ret_conv = CResult_BlindedFailureDecodeErrorZ_is_ok(o_conv);
28430         return ret_conv;
28431 }
28432
28433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedFailureDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28434         if (!ptr_is_owned(_res)) return;
28435         void* _res_ptr = untag_ptr(_res);
28436         CHECK_ACCESS(_res_ptr);
28437         LDKCResult_BlindedFailureDecodeErrorZ _res_conv = *(LDKCResult_BlindedFailureDecodeErrorZ*)(_res_ptr);
28438         FREE(untag_ptr(_res));
28439         CResult_BlindedFailureDecodeErrorZ_free(_res_conv);
28440 }
28441
28442 static inline uint64_t CResult_BlindedFailureDecodeErrorZ_clone_ptr(LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR arg) {
28443         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
28444         *ret_conv = CResult_BlindedFailureDecodeErrorZ_clone(arg);
28445         return tag_ptr(ret_conv, true);
28446 }
28447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedFailureDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28448         LDKCResult_BlindedFailureDecodeErrorZ* arg_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(arg);
28449         int64_t ret_conv = CResult_BlindedFailureDecodeErrorZ_clone_ptr(arg_conv);
28450         return ret_conv;
28451 }
28452
28453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedFailureDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28454         LDKCResult_BlindedFailureDecodeErrorZ* orig_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(orig);
28455         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
28456         *ret_conv = CResult_BlindedFailureDecodeErrorZ_clone(orig_conv);
28457         return tag_ptr(ret_conv, true);
28458 }
28459
28460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
28461         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_java(env, o);
28462         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
28463         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_ok(o_conv);
28464         return tag_ptr(ret_conv, true);
28465 }
28466
28467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28468         void* e_ptr = untag_ptr(e);
28469         CHECK_ACCESS(e_ptr);
28470         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28471         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28472         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
28473         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_err(e_conv);
28474         return tag_ptr(ret_conv, true);
28475 }
28476
28477 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28478         LDKCResult_ChannelShutdownStateDecodeErrorZ* o_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(o);
28479         jboolean ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_is_ok(o_conv);
28480         return ret_conv;
28481 }
28482
28483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28484         if (!ptr_is_owned(_res)) return;
28485         void* _res_ptr = untag_ptr(_res);
28486         CHECK_ACCESS(_res_ptr);
28487         LDKCResult_ChannelShutdownStateDecodeErrorZ _res_conv = *(LDKCResult_ChannelShutdownStateDecodeErrorZ*)(_res_ptr);
28488         FREE(untag_ptr(_res));
28489         CResult_ChannelShutdownStateDecodeErrorZ_free(_res_conv);
28490 }
28491
28492 static inline uint64_t CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR arg) {
28493         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
28494         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(arg);
28495         return tag_ptr(ret_conv, true);
28496 }
28497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28498         LDKCResult_ChannelShutdownStateDecodeErrorZ* arg_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(arg);
28499         int64_t ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(arg_conv);
28500         return ret_conv;
28501 }
28502
28503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28504         LDKCResult_ChannelShutdownStateDecodeErrorZ* orig_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(orig);
28505         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
28506         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(orig_conv);
28507         return tag_ptr(ret_conv, true);
28508 }
28509
28510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
28511         LDKCVec_ChannelMonitorZ _res_constr;
28512         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
28513         if (_res_constr.datalen > 0)
28514                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
28515         else
28516                 _res_constr.data = NULL;
28517         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
28518         for (size_t q = 0; q < _res_constr.datalen; q++) {
28519                 int64_t _res_conv_16 = _res_vals[q];
28520                 LDKChannelMonitor _res_conv_16_conv;
28521                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
28522                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
28523                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
28524                 _res_constr.data[q] = _res_conv_16_conv;
28525         }
28526         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
28527         CVec_ChannelMonitorZ_free(_res_constr);
28528 }
28529
28530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
28531         LDKThirtyTwoBytes a_ref;
28532         CHECK((*env)->GetArrayLength(env, a) == 32);
28533         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
28534         LDKChannelManager b_conv;
28535         b_conv.inner = untag_ptr(b);
28536         b_conv.is_owned = ptr_is_owned(b);
28537         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
28538         // WARNING: we need a move here but no clone is available for LDKChannelManager
28539         
28540         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ), "LDKC2Tuple_ThirtyTwoBytesChannelManagerZ");
28541         *ret_conv = C2Tuple_ThirtyTwoBytesChannelManagerZ_new(a_ref, b_conv);
28542         return tag_ptr(ret_conv, true);
28543 }
28544
28545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28546         if (!ptr_is_owned(_res)) return;
28547         void* _res_ptr = untag_ptr(_res);
28548         CHECK_ACCESS(_res_ptr);
28549         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)(_res_ptr);
28550         FREE(untag_ptr(_res));
28551         C2Tuple_ThirtyTwoBytesChannelManagerZ_free(_res_conv);
28552 }
28553
28554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28555         void* o_ptr = untag_ptr(o);
28556         CHECK_ACCESS(o_ptr);
28557         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)(o_ptr);
28558         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_ThirtyTwoBytesChannelManagerZ
28559         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
28560         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(o_conv);
28561         return tag_ptr(ret_conv, true);
28562 }
28563
28564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28565         void* e_ptr = untag_ptr(e);
28566         CHECK_ACCESS(e_ptr);
28567         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28568         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28569         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
28570         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(e_conv);
28571         return tag_ptr(ret_conv, true);
28572 }
28573
28574 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28575         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(o);
28576         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(o_conv);
28577         return ret_conv;
28578 }
28579
28580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28581         if (!ptr_is_owned(_res)) return;
28582         void* _res_ptr = untag_ptr(_res);
28583         CHECK_ACCESS(_res_ptr);
28584         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)(_res_ptr);
28585         FREE(untag_ptr(_res));
28586         CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(_res_conv);
28587 }
28588
28589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28590         void* o_ptr = untag_ptr(o);
28591         CHECK_ACCESS(o_ptr);
28592         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
28593         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
28594         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
28595         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_ok(o_conv);
28596         return tag_ptr(ret_conv, true);
28597 }
28598
28599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28600         void* e_ptr = untag_ptr(e);
28601         CHECK_ACCESS(e_ptr);
28602         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28603         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28604         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
28605         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_err(e_conv);
28606         return tag_ptr(ret_conv, true);
28607 }
28608
28609 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28610         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* o_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(o);
28611         jboolean ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(o_conv);
28612         return ret_conv;
28613 }
28614
28615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28616         if (!ptr_is_owned(_res)) return;
28617         void* _res_ptr = untag_ptr(_res);
28618         CHECK_ACCESS(_res_ptr);
28619         LDKCResult_MaxDustHTLCExposureDecodeErrorZ _res_conv = *(LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)(_res_ptr);
28620         FREE(untag_ptr(_res));
28621         CResult_MaxDustHTLCExposureDecodeErrorZ_free(_res_conv);
28622 }
28623
28624 static inline uint64_t CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR arg) {
28625         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
28626         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(arg);
28627         return tag_ptr(ret_conv, true);
28628 }
28629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28630         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* arg_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(arg);
28631         int64_t ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(arg_conv);
28632         return ret_conv;
28633 }
28634
28635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28636         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* orig_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(orig);
28637         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
28638         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(orig_conv);
28639         return tag_ptr(ret_conv, true);
28640 }
28641
28642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28643         LDKChannelConfig o_conv;
28644         o_conv.inner = untag_ptr(o);
28645         o_conv.is_owned = ptr_is_owned(o);
28646         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28647         o_conv = ChannelConfig_clone(&o_conv);
28648         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
28649         *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
28650         return tag_ptr(ret_conv, true);
28651 }
28652
28653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28654         void* e_ptr = untag_ptr(e);
28655         CHECK_ACCESS(e_ptr);
28656         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28657         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28658         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
28659         *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
28660         return tag_ptr(ret_conv, true);
28661 }
28662
28663 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28664         LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(o);
28665         jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
28666         return ret_conv;
28667 }
28668
28669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28670         if (!ptr_is_owned(_res)) return;
28671         void* _res_ptr = untag_ptr(_res);
28672         CHECK_ACCESS(_res_ptr);
28673         LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
28674         FREE(untag_ptr(_res));
28675         CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
28676 }
28677
28678 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
28679         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
28680         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
28681         return tag_ptr(ret_conv, true);
28682 }
28683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28684         LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(arg);
28685         int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
28686         return ret_conv;
28687 }
28688
28689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28690         LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(orig);
28691         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
28692         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
28693         return tag_ptr(ret_conv, true);
28694 }
28695
28696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1some(JNIEnv *env, jclass clz, int64_t o) {
28697         void* o_ptr = untag_ptr(o);
28698         CHECK_ACCESS(o_ptr);
28699         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
28700         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
28701         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
28702         *ret_copy = COption_MaxDustHTLCExposureZ_some(o_conv);
28703         int64_t ret_ref = tag_ptr(ret_copy, true);
28704         return ret_ref;
28705 }
28706
28707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1none(JNIEnv *env, jclass clz) {
28708         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
28709         *ret_copy = COption_MaxDustHTLCExposureZ_none();
28710         int64_t ret_ref = tag_ptr(ret_copy, true);
28711         return ret_ref;
28712 }
28713
28714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28715         if (!ptr_is_owned(_res)) return;
28716         void* _res_ptr = untag_ptr(_res);
28717         CHECK_ACCESS(_res_ptr);
28718         LDKCOption_MaxDustHTLCExposureZ _res_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(_res_ptr);
28719         FREE(untag_ptr(_res));
28720         COption_MaxDustHTLCExposureZ_free(_res_conv);
28721 }
28722
28723 static inline uint64_t COption_MaxDustHTLCExposureZ_clone_ptr(LDKCOption_MaxDustHTLCExposureZ *NONNULL_PTR arg) {
28724         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
28725         *ret_copy = COption_MaxDustHTLCExposureZ_clone(arg);
28726         int64_t ret_ref = tag_ptr(ret_copy, true);
28727         return ret_ref;
28728 }
28729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28730         LDKCOption_MaxDustHTLCExposureZ* arg_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(arg);
28731         int64_t ret_conv = COption_MaxDustHTLCExposureZ_clone_ptr(arg_conv);
28732         return ret_conv;
28733 }
28734
28735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28736         LDKCOption_MaxDustHTLCExposureZ* orig_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(orig);
28737         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
28738         *ret_copy = COption_MaxDustHTLCExposureZ_clone(orig_conv);
28739         int64_t ret_ref = tag_ptr(ret_copy, true);
28740         return ret_ref;
28741 }
28742
28743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1some(JNIEnv *env, jclass clz, int64_t o) {
28744         void* o_ptr = untag_ptr(o);
28745         CHECK_ACCESS(o_ptr);
28746         LDKAPIError o_conv = *(LDKAPIError*)(o_ptr);
28747         o_conv = APIError_clone((LDKAPIError*)untag_ptr(o));
28748         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
28749         *ret_copy = COption_APIErrorZ_some(o_conv);
28750         int64_t ret_ref = tag_ptr(ret_copy, true);
28751         return ret_ref;
28752 }
28753
28754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1none(JNIEnv *env, jclass clz) {
28755         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
28756         *ret_copy = COption_APIErrorZ_none();
28757         int64_t ret_ref = tag_ptr(ret_copy, true);
28758         return ret_ref;
28759 }
28760
28761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28762         if (!ptr_is_owned(_res)) return;
28763         void* _res_ptr = untag_ptr(_res);
28764         CHECK_ACCESS(_res_ptr);
28765         LDKCOption_APIErrorZ _res_conv = *(LDKCOption_APIErrorZ*)(_res_ptr);
28766         FREE(untag_ptr(_res));
28767         COption_APIErrorZ_free(_res_conv);
28768 }
28769
28770 static inline uint64_t COption_APIErrorZ_clone_ptr(LDKCOption_APIErrorZ *NONNULL_PTR arg) {
28771         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
28772         *ret_copy = COption_APIErrorZ_clone(arg);
28773         int64_t ret_ref = tag_ptr(ret_copy, true);
28774         return ret_ref;
28775 }
28776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28777         LDKCOption_APIErrorZ* arg_conv = (LDKCOption_APIErrorZ*)untag_ptr(arg);
28778         int64_t ret_conv = COption_APIErrorZ_clone_ptr(arg_conv);
28779         return ret_conv;
28780 }
28781
28782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28783         LDKCOption_APIErrorZ* orig_conv = (LDKCOption_APIErrorZ*)untag_ptr(orig);
28784         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
28785         *ret_copy = COption_APIErrorZ_clone(orig_conv);
28786         int64_t ret_ref = tag_ptr(ret_copy, true);
28787         return ret_ref;
28788 }
28789
28790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28791         void* o_ptr = untag_ptr(o);
28792         CHECK_ACCESS(o_ptr);
28793         LDKCOption_APIErrorZ o_conv = *(LDKCOption_APIErrorZ*)(o_ptr);
28794         o_conv = COption_APIErrorZ_clone((LDKCOption_APIErrorZ*)untag_ptr(o));
28795         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
28796         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_ok(o_conv);
28797         return tag_ptr(ret_conv, true);
28798 }
28799
28800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28801         void* e_ptr = untag_ptr(e);
28802         CHECK_ACCESS(e_ptr);
28803         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28804         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28805         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
28806         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_err(e_conv);
28807         return tag_ptr(ret_conv, true);
28808 }
28809
28810 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28811         LDKCResult_COption_APIErrorZDecodeErrorZ* o_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(o);
28812         jboolean ret_conv = CResult_COption_APIErrorZDecodeErrorZ_is_ok(o_conv);
28813         return ret_conv;
28814 }
28815
28816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28817         if (!ptr_is_owned(_res)) return;
28818         void* _res_ptr = untag_ptr(_res);
28819         CHECK_ACCESS(_res_ptr);
28820         LDKCResult_COption_APIErrorZDecodeErrorZ _res_conv = *(LDKCResult_COption_APIErrorZDecodeErrorZ*)(_res_ptr);
28821         FREE(untag_ptr(_res));
28822         CResult_COption_APIErrorZDecodeErrorZ_free(_res_conv);
28823 }
28824
28825 static inline uint64_t CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR arg) {
28826         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
28827         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(arg);
28828         return tag_ptr(ret_conv, true);
28829 }
28830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28831         LDKCResult_COption_APIErrorZDecodeErrorZ* arg_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(arg);
28832         int64_t ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(arg_conv);
28833         return ret_conv;
28834 }
28835
28836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28837         LDKCResult_COption_APIErrorZDecodeErrorZ* orig_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(orig);
28838         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
28839         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(orig_conv);
28840         return tag_ptr(ret_conv, true);
28841 }
28842
28843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28844         LDKChannelMonitorUpdate o_conv;
28845         o_conv.inner = untag_ptr(o);
28846         o_conv.is_owned = ptr_is_owned(o);
28847         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28848         o_conv = ChannelMonitorUpdate_clone(&o_conv);
28849         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
28850         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
28851         return tag_ptr(ret_conv, true);
28852 }
28853
28854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28855         void* e_ptr = untag_ptr(e);
28856         CHECK_ACCESS(e_ptr);
28857         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28858         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28859         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
28860         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
28861         return tag_ptr(ret_conv, true);
28862 }
28863
28864 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28865         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o);
28866         jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
28867         return ret_conv;
28868 }
28869
28870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28871         if (!ptr_is_owned(_res)) return;
28872         void* _res_ptr = untag_ptr(_res);
28873         CHECK_ACCESS(_res_ptr);
28874         LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
28875         FREE(untag_ptr(_res));
28876         CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
28877 }
28878
28879 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
28880         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
28881         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
28882         return tag_ptr(ret_conv, true);
28883 }
28884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28885         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg);
28886         int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
28887         return ret_conv;
28888 }
28889
28890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28891         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig);
28892         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
28893         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
28894         return tag_ptr(ret_conv, true);
28895 }
28896
28897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
28898         void* o_ptr = untag_ptr(o);
28899         CHECK_ACCESS(o_ptr);
28900         LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
28901         o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o));
28902         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
28903         *ret_copy = COption_MonitorEventZ_some(o_conv);
28904         int64_t ret_ref = tag_ptr(ret_copy, true);
28905         return ret_ref;
28906 }
28907
28908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1none(JNIEnv *env, jclass clz) {
28909         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
28910         *ret_copy = COption_MonitorEventZ_none();
28911         int64_t ret_ref = tag_ptr(ret_copy, true);
28912         return ret_ref;
28913 }
28914
28915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28916         if (!ptr_is_owned(_res)) return;
28917         void* _res_ptr = untag_ptr(_res);
28918         CHECK_ACCESS(_res_ptr);
28919         LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
28920         FREE(untag_ptr(_res));
28921         COption_MonitorEventZ_free(_res_conv);
28922 }
28923
28924 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
28925         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
28926         *ret_copy = COption_MonitorEventZ_clone(arg);
28927         int64_t ret_ref = tag_ptr(ret_copy, true);
28928         return ret_ref;
28929 }
28930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28931         LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg);
28932         int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
28933         return ret_conv;
28934 }
28935
28936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28937         LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig);
28938         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
28939         *ret_copy = COption_MonitorEventZ_clone(orig_conv);
28940         int64_t ret_ref = tag_ptr(ret_copy, true);
28941         return ret_ref;
28942 }
28943
28944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28945         void* o_ptr = untag_ptr(o);
28946         CHECK_ACCESS(o_ptr);
28947         LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
28948         o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o));
28949         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
28950         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
28951         return tag_ptr(ret_conv, true);
28952 }
28953
28954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28955         void* e_ptr = untag_ptr(e);
28956         CHECK_ACCESS(e_ptr);
28957         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28958         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28959         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
28960         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
28961         return tag_ptr(ret_conv, true);
28962 }
28963
28964 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28965         LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o);
28966         jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
28967         return ret_conv;
28968 }
28969
28970 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28971         if (!ptr_is_owned(_res)) return;
28972         void* _res_ptr = untag_ptr(_res);
28973         CHECK_ACCESS(_res_ptr);
28974         LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
28975         FREE(untag_ptr(_res));
28976         CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
28977 }
28978
28979 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
28980         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
28981         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
28982         return tag_ptr(ret_conv, true);
28983 }
28984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28985         LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg);
28986         int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
28987         return ret_conv;
28988 }
28989
28990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28991         LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig);
28992         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
28993         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
28994         return tag_ptr(ret_conv, true);
28995 }
28996
28997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28998         LDKHTLCUpdate o_conv;
28999         o_conv.inner = untag_ptr(o);
29000         o_conv.is_owned = ptr_is_owned(o);
29001         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29002         o_conv = HTLCUpdate_clone(&o_conv);
29003         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
29004         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
29005         return tag_ptr(ret_conv, true);
29006 }
29007
29008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29009         void* e_ptr = untag_ptr(e);
29010         CHECK_ACCESS(e_ptr);
29011         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29012         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29013         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
29014         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
29015         return tag_ptr(ret_conv, true);
29016 }
29017
29018 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29019         LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(o);
29020         jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
29021         return ret_conv;
29022 }
29023
29024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29025         if (!ptr_is_owned(_res)) return;
29026         void* _res_ptr = untag_ptr(_res);
29027         CHECK_ACCESS(_res_ptr);
29028         LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
29029         FREE(untag_ptr(_res));
29030         CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
29031 }
29032
29033 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
29034         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
29035         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
29036         return tag_ptr(ret_conv, true);
29037 }
29038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29039         LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(arg);
29040         int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
29041         return ret_conv;
29042 }
29043
29044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29045         LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(orig);
29046         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
29047         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
29048         return tag_ptr(ret_conv, true);
29049 }
29050
29051 static inline uint64_t C2Tuple_OutPointCVec_u8ZZ_clone_ptr(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR arg) {
29052         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
29053         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone(arg);
29054         return tag_ptr(ret_conv, true);
29055 }
29056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29057         LDKC2Tuple_OutPointCVec_u8ZZ* arg_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(arg);
29058         int64_t ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone_ptr(arg_conv);
29059         return ret_conv;
29060 }
29061
29062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29063         LDKC2Tuple_OutPointCVec_u8ZZ* orig_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(orig);
29064         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
29065         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone(orig_conv);
29066         return tag_ptr(ret_conv, true);
29067 }
29068
29069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
29070         LDKOutPoint a_conv;
29071         a_conv.inner = untag_ptr(a);
29072         a_conv.is_owned = ptr_is_owned(a);
29073         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29074         a_conv = OutPoint_clone(&a_conv);
29075         LDKCVec_u8Z b_ref;
29076         b_ref.datalen = (*env)->GetArrayLength(env, b);
29077         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
29078         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
29079         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
29080         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_new(a_conv, b_ref);
29081         return tag_ptr(ret_conv, true);
29082 }
29083
29084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29085         if (!ptr_is_owned(_res)) return;
29086         void* _res_ptr = untag_ptr(_res);
29087         CHECK_ACCESS(_res_ptr);
29088         LDKC2Tuple_OutPointCVec_u8ZZ _res_conv = *(LDKC2Tuple_OutPointCVec_u8ZZ*)(_res_ptr);
29089         FREE(untag_ptr(_res));
29090         C2Tuple_OutPointCVec_u8ZZ_free(_res_conv);
29091 }
29092
29093 static inline uint64_t C2Tuple_u32CVec_u8ZZ_clone_ptr(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR arg) {
29094         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
29095         *ret_conv = C2Tuple_u32CVec_u8ZZ_clone(arg);
29096         return tag_ptr(ret_conv, true);
29097 }
29098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29099         LDKC2Tuple_u32CVec_u8ZZ* arg_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(arg);
29100         int64_t ret_conv = C2Tuple_u32CVec_u8ZZ_clone_ptr(arg_conv);
29101         return ret_conv;
29102 }
29103
29104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29105         LDKC2Tuple_u32CVec_u8ZZ* orig_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(orig);
29106         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
29107         *ret_conv = C2Tuple_u32CVec_u8ZZ_clone(orig_conv);
29108         return tag_ptr(ret_conv, true);
29109 }
29110
29111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
29112         LDKCVec_u8Z b_ref;
29113         b_ref.datalen = (*env)->GetArrayLength(env, b);
29114         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
29115         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
29116         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
29117         *ret_conv = C2Tuple_u32CVec_u8ZZ_new(a, b_ref);
29118         return tag_ptr(ret_conv, true);
29119 }
29120
29121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29122         if (!ptr_is_owned(_res)) return;
29123         void* _res_ptr = untag_ptr(_res);
29124         CHECK_ACCESS(_res_ptr);
29125         LDKC2Tuple_u32CVec_u8ZZ _res_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(_res_ptr);
29126         FREE(untag_ptr(_res));
29127         C2Tuple_u32CVec_u8ZZ_free(_res_conv);
29128 }
29129
29130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32CVec_1u8ZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
29131         LDKCVec_C2Tuple_u32CVec_u8ZZZ _res_constr;
29132         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
29133         if (_res_constr.datalen > 0)
29134                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKCVec_C2Tuple_u32CVec_u8ZZZ Elements");
29135         else
29136                 _res_constr.data = NULL;
29137         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
29138         for (size_t x = 0; x < _res_constr.datalen; x++) {
29139                 int64_t _res_conv_23 = _res_vals[x];
29140                 void* _res_conv_23_ptr = untag_ptr(_res_conv_23);
29141                 CHECK_ACCESS(_res_conv_23_ptr);
29142                 LDKC2Tuple_u32CVec_u8ZZ _res_conv_23_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(_res_conv_23_ptr);
29143                 FREE(untag_ptr(_res_conv_23));
29144                 _res_constr.data[x] = _res_conv_23_conv;
29145         }
29146         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
29147         CVec_C2Tuple_u32CVec_u8ZZZ_free(_res_constr);
29148 }
29149
29150 static inline uint64_t C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR arg) {
29151         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
29152         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(arg);
29153         return tag_ptr(ret_conv, true);
29154 }
29155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29156         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(arg);
29157         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(arg_conv);
29158         return ret_conv;
29159 }
29160
29161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29162         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(orig);
29163         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
29164         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(orig_conv);
29165         return tag_ptr(ret_conv, true);
29166 }
29167
29168 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) {
29169         LDKThirtyTwoBytes a_ref;
29170         CHECK((*env)->GetArrayLength(env, a) == 32);
29171         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
29172         LDKCVec_C2Tuple_u32CVec_u8ZZZ b_constr;
29173         b_constr.datalen = (*env)->GetArrayLength(env, b);
29174         if (b_constr.datalen > 0)
29175                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKCVec_C2Tuple_u32CVec_u8ZZZ Elements");
29176         else
29177                 b_constr.data = NULL;
29178         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
29179         for (size_t x = 0; x < b_constr.datalen; x++) {
29180                 int64_t b_conv_23 = b_vals[x];
29181                 void* b_conv_23_ptr = untag_ptr(b_conv_23);
29182                 CHECK_ACCESS(b_conv_23_ptr);
29183                 LDKC2Tuple_u32CVec_u8ZZ b_conv_23_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(b_conv_23_ptr);
29184                 b_conv_23_conv = C2Tuple_u32CVec_u8ZZ_clone((LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(b_conv_23));
29185                 b_constr.data[x] = b_conv_23_conv;
29186         }
29187         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
29188         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
29189         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_new(a_ref, b_constr);
29190         return tag_ptr(ret_conv, true);
29191 }
29192
29193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29194         if (!ptr_is_owned(_res)) return;
29195         void* _res_ptr = untag_ptr(_res);
29196         CHECK_ACCESS(_res_ptr);
29197         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)(_res_ptr);
29198         FREE(untag_ptr(_res));
29199         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(_res_conv);
29200 }
29201
29202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
29203         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ _res_constr;
29204         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
29205         if (_res_constr.datalen > 0)
29206                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ Elements");
29207         else
29208                 _res_constr.data = NULL;
29209         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
29210         for (size_t a = 0; a < _res_constr.datalen; a++) {
29211                 int64_t _res_conv_52 = _res_vals[a];
29212                 void* _res_conv_52_ptr = untag_ptr(_res_conv_52);
29213                 CHECK_ACCESS(_res_conv_52_ptr);
29214                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res_conv_52_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)(_res_conv_52_ptr);
29215                 FREE(untag_ptr(_res_conv_52));
29216                 _res_constr.data[a] = _res_conv_52_conv;
29217         }
29218         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
29219         CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(_res_constr);
29220 }
29221
29222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CommitmentTransactionZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
29223         LDKCVec_CommitmentTransactionZ _res_constr;
29224         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
29225         if (_res_constr.datalen > 0)
29226                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCommitmentTransaction), "LDKCVec_CommitmentTransactionZ Elements");
29227         else
29228                 _res_constr.data = NULL;
29229         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
29230         for (size_t x = 0; x < _res_constr.datalen; x++) {
29231                 int64_t _res_conv_23 = _res_vals[x];
29232                 LDKCommitmentTransaction _res_conv_23_conv;
29233                 _res_conv_23_conv.inner = untag_ptr(_res_conv_23);
29234                 _res_conv_23_conv.is_owned = ptr_is_owned(_res_conv_23);
29235                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_23_conv);
29236                 _res_constr.data[x] = _res_conv_23_conv;
29237         }
29238         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
29239         CVec_CommitmentTransactionZ_free(_res_constr);
29240 }
29241
29242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
29243         LDKCVec_TransactionZ _res_constr;
29244         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
29245         if (_res_constr.datalen > 0)
29246                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
29247         else
29248                 _res_constr.data = NULL;
29249         for (size_t i = 0; i < _res_constr.datalen; i++) {
29250                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
29251                 LDKTransaction _res_conv_8_ref;
29252                 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
29253                 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
29254                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
29255                 _res_conv_8_ref.data_is_owned = true;
29256                 _res_constr.data[i] = _res_conv_8_ref;
29257         }
29258         CVec_TransactionZ_free(_res_constr);
29259 }
29260
29261 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
29262         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
29263         *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
29264         return tag_ptr(ret_conv, true);
29265 }
29266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29267         LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(arg);
29268         int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
29269         return ret_conv;
29270 }
29271
29272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29273         LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(orig);
29274         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
29275         *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
29276         return tag_ptr(ret_conv, true);
29277 }
29278
29279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
29280         void* b_ptr = untag_ptr(b);
29281         CHECK_ACCESS(b_ptr);
29282         LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
29283         b_conv = TxOut_clone((LDKTxOut*)untag_ptr(b));
29284         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
29285         *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
29286         return tag_ptr(ret_conv, true);
29287 }
29288
29289 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_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         LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
29294         FREE(untag_ptr(_res));
29295         C2Tuple_u32TxOutZ_free(_res_conv);
29296 }
29297
29298 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
29299         LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
29300         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
29301         if (_res_constr.datalen > 0)
29302                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
29303         else
29304                 _res_constr.data = NULL;
29305         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
29306         for (size_t u = 0; u < _res_constr.datalen; u++) {
29307                 int64_t _res_conv_20 = _res_vals[u];
29308                 void* _res_conv_20_ptr = untag_ptr(_res_conv_20);
29309                 CHECK_ACCESS(_res_conv_20_ptr);
29310                 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
29311                 FREE(untag_ptr(_res_conv_20));
29312                 _res_constr.data[u] = _res_conv_20_conv;
29313         }
29314         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
29315         CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
29316 }
29317
29318 static inline uint64_t C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
29319         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
29320         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(arg);
29321         return tag_ptr(ret_conv, true);
29322 }
29323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29324         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(arg);
29325         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
29326         return ret_conv;
29327 }
29328
29329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29330         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(orig);
29331         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
29332         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
29333         return tag_ptr(ret_conv, true);
29334 }
29335
29336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
29337         LDKThirtyTwoBytes a_ref;
29338         CHECK((*env)->GetArrayLength(env, a) == 32);
29339         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
29340         LDKCVec_C2Tuple_u32TxOutZZ b_constr;
29341         b_constr.datalen = (*env)->GetArrayLength(env, b);
29342         if (b_constr.datalen > 0)
29343                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
29344         else
29345                 b_constr.data = NULL;
29346         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
29347         for (size_t u = 0; u < b_constr.datalen; u++) {
29348                 int64_t b_conv_20 = b_vals[u];
29349                 void* b_conv_20_ptr = untag_ptr(b_conv_20);
29350                 CHECK_ACCESS(b_conv_20_ptr);
29351                 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
29352                 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)untag_ptr(b_conv_20));
29353                 b_constr.data[u] = b_conv_20_conv;
29354         }
29355         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
29356         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
29357         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
29358         return tag_ptr(ret_conv, true);
29359 }
29360
29361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29362         if (!ptr_is_owned(_res)) return;
29363         void* _res_ptr = untag_ptr(_res);
29364         CHECK_ACCESS(_res_ptr);
29365         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
29366         FREE(untag_ptr(_res));
29367         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
29368 }
29369
29370 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
29371         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ _res_constr;
29372         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
29373         if (_res_constr.datalen > 0)
29374                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ Elements");
29375         else
29376                 _res_constr.data = NULL;
29377         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
29378         for (size_t x = 0; x < _res_constr.datalen; x++) {
29379                 int64_t _res_conv_49 = _res_vals[x];
29380                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
29381                 CHECK_ACCESS(_res_conv_49_ptr);
29382                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res_conv_49_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_49_ptr);
29383                 FREE(untag_ptr(_res_conv_49));
29384                 _res_constr.data[x] = _res_conv_49_conv;
29385         }
29386         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
29387         CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
29388 }
29389
29390 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BalanceZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
29391         LDKCVec_BalanceZ _res_constr;
29392         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
29393         if (_res_constr.datalen > 0)
29394                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
29395         else
29396                 _res_constr.data = NULL;
29397         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
29398         for (size_t j = 0; j < _res_constr.datalen; j++) {
29399                 int64_t _res_conv_9 = _res_vals[j];
29400                 void* _res_conv_9_ptr = untag_ptr(_res_conv_9);
29401                 CHECK_ACCESS(_res_conv_9_ptr);
29402                 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
29403                 FREE(untag_ptr(_res_conv_9));
29404                 _res_constr.data[j] = _res_conv_9_conv;
29405         }
29406         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
29407         CVec_BalanceZ_free(_res_constr);
29408 }
29409
29410 static inline uint64_t C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR arg) {
29411         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
29412         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(arg);
29413         return tag_ptr(ret_conv, true);
29414 }
29415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29416         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(arg);
29417         int64_t ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(arg_conv);
29418         return ret_conv;
29419 }
29420
29421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29422         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(orig);
29423         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
29424         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(orig_conv);
29425         return tag_ptr(ret_conv, true);
29426 }
29427
29428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
29429         LDKThirtyTwoBytes a_ref;
29430         CHECK((*env)->GetArrayLength(env, a) == 32);
29431         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
29432         LDKChannelMonitor b_conv;
29433         b_conv.inner = untag_ptr(b);
29434         b_conv.is_owned = ptr_is_owned(b);
29435         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
29436         b_conv = ChannelMonitor_clone(&b_conv);
29437         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
29438         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(a_ref, b_conv);
29439         return tag_ptr(ret_conv, true);
29440 }
29441
29442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29443         if (!ptr_is_owned(_res)) return;
29444         void* _res_ptr = untag_ptr(_res);
29445         CHECK_ACCESS(_res_ptr);
29446         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(_res_ptr);
29447         FREE(untag_ptr(_res));
29448         C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(_res_conv);
29449 }
29450
29451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29452         void* o_ptr = untag_ptr(o);
29453         CHECK_ACCESS(o_ptr);
29454         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_ptr);
29455         o_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o));
29456         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
29457         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(o_conv);
29458         return tag_ptr(ret_conv, true);
29459 }
29460
29461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29462         void* e_ptr = untag_ptr(e);
29463         CHECK_ACCESS(e_ptr);
29464         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29465         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29466         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
29467         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(e_conv);
29468         return tag_ptr(ret_conv, true);
29469 }
29470
29471 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29472         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(o);
29473         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(o_conv);
29474         return ret_conv;
29475 }
29476
29477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29478         if (!ptr_is_owned(_res)) return;
29479         void* _res_ptr = untag_ptr(_res);
29480         CHECK_ACCESS(_res_ptr);
29481         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)(_res_ptr);
29482         FREE(untag_ptr(_res));
29483         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(_res_conv);
29484 }
29485
29486 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
29487         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
29488         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(arg);
29489         return tag_ptr(ret_conv, true);
29490 }
29491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29492         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(arg);
29493         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
29494         return ret_conv;
29495 }
29496
29497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29498         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(orig);
29499         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
29500         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(orig_conv);
29501         return tag_ptr(ret_conv, true);
29502 }
29503
29504 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
29505         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
29506         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
29507         return tag_ptr(ret_conv, true);
29508 }
29509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29510         LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(arg);
29511         int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
29512         return ret_conv;
29513 }
29514
29515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29516         LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(orig);
29517         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
29518         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
29519         return tag_ptr(ret_conv, true);
29520 }
29521
29522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
29523         LDKPublicKey a_ref;
29524         CHECK((*env)->GetArrayLength(env, a) == 33);
29525         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
29526         void* b_ptr = untag_ptr(b);
29527         CHECK_ACCESS(b_ptr);
29528         LDKType b_conv = *(LDKType*)(b_ptr);
29529         if (b_conv.free == LDKType_JCalls_free) {
29530                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29531                 LDKType_JCalls_cloned(&b_conv);
29532         }
29533         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
29534         *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
29535         return tag_ptr(ret_conv, true);
29536 }
29537
29538 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29539         if (!ptr_is_owned(_res)) return;
29540         void* _res_ptr = untag_ptr(_res);
29541         CHECK_ACCESS(_res_ptr);
29542         LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
29543         FREE(untag_ptr(_res));
29544         C2Tuple_PublicKeyTypeZ_free(_res_conv);
29545 }
29546
29547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyTypeZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
29548         LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
29549         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
29550         if (_res_constr.datalen > 0)
29551                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
29552         else
29553                 _res_constr.data = NULL;
29554         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
29555         for (size_t z = 0; z < _res_constr.datalen; z++) {
29556                 int64_t _res_conv_25 = _res_vals[z];
29557                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
29558                 CHECK_ACCESS(_res_conv_25_ptr);
29559                 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
29560                 FREE(untag_ptr(_res_conv_25));
29561                 _res_constr.data[z] = _res_conv_25_conv;
29562         }
29563         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
29564         CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
29565 }
29566
29567 static inline uint64_t C2Tuple_PublicKeyCVec_SocketAddressZZ_clone_ptr(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ *NONNULL_PTR arg) {
29568         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
29569         *ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(arg);
29570         return tag_ptr(ret_conv, true);
29571 }
29572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCVec_1SocketAddressZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29573         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* arg_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(arg);
29574         int64_t ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone_ptr(arg_conv);
29575         return ret_conv;
29576 }
29577
29578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCVec_1SocketAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29579         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* orig_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(orig);
29580         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
29581         *ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(orig_conv);
29582         return tag_ptr(ret_conv, true);
29583 }
29584
29585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCVec_1SocketAddressZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
29586         LDKPublicKey a_ref;
29587         CHECK((*env)->GetArrayLength(env, a) == 33);
29588         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
29589         LDKCVec_SocketAddressZ b_constr;
29590         b_constr.datalen = (*env)->GetArrayLength(env, b);
29591         if (b_constr.datalen > 0)
29592                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
29593         else
29594                 b_constr.data = NULL;
29595         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
29596         for (size_t p = 0; p < b_constr.datalen; p++) {
29597                 int64_t b_conv_15 = b_vals[p];
29598                 void* b_conv_15_ptr = untag_ptr(b_conv_15);
29599                 CHECK_ACCESS(b_conv_15_ptr);
29600                 LDKSocketAddress b_conv_15_conv = *(LDKSocketAddress*)(b_conv_15_ptr);
29601                 b_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(b_conv_15));
29602                 b_constr.data[p] = b_conv_15_conv;
29603         }
29604         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
29605         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
29606         *ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_new(a_ref, b_constr);
29607         return tag_ptr(ret_conv, true);
29608 }
29609
29610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCVec_1SocketAddressZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29611         if (!ptr_is_owned(_res)) return;
29612         void* _res_ptr = untag_ptr(_res);
29613         CHECK_ACCESS(_res_ptr);
29614         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ _res_conv = *(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)(_res_ptr);
29615         FREE(untag_ptr(_res));
29616         C2Tuple_PublicKeyCVec_SocketAddressZZ_free(_res_conv);
29617 }
29618
29619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyCVec_1SocketAddressZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
29620         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ _res_constr;
29621         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
29622         if (_res_constr.datalen > 0)
29623                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ Elements");
29624         else
29625                 _res_constr.data = NULL;
29626         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
29627         for (size_t o = 0; o < _res_constr.datalen; o++) {
29628                 int64_t _res_conv_40 = _res_vals[o];
29629                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
29630                 CHECK_ACCESS(_res_conv_40_ptr);
29631                 LDKC2Tuple_PublicKeyCVec_SocketAddressZZ _res_conv_40_conv = *(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)(_res_conv_40_ptr);
29632                 FREE(untag_ptr(_res_conv_40));
29633                 _res_constr.data[o] = _res_conv_40_conv;
29634         }
29635         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
29636         CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_free(_res_constr);
29637 }
29638
29639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OnionMessageContentsZ_1some(JNIEnv *env, jclass clz, int64_t o) {
29640         void* o_ptr = untag_ptr(o);
29641         CHECK_ACCESS(o_ptr);
29642         LDKOnionMessageContents o_conv = *(LDKOnionMessageContents*)(o_ptr);
29643         if (o_conv.free == LDKOnionMessageContents_JCalls_free) {
29644                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29645                 LDKOnionMessageContents_JCalls_cloned(&o_conv);
29646         }
29647         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
29648         *ret_copy = COption_OnionMessageContentsZ_some(o_conv);
29649         int64_t ret_ref = tag_ptr(ret_copy, true);
29650         return ret_ref;
29651 }
29652
29653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OnionMessageContentsZ_1none(JNIEnv *env, jclass clz) {
29654         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
29655         *ret_copy = COption_OnionMessageContentsZ_none();
29656         int64_t ret_ref = tag_ptr(ret_copy, true);
29657         return ret_ref;
29658 }
29659
29660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1OnionMessageContentsZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29661         if (!ptr_is_owned(_res)) return;
29662         void* _res_ptr = untag_ptr(_res);
29663         CHECK_ACCESS(_res_ptr);
29664         LDKCOption_OnionMessageContentsZ _res_conv = *(LDKCOption_OnionMessageContentsZ*)(_res_ptr);
29665         FREE(untag_ptr(_res));
29666         COption_OnionMessageContentsZ_free(_res_conv);
29667 }
29668
29669 static inline uint64_t COption_OnionMessageContentsZ_clone_ptr(LDKCOption_OnionMessageContentsZ *NONNULL_PTR arg) {
29670         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
29671         *ret_copy = COption_OnionMessageContentsZ_clone(arg);
29672         int64_t ret_ref = tag_ptr(ret_copy, true);
29673         return ret_ref;
29674 }
29675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OnionMessageContentsZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29676         LDKCOption_OnionMessageContentsZ* arg_conv = (LDKCOption_OnionMessageContentsZ*)untag_ptr(arg);
29677         int64_t ret_conv = COption_OnionMessageContentsZ_clone_ptr(arg_conv);
29678         return ret_conv;
29679 }
29680
29681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OnionMessageContentsZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29682         LDKCOption_OnionMessageContentsZ* orig_conv = (LDKCOption_OnionMessageContentsZ*)untag_ptr(orig);
29683         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
29684         *ret_copy = COption_OnionMessageContentsZ_clone(orig_conv);
29685         int64_t ret_ref = tag_ptr(ret_copy, true);
29686         return ret_ref;
29687 }
29688
29689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29690         void* o_ptr = untag_ptr(o);
29691         CHECK_ACCESS(o_ptr);
29692         LDKCOption_OnionMessageContentsZ o_conv = *(LDKCOption_OnionMessageContentsZ*)(o_ptr);
29693         o_conv = COption_OnionMessageContentsZ_clone((LDKCOption_OnionMessageContentsZ*)untag_ptr(o));
29694         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
29695         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(o_conv);
29696         return tag_ptr(ret_conv, true);
29697 }
29698
29699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29700         void* e_ptr = untag_ptr(e);
29701         CHECK_ACCESS(e_ptr);
29702         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29703         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29704         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
29705         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_err(e_conv);
29706         return tag_ptr(ret_conv, true);
29707 }
29708
29709 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29710         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* o_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(o);
29711         jboolean ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(o_conv);
29712         return ret_conv;
29713 }
29714
29715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29716         if (!ptr_is_owned(_res)) return;
29717         void* _res_ptr = untag_ptr(_res);
29718         CHECK_ACCESS(_res_ptr);
29719         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ _res_conv = *(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)(_res_ptr);
29720         FREE(untag_ptr(_res));
29721         CResult_COption_OnionMessageContentsZDecodeErrorZ_free(_res_conv);
29722 }
29723
29724 static inline uint64_t CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR arg) {
29725         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
29726         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(arg);
29727         return tag_ptr(ret_conv, true);
29728 }
29729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29730         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* arg_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(arg);
29731         int64_t ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(arg_conv);
29732         return ret_conv;
29733 }
29734
29735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29736         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* orig_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(orig);
29737         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
29738         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(orig_conv);
29739         return tag_ptr(ret_conv, true);
29740 }
29741
29742 static inline uint64_t C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR arg) {
29743         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
29744         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(arg);
29745         return tag_ptr(ret_conv, true);
29746 }
29747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29748         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* arg_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(arg);
29749         int64_t ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(arg_conv);
29750         return ret_conv;
29751 }
29752
29753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29754         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* orig_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(orig);
29755         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
29756         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(orig_conv);
29757         return tag_ptr(ret_conv, true);
29758 }
29759
29760 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) {
29761         void* a_ptr = untag_ptr(a);
29762         CHECK_ACCESS(a_ptr);
29763         LDKOnionMessageContents a_conv = *(LDKOnionMessageContents*)(a_ptr);
29764         if (a_conv.free == LDKOnionMessageContents_JCalls_free) {
29765                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29766                 LDKOnionMessageContents_JCalls_cloned(&a_conv);
29767         }
29768         void* b_ptr = untag_ptr(b);
29769         CHECK_ACCESS(b_ptr);
29770         LDKDestination b_conv = *(LDKDestination*)(b_ptr);
29771         b_conv = Destination_clone((LDKDestination*)untag_ptr(b));
29772         LDKBlindedPath c_conv;
29773         c_conv.inner = untag_ptr(c);
29774         c_conv.is_owned = ptr_is_owned(c);
29775         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
29776         c_conv = BlindedPath_clone(&c_conv);
29777         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
29778         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new(a_conv, b_conv, c_conv);
29779         return tag_ptr(ret_conv, true);
29780 }
29781
29782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29783         if (!ptr_is_owned(_res)) return;
29784         void* _res_ptr = untag_ptr(_res);
29785         CHECK_ACCESS(_res_ptr);
29786         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ _res_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(_res_ptr);
29787         FREE(untag_ptr(_res));
29788         C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(_res_conv);
29789 }
29790
29791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1OnionMessageContentsDestinationBlindedPathZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
29792         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ _res_constr;
29793         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
29794         if (_res_constr.datalen > 0)
29795                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ Elements");
29796         else
29797                 _res_constr.data = NULL;
29798         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
29799         for (size_t e = 0; e < _res_constr.datalen; e++) {
29800                 int64_t _res_conv_56 = _res_vals[e];
29801                 void* _res_conv_56_ptr = untag_ptr(_res_conv_56);
29802                 CHECK_ACCESS(_res_conv_56_ptr);
29803                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ _res_conv_56_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(_res_conv_56_ptr);
29804                 FREE(untag_ptr(_res_conv_56));
29805                 _res_constr.data[e] = _res_conv_56_conv;
29806         }
29807         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
29808         CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(_res_constr);
29809 }
29810
29811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1some(JNIEnv *env, jclass clz, int64_t o) {
29812         void* o_ptr = untag_ptr(o);
29813         CHECK_ACCESS(o_ptr);
29814         LDKType o_conv = *(LDKType*)(o_ptr);
29815         if (o_conv.free == LDKType_JCalls_free) {
29816                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29817                 LDKType_JCalls_cloned(&o_conv);
29818         }
29819         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
29820         *ret_copy = COption_TypeZ_some(o_conv);
29821         int64_t ret_ref = tag_ptr(ret_copy, true);
29822         return ret_ref;
29823 }
29824
29825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1none(JNIEnv *env, jclass clz) {
29826         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
29827         *ret_copy = COption_TypeZ_none();
29828         int64_t ret_ref = tag_ptr(ret_copy, true);
29829         return ret_ref;
29830 }
29831
29832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29833         if (!ptr_is_owned(_res)) return;
29834         void* _res_ptr = untag_ptr(_res);
29835         CHECK_ACCESS(_res_ptr);
29836         LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
29837         FREE(untag_ptr(_res));
29838         COption_TypeZ_free(_res_conv);
29839 }
29840
29841 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
29842         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
29843         *ret_copy = COption_TypeZ_clone(arg);
29844         int64_t ret_ref = tag_ptr(ret_copy, true);
29845         return ret_ref;
29846 }
29847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29848         LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)untag_ptr(arg);
29849         int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
29850         return ret_conv;
29851 }
29852
29853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29854         LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)untag_ptr(orig);
29855         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
29856         *ret_copy = COption_TypeZ_clone(orig_conv);
29857         int64_t ret_ref = tag_ptr(ret_copy, true);
29858         return ret_ref;
29859 }
29860
29861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29862         void* o_ptr = untag_ptr(o);
29863         CHECK_ACCESS(o_ptr);
29864         LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
29865         o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)untag_ptr(o));
29866         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
29867         *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
29868         return tag_ptr(ret_conv, true);
29869 }
29870
29871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29872         void* e_ptr = untag_ptr(e);
29873         CHECK_ACCESS(e_ptr);
29874         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29875         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29876         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
29877         *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
29878         return tag_ptr(ret_conv, true);
29879 }
29880
29881 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29882         LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(o);
29883         jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
29884         return ret_conv;
29885 }
29886
29887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29888         if (!ptr_is_owned(_res)) return;
29889         void* _res_ptr = untag_ptr(_res);
29890         CHECK_ACCESS(_res_ptr);
29891         LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
29892         FREE(untag_ptr(_res));
29893         CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
29894 }
29895
29896 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
29897         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
29898         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
29899         return tag_ptr(ret_conv, true);
29900 }
29901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29902         LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(arg);
29903         int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
29904         return ret_conv;
29905 }
29906
29907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29908         LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(orig);
29909         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
29910         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
29911         return tag_ptr(ret_conv, true);
29912 }
29913
29914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SocketAddressZ_1some(JNIEnv *env, jclass clz, int64_t o) {
29915         void* o_ptr = untag_ptr(o);
29916         CHECK_ACCESS(o_ptr);
29917         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
29918         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
29919         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
29920         *ret_copy = COption_SocketAddressZ_some(o_conv);
29921         int64_t ret_ref = tag_ptr(ret_copy, true);
29922         return ret_ref;
29923 }
29924
29925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SocketAddressZ_1none(JNIEnv *env, jclass clz) {
29926         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
29927         *ret_copy = COption_SocketAddressZ_none();
29928         int64_t ret_ref = tag_ptr(ret_copy, true);
29929         return ret_ref;
29930 }
29931
29932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1SocketAddressZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29933         if (!ptr_is_owned(_res)) return;
29934         void* _res_ptr = untag_ptr(_res);
29935         CHECK_ACCESS(_res_ptr);
29936         LDKCOption_SocketAddressZ _res_conv = *(LDKCOption_SocketAddressZ*)(_res_ptr);
29937         FREE(untag_ptr(_res));
29938         COption_SocketAddressZ_free(_res_conv);
29939 }
29940
29941 static inline uint64_t COption_SocketAddressZ_clone_ptr(LDKCOption_SocketAddressZ *NONNULL_PTR arg) {
29942         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
29943         *ret_copy = COption_SocketAddressZ_clone(arg);
29944         int64_t ret_ref = tag_ptr(ret_copy, true);
29945         return ret_ref;
29946 }
29947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SocketAddressZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29948         LDKCOption_SocketAddressZ* arg_conv = (LDKCOption_SocketAddressZ*)untag_ptr(arg);
29949         int64_t ret_conv = COption_SocketAddressZ_clone_ptr(arg_conv);
29950         return ret_conv;
29951 }
29952
29953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SocketAddressZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29954         LDKCOption_SocketAddressZ* orig_conv = (LDKCOption_SocketAddressZ*)untag_ptr(orig);
29955         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
29956         *ret_copy = COption_SocketAddressZ_clone(orig_conv);
29957         int64_t ret_ref = tag_ptr(ret_copy, true);
29958         return ret_ref;
29959 }
29960
29961 static inline uint64_t C2Tuple_PublicKeyCOption_SocketAddressZZ_clone_ptr(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *NONNULL_PTR arg) {
29962         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
29963         *ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(arg);
29964         return tag_ptr(ret_conv, true);
29965 }
29966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1SocketAddressZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29967         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* arg_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(arg);
29968         int64_t ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone_ptr(arg_conv);
29969         return ret_conv;
29970 }
29971
29972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1SocketAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29973         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* orig_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(orig);
29974         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
29975         *ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(orig_conv);
29976         return tag_ptr(ret_conv, true);
29977 }
29978
29979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1SocketAddressZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
29980         LDKPublicKey a_ref;
29981         CHECK((*env)->GetArrayLength(env, a) == 33);
29982         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
29983         void* b_ptr = untag_ptr(b);
29984         CHECK_ACCESS(b_ptr);
29985         LDKCOption_SocketAddressZ b_conv = *(LDKCOption_SocketAddressZ*)(b_ptr);
29986         b_conv = COption_SocketAddressZ_clone((LDKCOption_SocketAddressZ*)untag_ptr(b));
29987         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
29988         *ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_new(a_ref, b_conv);
29989         return tag_ptr(ret_conv, true);
29990 }
29991
29992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1SocketAddressZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29993         if (!ptr_is_owned(_res)) return;
29994         void* _res_ptr = untag_ptr(_res);
29995         CHECK_ACCESS(_res_ptr);
29996         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ _res_conv = *(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)(_res_ptr);
29997         FREE(untag_ptr(_res));
29998         C2Tuple_PublicKeyCOption_SocketAddressZZ_free(_res_conv);
29999 }
30000
30001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyCOption_1SocketAddressZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
30002         LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ _res_constr;
30003         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
30004         if (_res_constr.datalen > 0)
30005                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ Elements");
30006         else
30007                 _res_constr.data = NULL;
30008         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
30009         for (size_t r = 0; r < _res_constr.datalen; r++) {
30010                 int64_t _res_conv_43 = _res_vals[r];
30011                 void* _res_conv_43_ptr = untag_ptr(_res_conv_43);
30012                 CHECK_ACCESS(_res_conv_43_ptr);
30013                 LDKC2Tuple_PublicKeyCOption_SocketAddressZZ _res_conv_43_conv = *(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)(_res_conv_43_ptr);
30014                 FREE(untag_ptr(_res_conv_43));
30015                 _res_constr.data[r] = _res_conv_43_conv;
30016         }
30017         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
30018         CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_free(_res_constr);
30019 }
30020
30021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
30022         LDKCVec_u8Z o_ref;
30023         o_ref.datalen = (*env)->GetArrayLength(env, o);
30024         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
30025         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
30026         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
30027         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
30028         return tag_ptr(ret_conv, true);
30029 }
30030
30031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30032         LDKPeerHandleError e_conv;
30033         e_conv.inner = untag_ptr(e);
30034         e_conv.is_owned = ptr_is_owned(e);
30035         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
30036         e_conv = PeerHandleError_clone(&e_conv);
30037         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
30038         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
30039         return tag_ptr(ret_conv, true);
30040 }
30041
30042 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30043         LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o);
30044         jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
30045         return ret_conv;
30046 }
30047
30048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30049         if (!ptr_is_owned(_res)) return;
30050         void* _res_ptr = untag_ptr(_res);
30051         CHECK_ACCESS(_res_ptr);
30052         LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
30053         FREE(untag_ptr(_res));
30054         CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
30055 }
30056
30057 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
30058         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
30059         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
30060         return tag_ptr(ret_conv, true);
30061 }
30062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30063         LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg);
30064         int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
30065         return ret_conv;
30066 }
30067
30068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30069         LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig);
30070         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
30071         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
30072         return tag_ptr(ret_conv, true);
30073 }
30074
30075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
30076         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
30077         *ret_conv = CResult_NonePeerHandleErrorZ_ok();
30078         return tag_ptr(ret_conv, true);
30079 }
30080
30081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30082         LDKPeerHandleError e_conv;
30083         e_conv.inner = untag_ptr(e);
30084         e_conv.is_owned = ptr_is_owned(e);
30085         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
30086         e_conv = PeerHandleError_clone(&e_conv);
30087         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
30088         *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
30089         return tag_ptr(ret_conv, true);
30090 }
30091
30092 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30093         LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o);
30094         jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
30095         return ret_conv;
30096 }
30097
30098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30099         if (!ptr_is_owned(_res)) return;
30100         void* _res_ptr = untag_ptr(_res);
30101         CHECK_ACCESS(_res_ptr);
30102         LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
30103         FREE(untag_ptr(_res));
30104         CResult_NonePeerHandleErrorZ_free(_res_conv);
30105 }
30106
30107 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
30108         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
30109         *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
30110         return tag_ptr(ret_conv, true);
30111 }
30112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30113         LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg);
30114         int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
30115         return ret_conv;
30116 }
30117
30118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30119         LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig);
30120         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
30121         *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
30122         return tag_ptr(ret_conv, true);
30123 }
30124
30125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
30126         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
30127         *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
30128         return tag_ptr(ret_conv, true);
30129 }
30130
30131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30132         LDKPeerHandleError e_conv;
30133         e_conv.inner = untag_ptr(e);
30134         e_conv.is_owned = ptr_is_owned(e);
30135         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
30136         e_conv = PeerHandleError_clone(&e_conv);
30137         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
30138         *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
30139         return tag_ptr(ret_conv, true);
30140 }
30141
30142 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30143         LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o);
30144         jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
30145         return ret_conv;
30146 }
30147
30148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30149         if (!ptr_is_owned(_res)) return;
30150         void* _res_ptr = untag_ptr(_res);
30151         CHECK_ACCESS(_res_ptr);
30152         LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
30153         FREE(untag_ptr(_res));
30154         CResult_boolPeerHandleErrorZ_free(_res_conv);
30155 }
30156
30157 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
30158         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
30159         *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
30160         return tag_ptr(ret_conv, true);
30161 }
30162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30163         LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg);
30164         int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
30165         return ret_conv;
30166 }
30167
30168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30169         LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig);
30170         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
30171         *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
30172         return tag_ptr(ret_conv, true);
30173 }
30174
30175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1ok(JNIEnv *env, jclass clz, int32_t o) {
30176         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
30177         *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
30178         return tag_ptr(ret_conv, true);
30179 }
30180
30181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30182         void* e_ptr = untag_ptr(e);
30183         CHECK_ACCESS(e_ptr);
30184         LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
30185         e_conv = GraphSyncError_clone((LDKGraphSyncError*)untag_ptr(e));
30186         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
30187         *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
30188         return tag_ptr(ret_conv, true);
30189 }
30190
30191 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30192         LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(o);
30193         jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
30194         return ret_conv;
30195 }
30196
30197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30198         if (!ptr_is_owned(_res)) return;
30199         void* _res_ptr = untag_ptr(_res);
30200         CHECK_ACCESS(_res_ptr);
30201         LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
30202         FREE(untag_ptr(_res));
30203         CResult_u32GraphSyncErrorZ_free(_res_conv);
30204 }
30205
30206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
30207         LDKCVec_u8Z o_ref;
30208         o_ref.datalen = (*env)->GetArrayLength(env, o);
30209         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
30210         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
30211         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
30212         *ret_conv = CResult_CVec_u8ZIOErrorZ_ok(o_ref);
30213         return tag_ptr(ret_conv, true);
30214 }
30215
30216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
30217         LDKIOError e_conv = LDKIOError_from_java(env, e);
30218         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
30219         *ret_conv = CResult_CVec_u8ZIOErrorZ_err(e_conv);
30220         return tag_ptr(ret_conv, true);
30221 }
30222
30223 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30224         LDKCResult_CVec_u8ZIOErrorZ* o_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(o);
30225         jboolean ret_conv = CResult_CVec_u8ZIOErrorZ_is_ok(o_conv);
30226         return ret_conv;
30227 }
30228
30229 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30230         if (!ptr_is_owned(_res)) return;
30231         void* _res_ptr = untag_ptr(_res);
30232         CHECK_ACCESS(_res_ptr);
30233         LDKCResult_CVec_u8ZIOErrorZ _res_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(_res_ptr);
30234         FREE(untag_ptr(_res));
30235         CResult_CVec_u8ZIOErrorZ_free(_res_conv);
30236 }
30237
30238 static inline uint64_t CResult_CVec_u8ZIOErrorZ_clone_ptr(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR arg) {
30239         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
30240         *ret_conv = CResult_CVec_u8ZIOErrorZ_clone(arg);
30241         return tag_ptr(ret_conv, true);
30242 }
30243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30244         LDKCResult_CVec_u8ZIOErrorZ* arg_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(arg);
30245         int64_t ret_conv = CResult_CVec_u8ZIOErrorZ_clone_ptr(arg_conv);
30246         return ret_conv;
30247 }
30248
30249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30250         LDKCResult_CVec_u8ZIOErrorZ* orig_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(orig);
30251         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
30252         *ret_conv = CResult_CVec_u8ZIOErrorZ_clone(orig_conv);
30253         return tag_ptr(ret_conv, true);
30254 }
30255
30256 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1StrZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
30257         LDKCVec_StrZ _res_constr;
30258         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
30259         if (_res_constr.datalen > 0)
30260                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKStr), "LDKCVec_StrZ Elements");
30261         else
30262                 _res_constr.data = NULL;
30263         for (size_t i = 0; i < _res_constr.datalen; i++) {
30264                 jstring _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
30265                 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
30266                 _res_constr.data[i] = dummy;
30267         }
30268         CVec_StrZ_free(_res_constr);
30269 }
30270
30271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
30272         LDKCVec_StrZ o_constr;
30273         o_constr.datalen = (*env)->GetArrayLength(env, o);
30274         if (o_constr.datalen > 0)
30275                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKStr), "LDKCVec_StrZ Elements");
30276         else
30277                 o_constr.data = NULL;
30278         for (size_t i = 0; i < o_constr.datalen; i++) {
30279                 jstring o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
30280                 LDKStr o_conv_8_conv = java_to_owned_str(env, o_conv_8);
30281                 o_constr.data[i] = o_conv_8_conv;
30282         }
30283         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
30284         *ret_conv = CResult_CVec_StrZIOErrorZ_ok(o_constr);
30285         return tag_ptr(ret_conv, true);
30286 }
30287
30288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
30289         LDKIOError e_conv = LDKIOError_from_java(env, e);
30290         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
30291         *ret_conv = CResult_CVec_StrZIOErrorZ_err(e_conv);
30292         return tag_ptr(ret_conv, true);
30293 }
30294
30295 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30296         LDKCResult_CVec_StrZIOErrorZ* o_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(o);
30297         jboolean ret_conv = CResult_CVec_StrZIOErrorZ_is_ok(o_conv);
30298         return ret_conv;
30299 }
30300
30301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30302         if (!ptr_is_owned(_res)) return;
30303         void* _res_ptr = untag_ptr(_res);
30304         CHECK_ACCESS(_res_ptr);
30305         LDKCResult_CVec_StrZIOErrorZ _res_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(_res_ptr);
30306         FREE(untag_ptr(_res));
30307         CResult_CVec_StrZIOErrorZ_free(_res_conv);
30308 }
30309
30310 static inline uint64_t CResult_CVec_StrZIOErrorZ_clone_ptr(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR arg) {
30311         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
30312         *ret_conv = CResult_CVec_StrZIOErrorZ_clone(arg);
30313         return tag_ptr(ret_conv, true);
30314 }
30315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30316         LDKCResult_CVec_StrZIOErrorZ* arg_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(arg);
30317         int64_t ret_conv = CResult_CVec_StrZIOErrorZ_clone_ptr(arg_conv);
30318         return ret_conv;
30319 }
30320
30321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30322         LDKCResult_CVec_StrZIOErrorZ* orig_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(orig);
30323         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
30324         *ret_conv = CResult_CVec_StrZIOErrorZ_clone(orig_conv);
30325         return tag_ptr(ret_conv, true);
30326 }
30327
30328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
30329         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ _res_constr;
30330         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
30331         if (_res_constr.datalen > 0)
30332                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ Elements");
30333         else
30334                 _res_constr.data = NULL;
30335         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
30336         for (size_t o = 0; o < _res_constr.datalen; o++) {
30337                 int64_t _res_conv_40 = _res_vals[o];
30338                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
30339                 CHECK_ACCESS(_res_conv_40_ptr);
30340                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(_res_conv_40_ptr);
30341                 FREE(untag_ptr(_res_conv_40));
30342                 _res_constr.data[o] = _res_conv_40_conv;
30343         }
30344         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
30345         CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(_res_constr);
30346 }
30347
30348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
30349         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ o_constr;
30350         o_constr.datalen = (*env)->GetArrayLength(env, o);
30351         if (o_constr.datalen > 0)
30352                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ Elements");
30353         else
30354                 o_constr.data = NULL;
30355         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
30356         for (size_t o = 0; o < o_constr.datalen; o++) {
30357                 int64_t o_conv_40 = o_vals[o];
30358                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
30359                 CHECK_ACCESS(o_conv_40_ptr);
30360                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_conv_40_ptr);
30361                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o_conv_40));
30362                 o_constr.data[o] = o_conv_40_conv;
30363         }
30364         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
30365         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
30366         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(o_constr);
30367         return tag_ptr(ret_conv, true);
30368 }
30369
30370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
30371         LDKIOError e_conv = LDKIOError_from_java(env, e);
30372         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
30373         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(e_conv);
30374         return tag_ptr(ret_conv, true);
30375 }
30376
30377 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30378         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(o);
30379         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(o_conv);
30380         return ret_conv;
30381 }
30382
30383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30384         if (!ptr_is_owned(_res)) return;
30385         void* _res_ptr = untag_ptr(_res);
30386         CHECK_ACCESS(_res_ptr);
30387         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)(_res_ptr);
30388         FREE(untag_ptr(_res));
30389         CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(_res_conv);
30390 }
30391
30392 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR arg) {
30393         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
30394         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(arg);
30395         return tag_ptr(ret_conv, true);
30396 }
30397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30398         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(arg);
30399         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(arg_conv);
30400         return ret_conv;
30401 }
30402
30403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30404         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(orig);
30405         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
30406         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(orig_conv);
30407         return tag_ptr(ret_conv, true);
30408 }
30409
30410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30411         void* o_ptr = untag_ptr(o);
30412         CHECK_ACCESS(o_ptr);
30413         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_ptr);
30414         o_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o));
30415         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
30416         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(o_conv);
30417         return tag_ptr(ret_conv, true);
30418 }
30419
30420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
30421         LDKIOError e_conv = LDKIOError_from_java(env, e);
30422         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
30423         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(e_conv);
30424         return tag_ptr(ret_conv, true);
30425 }
30426
30427 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30428         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(o);
30429         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(o_conv);
30430         return ret_conv;
30431 }
30432
30433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30434         if (!ptr_is_owned(_res)) return;
30435         void* _res_ptr = untag_ptr(_res);
30436         CHECK_ACCESS(_res_ptr);
30437         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)(_res_ptr);
30438         FREE(untag_ptr(_res));
30439         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(_res_conv);
30440 }
30441
30442 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR arg) {
30443         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
30444         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(arg);
30445         return tag_ptr(ret_conv, true);
30446 }
30447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30448         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(arg);
30449         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(arg_conv);
30450         return ret_conv;
30451 }
30452
30453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30454         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(orig);
30455         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
30456         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(orig_conv);
30457         return tag_ptr(ret_conv, true);
30458 }
30459
30460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SecretKeyZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
30461         LDKSecretKey o_ref;
30462         CHECK((*env)->GetArrayLength(env, o) == 32);
30463         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
30464         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
30465         *ret_copy = COption_SecretKeyZ_some(o_ref);
30466         int64_t ret_ref = tag_ptr(ret_copy, true);
30467         return ret_ref;
30468 }
30469
30470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SecretKeyZ_1none(JNIEnv *env, jclass clz) {
30471         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
30472         *ret_copy = COption_SecretKeyZ_none();
30473         int64_t ret_ref = tag_ptr(ret_copy, true);
30474         return ret_ref;
30475 }
30476
30477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1SecretKeyZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30478         if (!ptr_is_owned(_res)) return;
30479         void* _res_ptr = untag_ptr(_res);
30480         CHECK_ACCESS(_res_ptr);
30481         LDKCOption_SecretKeyZ _res_conv = *(LDKCOption_SecretKeyZ*)(_res_ptr);
30482         FREE(untag_ptr(_res));
30483         COption_SecretKeyZ_free(_res_conv);
30484 }
30485
30486 static inline uint64_t COption_SecretKeyZ_clone_ptr(LDKCOption_SecretKeyZ *NONNULL_PTR arg) {
30487         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
30488         *ret_copy = COption_SecretKeyZ_clone(arg);
30489         int64_t ret_ref = tag_ptr(ret_copy, true);
30490         return ret_ref;
30491 }
30492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SecretKeyZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30493         LDKCOption_SecretKeyZ* arg_conv = (LDKCOption_SecretKeyZ*)untag_ptr(arg);
30494         int64_t ret_conv = COption_SecretKeyZ_clone_ptr(arg_conv);
30495         return ret_conv;
30496 }
30497
30498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SecretKeyZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30499         LDKCOption_SecretKeyZ* orig_conv = (LDKCOption_SecretKeyZ*)untag_ptr(orig);
30500         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
30501         *ret_copy = COption_SecretKeyZ_clone(orig_conv);
30502         int64_t ret_ref = tag_ptr(ret_copy, true);
30503         return ret_ref;
30504 }
30505
30506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30507         LDKVerifiedInvoiceRequest o_conv;
30508         o_conv.inner = untag_ptr(o);
30509         o_conv.is_owned = ptr_is_owned(o);
30510         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30511         o_conv = VerifiedInvoiceRequest_clone(&o_conv);
30512         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
30513         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_ok(o_conv);
30514         return tag_ptr(ret_conv, true);
30515 }
30516
30517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1err(JNIEnv *env, jclass clz) {
30518         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
30519         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_err();
30520         return tag_ptr(ret_conv, true);
30521 }
30522
30523 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30524         LDKCResult_VerifiedInvoiceRequestNoneZ* o_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(o);
30525         jboolean ret_conv = CResult_VerifiedInvoiceRequestNoneZ_is_ok(o_conv);
30526         return ret_conv;
30527 }
30528
30529 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30530         if (!ptr_is_owned(_res)) return;
30531         void* _res_ptr = untag_ptr(_res);
30532         CHECK_ACCESS(_res_ptr);
30533         LDKCResult_VerifiedInvoiceRequestNoneZ _res_conv = *(LDKCResult_VerifiedInvoiceRequestNoneZ*)(_res_ptr);
30534         FREE(untag_ptr(_res));
30535         CResult_VerifiedInvoiceRequestNoneZ_free(_res_conv);
30536 }
30537
30538 static inline uint64_t CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR arg) {
30539         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
30540         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone(arg);
30541         return tag_ptr(ret_conv, true);
30542 }
30543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30544         LDKCResult_VerifiedInvoiceRequestNoneZ* arg_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(arg);
30545         int64_t ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(arg_conv);
30546         return ret_conv;
30547 }
30548
30549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30550         LDKCResult_VerifiedInvoiceRequestNoneZ* orig_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(orig);
30551         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
30552         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone(orig_conv);
30553         return tag_ptr(ret_conv, true);
30554 }
30555
30556 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1some(JNIEnv *env, jclass clz) {
30557         jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_some());
30558         return ret_conv;
30559 }
30560
30561 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1none(JNIEnv *env, jclass clz) {
30562         jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_none());
30563         return ret_conv;
30564 }
30565
30566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1free(JNIEnv *env, jclass clz, jclass _res) {
30567         LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_java(env, _res);
30568         COption_NoneZ_free(_res_conv);
30569 }
30570
30571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1WitnessZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
30572         LDKCVec_WitnessZ _res_constr;
30573         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
30574         if (_res_constr.datalen > 0)
30575                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
30576         else
30577                 _res_constr.data = NULL;
30578         for (size_t i = 0; i < _res_constr.datalen; i++) {
30579                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
30580                 LDKWitness _res_conv_8_ref;
30581                 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
30582                 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKWitness Bytes");
30583                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
30584                 _res_conv_8_ref.data_is_owned = true;
30585                 _res_constr.data[i] = _res_conv_8_ref;
30586         }
30587         CVec_WitnessZ_free(_res_constr);
30588 }
30589
30590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
30591         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
30592         *ret_copy = COption_i64Z_some(o);
30593         int64_t ret_ref = tag_ptr(ret_copy, true);
30594         return ret_ref;
30595 }
30596
30597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1none(JNIEnv *env, jclass clz) {
30598         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
30599         *ret_copy = COption_i64Z_none();
30600         int64_t ret_ref = tag_ptr(ret_copy, true);
30601         return ret_ref;
30602 }
30603
30604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
30605         if (!ptr_is_owned(_res)) return;
30606         void* _res_ptr = untag_ptr(_res);
30607         CHECK_ACCESS(_res_ptr);
30608         LDKCOption_i64Z _res_conv = *(LDKCOption_i64Z*)(_res_ptr);
30609         FREE(untag_ptr(_res));
30610         COption_i64Z_free(_res_conv);
30611 }
30612
30613 static inline uint64_t COption_i64Z_clone_ptr(LDKCOption_i64Z *NONNULL_PTR arg) {
30614         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
30615         *ret_copy = COption_i64Z_clone(arg);
30616         int64_t ret_ref = tag_ptr(ret_copy, true);
30617         return ret_ref;
30618 }
30619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30620         LDKCOption_i64Z* arg_conv = (LDKCOption_i64Z*)untag_ptr(arg);
30621         int64_t ret_conv = COption_i64Z_clone_ptr(arg_conv);
30622         return ret_conv;
30623 }
30624
30625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30626         LDKCOption_i64Z* orig_conv = (LDKCOption_i64Z*)untag_ptr(orig);
30627         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
30628         *ret_copy = COption_i64Z_clone(orig_conv);
30629         int64_t ret_ref = tag_ptr(ret_copy, true);
30630         return ret_ref;
30631 }
30632
30633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30634         void* o_ptr = untag_ptr(o);
30635         CHECK_ACCESS(o_ptr);
30636         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
30637         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
30638         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
30639         *ret_conv = CResult_SocketAddressDecodeErrorZ_ok(o_conv);
30640         return tag_ptr(ret_conv, true);
30641 }
30642
30643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30644         void* e_ptr = untag_ptr(e);
30645         CHECK_ACCESS(e_ptr);
30646         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30647         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30648         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
30649         *ret_conv = CResult_SocketAddressDecodeErrorZ_err(e_conv);
30650         return tag_ptr(ret_conv, true);
30651 }
30652
30653 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30654         LDKCResult_SocketAddressDecodeErrorZ* o_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(o);
30655         jboolean ret_conv = CResult_SocketAddressDecodeErrorZ_is_ok(o_conv);
30656         return ret_conv;
30657 }
30658
30659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30660         if (!ptr_is_owned(_res)) return;
30661         void* _res_ptr = untag_ptr(_res);
30662         CHECK_ACCESS(_res_ptr);
30663         LDKCResult_SocketAddressDecodeErrorZ _res_conv = *(LDKCResult_SocketAddressDecodeErrorZ*)(_res_ptr);
30664         FREE(untag_ptr(_res));
30665         CResult_SocketAddressDecodeErrorZ_free(_res_conv);
30666 }
30667
30668 static inline uint64_t CResult_SocketAddressDecodeErrorZ_clone_ptr(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR arg) {
30669         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
30670         *ret_conv = CResult_SocketAddressDecodeErrorZ_clone(arg);
30671         return tag_ptr(ret_conv, true);
30672 }
30673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30674         LDKCResult_SocketAddressDecodeErrorZ* arg_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(arg);
30675         int64_t ret_conv = CResult_SocketAddressDecodeErrorZ_clone_ptr(arg_conv);
30676         return ret_conv;
30677 }
30678
30679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30680         LDKCResult_SocketAddressDecodeErrorZ* orig_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(orig);
30681         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
30682         *ret_conv = CResult_SocketAddressDecodeErrorZ_clone(orig_conv);
30683         return tag_ptr(ret_conv, true);
30684 }
30685
30686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30687         void* o_ptr = untag_ptr(o);
30688         CHECK_ACCESS(o_ptr);
30689         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
30690         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
30691         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
30692         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_ok(o_conv);
30693         return tag_ptr(ret_conv, true);
30694 }
30695
30696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
30697         LDKSocketAddressParseError e_conv = LDKSocketAddressParseError_from_java(env, e);
30698         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
30699         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_err(e_conv);
30700         return tag_ptr(ret_conv, true);
30701 }
30702
30703 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30704         LDKCResult_SocketAddressSocketAddressParseErrorZ* o_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(o);
30705         jboolean ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_is_ok(o_conv);
30706         return ret_conv;
30707 }
30708
30709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30710         if (!ptr_is_owned(_res)) return;
30711         void* _res_ptr = untag_ptr(_res);
30712         CHECK_ACCESS(_res_ptr);
30713         LDKCResult_SocketAddressSocketAddressParseErrorZ _res_conv = *(LDKCResult_SocketAddressSocketAddressParseErrorZ*)(_res_ptr);
30714         FREE(untag_ptr(_res));
30715         CResult_SocketAddressSocketAddressParseErrorZ_free(_res_conv);
30716 }
30717
30718 static inline uint64_t CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR arg) {
30719         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
30720         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone(arg);
30721         return tag_ptr(ret_conv, true);
30722 }
30723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30724         LDKCResult_SocketAddressSocketAddressParseErrorZ* arg_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(arg);
30725         int64_t ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(arg_conv);
30726         return ret_conv;
30727 }
30728
30729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30730         LDKCResult_SocketAddressSocketAddressParseErrorZ* orig_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(orig);
30731         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
30732         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone(orig_conv);
30733         return tag_ptr(ret_conv, true);
30734 }
30735
30736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
30737         LDKCVec_UpdateAddHTLCZ _res_constr;
30738         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
30739         if (_res_constr.datalen > 0)
30740                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
30741         else
30742                 _res_constr.data = NULL;
30743         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
30744         for (size_t p = 0; p < _res_constr.datalen; p++) {
30745                 int64_t _res_conv_15 = _res_vals[p];
30746                 LDKUpdateAddHTLC _res_conv_15_conv;
30747                 _res_conv_15_conv.inner = untag_ptr(_res_conv_15);
30748                 _res_conv_15_conv.is_owned = ptr_is_owned(_res_conv_15);
30749                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
30750                 _res_constr.data[p] = _res_conv_15_conv;
30751         }
30752         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
30753         CVec_UpdateAddHTLCZ_free(_res_constr);
30754 }
30755
30756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
30757         LDKCVec_UpdateFulfillHTLCZ _res_constr;
30758         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
30759         if (_res_constr.datalen > 0)
30760                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
30761         else
30762                 _res_constr.data = NULL;
30763         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
30764         for (size_t t = 0; t < _res_constr.datalen; t++) {
30765                 int64_t _res_conv_19 = _res_vals[t];
30766                 LDKUpdateFulfillHTLC _res_conv_19_conv;
30767                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
30768                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
30769                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
30770                 _res_constr.data[t] = _res_conv_19_conv;
30771         }
30772         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
30773         CVec_UpdateFulfillHTLCZ_free(_res_constr);
30774 }
30775
30776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
30777         LDKCVec_UpdateFailHTLCZ _res_constr;
30778         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
30779         if (_res_constr.datalen > 0)
30780                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
30781         else
30782                 _res_constr.data = NULL;
30783         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
30784         for (size_t q = 0; q < _res_constr.datalen; q++) {
30785                 int64_t _res_conv_16 = _res_vals[q];
30786                 LDKUpdateFailHTLC _res_conv_16_conv;
30787                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
30788                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
30789                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
30790                 _res_constr.data[q] = _res_conv_16_conv;
30791         }
30792         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
30793         CVec_UpdateFailHTLCZ_free(_res_constr);
30794 }
30795
30796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
30797         LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
30798         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
30799         if (_res_constr.datalen > 0)
30800                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
30801         else
30802                 _res_constr.data = NULL;
30803         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
30804         for (size_t z = 0; z < _res_constr.datalen; z++) {
30805                 int64_t _res_conv_25 = _res_vals[z];
30806                 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
30807                 _res_conv_25_conv.inner = untag_ptr(_res_conv_25);
30808                 _res_conv_25_conv.is_owned = ptr_is_owned(_res_conv_25);
30809                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
30810                 _res_constr.data[z] = _res_conv_25_conv;
30811         }
30812         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
30813         CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
30814 }
30815
30816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30817         LDKAcceptChannel o_conv;
30818         o_conv.inner = untag_ptr(o);
30819         o_conv.is_owned = ptr_is_owned(o);
30820         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30821         o_conv = AcceptChannel_clone(&o_conv);
30822         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
30823         *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
30824         return tag_ptr(ret_conv, true);
30825 }
30826
30827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30828         void* e_ptr = untag_ptr(e);
30829         CHECK_ACCESS(e_ptr);
30830         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30831         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30832         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
30833         *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
30834         return tag_ptr(ret_conv, true);
30835 }
30836
30837 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30838         LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(o);
30839         jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
30840         return ret_conv;
30841 }
30842
30843 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30844         if (!ptr_is_owned(_res)) return;
30845         void* _res_ptr = untag_ptr(_res);
30846         CHECK_ACCESS(_res_ptr);
30847         LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
30848         FREE(untag_ptr(_res));
30849         CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
30850 }
30851
30852 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
30853         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
30854         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
30855         return tag_ptr(ret_conv, true);
30856 }
30857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30858         LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(arg);
30859         int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
30860         return ret_conv;
30861 }
30862
30863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30864         LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(orig);
30865         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
30866         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
30867         return tag_ptr(ret_conv, true);
30868 }
30869
30870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30871         LDKAcceptChannelV2 o_conv;
30872         o_conv.inner = untag_ptr(o);
30873         o_conv.is_owned = ptr_is_owned(o);
30874         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30875         o_conv = AcceptChannelV2_clone(&o_conv);
30876         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
30877         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_ok(o_conv);
30878         return tag_ptr(ret_conv, true);
30879 }
30880
30881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30882         void* e_ptr = untag_ptr(e);
30883         CHECK_ACCESS(e_ptr);
30884         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30885         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30886         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
30887         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_err(e_conv);
30888         return tag_ptr(ret_conv, true);
30889 }
30890
30891 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30892         LDKCResult_AcceptChannelV2DecodeErrorZ* o_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(o);
30893         jboolean ret_conv = CResult_AcceptChannelV2DecodeErrorZ_is_ok(o_conv);
30894         return ret_conv;
30895 }
30896
30897 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30898         if (!ptr_is_owned(_res)) return;
30899         void* _res_ptr = untag_ptr(_res);
30900         CHECK_ACCESS(_res_ptr);
30901         LDKCResult_AcceptChannelV2DecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelV2DecodeErrorZ*)(_res_ptr);
30902         FREE(untag_ptr(_res));
30903         CResult_AcceptChannelV2DecodeErrorZ_free(_res_conv);
30904 }
30905
30906 static inline uint64_t CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR arg) {
30907         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
30908         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(arg);
30909         return tag_ptr(ret_conv, true);
30910 }
30911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30912         LDKCResult_AcceptChannelV2DecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(arg);
30913         int64_t ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(arg_conv);
30914         return ret_conv;
30915 }
30916
30917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30918         LDKCResult_AcceptChannelV2DecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(orig);
30919         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
30920         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(orig_conv);
30921         return tag_ptr(ret_conv, true);
30922 }
30923
30924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StfuDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30925         LDKStfu o_conv;
30926         o_conv.inner = untag_ptr(o);
30927         o_conv.is_owned = ptr_is_owned(o);
30928         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30929         o_conv = Stfu_clone(&o_conv);
30930         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
30931         *ret_conv = CResult_StfuDecodeErrorZ_ok(o_conv);
30932         return tag_ptr(ret_conv, true);
30933 }
30934
30935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StfuDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30936         void* e_ptr = untag_ptr(e);
30937         CHECK_ACCESS(e_ptr);
30938         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30939         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30940         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
30941         *ret_conv = CResult_StfuDecodeErrorZ_err(e_conv);
30942         return tag_ptr(ret_conv, true);
30943 }
30944
30945 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StfuDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30946         LDKCResult_StfuDecodeErrorZ* o_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(o);
30947         jboolean ret_conv = CResult_StfuDecodeErrorZ_is_ok(o_conv);
30948         return ret_conv;
30949 }
30950
30951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StfuDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30952         if (!ptr_is_owned(_res)) return;
30953         void* _res_ptr = untag_ptr(_res);
30954         CHECK_ACCESS(_res_ptr);
30955         LDKCResult_StfuDecodeErrorZ _res_conv = *(LDKCResult_StfuDecodeErrorZ*)(_res_ptr);
30956         FREE(untag_ptr(_res));
30957         CResult_StfuDecodeErrorZ_free(_res_conv);
30958 }
30959
30960 static inline uint64_t CResult_StfuDecodeErrorZ_clone_ptr(LDKCResult_StfuDecodeErrorZ *NONNULL_PTR arg) {
30961         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
30962         *ret_conv = CResult_StfuDecodeErrorZ_clone(arg);
30963         return tag_ptr(ret_conv, true);
30964 }
30965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StfuDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30966         LDKCResult_StfuDecodeErrorZ* arg_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(arg);
30967         int64_t ret_conv = CResult_StfuDecodeErrorZ_clone_ptr(arg_conv);
30968         return ret_conv;
30969 }
30970
30971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StfuDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30972         LDKCResult_StfuDecodeErrorZ* orig_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(orig);
30973         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
30974         *ret_conv = CResult_StfuDecodeErrorZ_clone(orig_conv);
30975         return tag_ptr(ret_conv, true);
30976 }
30977
30978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30979         LDKSplice o_conv;
30980         o_conv.inner = untag_ptr(o);
30981         o_conv.is_owned = ptr_is_owned(o);
30982         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30983         o_conv = Splice_clone(&o_conv);
30984         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
30985         *ret_conv = CResult_SpliceDecodeErrorZ_ok(o_conv);
30986         return tag_ptr(ret_conv, true);
30987 }
30988
30989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30990         void* e_ptr = untag_ptr(e);
30991         CHECK_ACCESS(e_ptr);
30992         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30993         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30994         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
30995         *ret_conv = CResult_SpliceDecodeErrorZ_err(e_conv);
30996         return tag_ptr(ret_conv, true);
30997 }
30998
30999 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31000         LDKCResult_SpliceDecodeErrorZ* o_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(o);
31001         jboolean ret_conv = CResult_SpliceDecodeErrorZ_is_ok(o_conv);
31002         return ret_conv;
31003 }
31004
31005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31006         if (!ptr_is_owned(_res)) return;
31007         void* _res_ptr = untag_ptr(_res);
31008         CHECK_ACCESS(_res_ptr);
31009         LDKCResult_SpliceDecodeErrorZ _res_conv = *(LDKCResult_SpliceDecodeErrorZ*)(_res_ptr);
31010         FREE(untag_ptr(_res));
31011         CResult_SpliceDecodeErrorZ_free(_res_conv);
31012 }
31013
31014 static inline uint64_t CResult_SpliceDecodeErrorZ_clone_ptr(LDKCResult_SpliceDecodeErrorZ *NONNULL_PTR arg) {
31015         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
31016         *ret_conv = CResult_SpliceDecodeErrorZ_clone(arg);
31017         return tag_ptr(ret_conv, true);
31018 }
31019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31020         LDKCResult_SpliceDecodeErrorZ* arg_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(arg);
31021         int64_t ret_conv = CResult_SpliceDecodeErrorZ_clone_ptr(arg_conv);
31022         return ret_conv;
31023 }
31024
31025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31026         LDKCResult_SpliceDecodeErrorZ* orig_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(orig);
31027         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
31028         *ret_conv = CResult_SpliceDecodeErrorZ_clone(orig_conv);
31029         return tag_ptr(ret_conv, true);
31030 }
31031
31032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceAckDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31033         LDKSpliceAck o_conv;
31034         o_conv.inner = untag_ptr(o);
31035         o_conv.is_owned = ptr_is_owned(o);
31036         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31037         o_conv = SpliceAck_clone(&o_conv);
31038         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
31039         *ret_conv = CResult_SpliceAckDecodeErrorZ_ok(o_conv);
31040         return tag_ptr(ret_conv, true);
31041 }
31042
31043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceAckDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31044         void* e_ptr = untag_ptr(e);
31045         CHECK_ACCESS(e_ptr);
31046         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31047         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31048         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
31049         *ret_conv = CResult_SpliceAckDecodeErrorZ_err(e_conv);
31050         return tag_ptr(ret_conv, true);
31051 }
31052
31053 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceAckDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31054         LDKCResult_SpliceAckDecodeErrorZ* o_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(o);
31055         jboolean ret_conv = CResult_SpliceAckDecodeErrorZ_is_ok(o_conv);
31056         return ret_conv;
31057 }
31058
31059 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceAckDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31060         if (!ptr_is_owned(_res)) return;
31061         void* _res_ptr = untag_ptr(_res);
31062         CHECK_ACCESS(_res_ptr);
31063         LDKCResult_SpliceAckDecodeErrorZ _res_conv = *(LDKCResult_SpliceAckDecodeErrorZ*)(_res_ptr);
31064         FREE(untag_ptr(_res));
31065         CResult_SpliceAckDecodeErrorZ_free(_res_conv);
31066 }
31067
31068 static inline uint64_t CResult_SpliceAckDecodeErrorZ_clone_ptr(LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR arg) {
31069         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
31070         *ret_conv = CResult_SpliceAckDecodeErrorZ_clone(arg);
31071         return tag_ptr(ret_conv, true);
31072 }
31073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceAckDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31074         LDKCResult_SpliceAckDecodeErrorZ* arg_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(arg);
31075         int64_t ret_conv = CResult_SpliceAckDecodeErrorZ_clone_ptr(arg_conv);
31076         return ret_conv;
31077 }
31078
31079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceAckDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31080         LDKCResult_SpliceAckDecodeErrorZ* orig_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(orig);
31081         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
31082         *ret_conv = CResult_SpliceAckDecodeErrorZ_clone(orig_conv);
31083         return tag_ptr(ret_conv, true);
31084 }
31085
31086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceLockedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31087         LDKSpliceLocked o_conv;
31088         o_conv.inner = untag_ptr(o);
31089         o_conv.is_owned = ptr_is_owned(o);
31090         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31091         o_conv = SpliceLocked_clone(&o_conv);
31092         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
31093         *ret_conv = CResult_SpliceLockedDecodeErrorZ_ok(o_conv);
31094         return tag_ptr(ret_conv, true);
31095 }
31096
31097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceLockedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31098         void* e_ptr = untag_ptr(e);
31099         CHECK_ACCESS(e_ptr);
31100         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31101         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31102         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
31103         *ret_conv = CResult_SpliceLockedDecodeErrorZ_err(e_conv);
31104         return tag_ptr(ret_conv, true);
31105 }
31106
31107 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceLockedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31108         LDKCResult_SpliceLockedDecodeErrorZ* o_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(o);
31109         jboolean ret_conv = CResult_SpliceLockedDecodeErrorZ_is_ok(o_conv);
31110         return ret_conv;
31111 }
31112
31113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceLockedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31114         if (!ptr_is_owned(_res)) return;
31115         void* _res_ptr = untag_ptr(_res);
31116         CHECK_ACCESS(_res_ptr);
31117         LDKCResult_SpliceLockedDecodeErrorZ _res_conv = *(LDKCResult_SpliceLockedDecodeErrorZ*)(_res_ptr);
31118         FREE(untag_ptr(_res));
31119         CResult_SpliceLockedDecodeErrorZ_free(_res_conv);
31120 }
31121
31122 static inline uint64_t CResult_SpliceLockedDecodeErrorZ_clone_ptr(LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR arg) {
31123         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
31124         *ret_conv = CResult_SpliceLockedDecodeErrorZ_clone(arg);
31125         return tag_ptr(ret_conv, true);
31126 }
31127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceLockedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31128         LDKCResult_SpliceLockedDecodeErrorZ* arg_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(arg);
31129         int64_t ret_conv = CResult_SpliceLockedDecodeErrorZ_clone_ptr(arg_conv);
31130         return ret_conv;
31131 }
31132
31133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceLockedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31134         LDKCResult_SpliceLockedDecodeErrorZ* orig_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(orig);
31135         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
31136         *ret_conv = CResult_SpliceLockedDecodeErrorZ_clone(orig_conv);
31137         return tag_ptr(ret_conv, true);
31138 }
31139
31140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31141         LDKTxAddInput o_conv;
31142         o_conv.inner = untag_ptr(o);
31143         o_conv.is_owned = ptr_is_owned(o);
31144         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31145         o_conv = TxAddInput_clone(&o_conv);
31146         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
31147         *ret_conv = CResult_TxAddInputDecodeErrorZ_ok(o_conv);
31148         return tag_ptr(ret_conv, true);
31149 }
31150
31151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31152         void* e_ptr = untag_ptr(e);
31153         CHECK_ACCESS(e_ptr);
31154         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31155         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31156         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
31157         *ret_conv = CResult_TxAddInputDecodeErrorZ_err(e_conv);
31158         return tag_ptr(ret_conv, true);
31159 }
31160
31161 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31162         LDKCResult_TxAddInputDecodeErrorZ* o_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(o);
31163         jboolean ret_conv = CResult_TxAddInputDecodeErrorZ_is_ok(o_conv);
31164         return ret_conv;
31165 }
31166
31167 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31168         if (!ptr_is_owned(_res)) return;
31169         void* _res_ptr = untag_ptr(_res);
31170         CHECK_ACCESS(_res_ptr);
31171         LDKCResult_TxAddInputDecodeErrorZ _res_conv = *(LDKCResult_TxAddInputDecodeErrorZ*)(_res_ptr);
31172         FREE(untag_ptr(_res));
31173         CResult_TxAddInputDecodeErrorZ_free(_res_conv);
31174 }
31175
31176 static inline uint64_t CResult_TxAddInputDecodeErrorZ_clone_ptr(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR arg) {
31177         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
31178         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(arg);
31179         return tag_ptr(ret_conv, true);
31180 }
31181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31182         LDKCResult_TxAddInputDecodeErrorZ* arg_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(arg);
31183         int64_t ret_conv = CResult_TxAddInputDecodeErrorZ_clone_ptr(arg_conv);
31184         return ret_conv;
31185 }
31186
31187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31188         LDKCResult_TxAddInputDecodeErrorZ* orig_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(orig);
31189         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
31190         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(orig_conv);
31191         return tag_ptr(ret_conv, true);
31192 }
31193
31194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31195         LDKTxAddOutput o_conv;
31196         o_conv.inner = untag_ptr(o);
31197         o_conv.is_owned = ptr_is_owned(o);
31198         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31199         o_conv = TxAddOutput_clone(&o_conv);
31200         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
31201         *ret_conv = CResult_TxAddOutputDecodeErrorZ_ok(o_conv);
31202         return tag_ptr(ret_conv, true);
31203 }
31204
31205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31206         void* e_ptr = untag_ptr(e);
31207         CHECK_ACCESS(e_ptr);
31208         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31209         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31210         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
31211         *ret_conv = CResult_TxAddOutputDecodeErrorZ_err(e_conv);
31212         return tag_ptr(ret_conv, true);
31213 }
31214
31215 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31216         LDKCResult_TxAddOutputDecodeErrorZ* o_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(o);
31217         jboolean ret_conv = CResult_TxAddOutputDecodeErrorZ_is_ok(o_conv);
31218         return ret_conv;
31219 }
31220
31221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31222         if (!ptr_is_owned(_res)) return;
31223         void* _res_ptr = untag_ptr(_res);
31224         CHECK_ACCESS(_res_ptr);
31225         LDKCResult_TxAddOutputDecodeErrorZ _res_conv = *(LDKCResult_TxAddOutputDecodeErrorZ*)(_res_ptr);
31226         FREE(untag_ptr(_res));
31227         CResult_TxAddOutputDecodeErrorZ_free(_res_conv);
31228 }
31229
31230 static inline uint64_t CResult_TxAddOutputDecodeErrorZ_clone_ptr(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR arg) {
31231         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
31232         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(arg);
31233         return tag_ptr(ret_conv, true);
31234 }
31235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31236         LDKCResult_TxAddOutputDecodeErrorZ* arg_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(arg);
31237         int64_t ret_conv = CResult_TxAddOutputDecodeErrorZ_clone_ptr(arg_conv);
31238         return ret_conv;
31239 }
31240
31241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31242         LDKCResult_TxAddOutputDecodeErrorZ* orig_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(orig);
31243         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
31244         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(orig_conv);
31245         return tag_ptr(ret_conv, true);
31246 }
31247
31248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31249         LDKTxRemoveInput o_conv;
31250         o_conv.inner = untag_ptr(o);
31251         o_conv.is_owned = ptr_is_owned(o);
31252         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31253         o_conv = TxRemoveInput_clone(&o_conv);
31254         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
31255         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_ok(o_conv);
31256         return tag_ptr(ret_conv, true);
31257 }
31258
31259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31260         void* e_ptr = untag_ptr(e);
31261         CHECK_ACCESS(e_ptr);
31262         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31263         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31264         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
31265         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_err(e_conv);
31266         return tag_ptr(ret_conv, true);
31267 }
31268
31269 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31270         LDKCResult_TxRemoveInputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(o);
31271         jboolean ret_conv = CResult_TxRemoveInputDecodeErrorZ_is_ok(o_conv);
31272         return ret_conv;
31273 }
31274
31275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31276         if (!ptr_is_owned(_res)) return;
31277         void* _res_ptr = untag_ptr(_res);
31278         CHECK_ACCESS(_res_ptr);
31279         LDKCResult_TxRemoveInputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveInputDecodeErrorZ*)(_res_ptr);
31280         FREE(untag_ptr(_res));
31281         CResult_TxRemoveInputDecodeErrorZ_free(_res_conv);
31282 }
31283
31284 static inline uint64_t CResult_TxRemoveInputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR arg) {
31285         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
31286         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(arg);
31287         return tag_ptr(ret_conv, true);
31288 }
31289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31290         LDKCResult_TxRemoveInputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(arg);
31291         int64_t ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone_ptr(arg_conv);
31292         return ret_conv;
31293 }
31294
31295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31296         LDKCResult_TxRemoveInputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(orig);
31297         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
31298         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(orig_conv);
31299         return tag_ptr(ret_conv, true);
31300 }
31301
31302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31303         LDKTxRemoveOutput o_conv;
31304         o_conv.inner = untag_ptr(o);
31305         o_conv.is_owned = ptr_is_owned(o);
31306         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31307         o_conv = TxRemoveOutput_clone(&o_conv);
31308         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
31309         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_ok(o_conv);
31310         return tag_ptr(ret_conv, true);
31311 }
31312
31313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31314         void* e_ptr = untag_ptr(e);
31315         CHECK_ACCESS(e_ptr);
31316         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31317         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31318         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
31319         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_err(e_conv);
31320         return tag_ptr(ret_conv, true);
31321 }
31322
31323 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31324         LDKCResult_TxRemoveOutputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(o);
31325         jboolean ret_conv = CResult_TxRemoveOutputDecodeErrorZ_is_ok(o_conv);
31326         return ret_conv;
31327 }
31328
31329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31330         if (!ptr_is_owned(_res)) return;
31331         void* _res_ptr = untag_ptr(_res);
31332         CHECK_ACCESS(_res_ptr);
31333         LDKCResult_TxRemoveOutputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveOutputDecodeErrorZ*)(_res_ptr);
31334         FREE(untag_ptr(_res));
31335         CResult_TxRemoveOutputDecodeErrorZ_free(_res_conv);
31336 }
31337
31338 static inline uint64_t CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR arg) {
31339         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
31340         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(arg);
31341         return tag_ptr(ret_conv, true);
31342 }
31343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31344         LDKCResult_TxRemoveOutputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(arg);
31345         int64_t ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(arg_conv);
31346         return ret_conv;
31347 }
31348
31349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31350         LDKCResult_TxRemoveOutputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(orig);
31351         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
31352         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(orig_conv);
31353         return tag_ptr(ret_conv, true);
31354 }
31355
31356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31357         LDKTxComplete o_conv;
31358         o_conv.inner = untag_ptr(o);
31359         o_conv.is_owned = ptr_is_owned(o);
31360         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31361         o_conv = TxComplete_clone(&o_conv);
31362         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
31363         *ret_conv = CResult_TxCompleteDecodeErrorZ_ok(o_conv);
31364         return tag_ptr(ret_conv, true);
31365 }
31366
31367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31368         void* e_ptr = untag_ptr(e);
31369         CHECK_ACCESS(e_ptr);
31370         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31371         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31372         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
31373         *ret_conv = CResult_TxCompleteDecodeErrorZ_err(e_conv);
31374         return tag_ptr(ret_conv, true);
31375 }
31376
31377 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31378         LDKCResult_TxCompleteDecodeErrorZ* o_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(o);
31379         jboolean ret_conv = CResult_TxCompleteDecodeErrorZ_is_ok(o_conv);
31380         return ret_conv;
31381 }
31382
31383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31384         if (!ptr_is_owned(_res)) return;
31385         void* _res_ptr = untag_ptr(_res);
31386         CHECK_ACCESS(_res_ptr);
31387         LDKCResult_TxCompleteDecodeErrorZ _res_conv = *(LDKCResult_TxCompleteDecodeErrorZ*)(_res_ptr);
31388         FREE(untag_ptr(_res));
31389         CResult_TxCompleteDecodeErrorZ_free(_res_conv);
31390 }
31391
31392 static inline uint64_t CResult_TxCompleteDecodeErrorZ_clone_ptr(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR arg) {
31393         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
31394         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(arg);
31395         return tag_ptr(ret_conv, true);
31396 }
31397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31398         LDKCResult_TxCompleteDecodeErrorZ* arg_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(arg);
31399         int64_t ret_conv = CResult_TxCompleteDecodeErrorZ_clone_ptr(arg_conv);
31400         return ret_conv;
31401 }
31402
31403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31404         LDKCResult_TxCompleteDecodeErrorZ* orig_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(orig);
31405         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
31406         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(orig_conv);
31407         return tag_ptr(ret_conv, true);
31408 }
31409
31410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31411         LDKTxSignatures o_conv;
31412         o_conv.inner = untag_ptr(o);
31413         o_conv.is_owned = ptr_is_owned(o);
31414         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31415         o_conv = TxSignatures_clone(&o_conv);
31416         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
31417         *ret_conv = CResult_TxSignaturesDecodeErrorZ_ok(o_conv);
31418         return tag_ptr(ret_conv, true);
31419 }
31420
31421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31422         void* e_ptr = untag_ptr(e);
31423         CHECK_ACCESS(e_ptr);
31424         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31425         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31426         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
31427         *ret_conv = CResult_TxSignaturesDecodeErrorZ_err(e_conv);
31428         return tag_ptr(ret_conv, true);
31429 }
31430
31431 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31432         LDKCResult_TxSignaturesDecodeErrorZ* o_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(o);
31433         jboolean ret_conv = CResult_TxSignaturesDecodeErrorZ_is_ok(o_conv);
31434         return ret_conv;
31435 }
31436
31437 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31438         if (!ptr_is_owned(_res)) return;
31439         void* _res_ptr = untag_ptr(_res);
31440         CHECK_ACCESS(_res_ptr);
31441         LDKCResult_TxSignaturesDecodeErrorZ _res_conv = *(LDKCResult_TxSignaturesDecodeErrorZ*)(_res_ptr);
31442         FREE(untag_ptr(_res));
31443         CResult_TxSignaturesDecodeErrorZ_free(_res_conv);
31444 }
31445
31446 static inline uint64_t CResult_TxSignaturesDecodeErrorZ_clone_ptr(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR arg) {
31447         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
31448         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(arg);
31449         return tag_ptr(ret_conv, true);
31450 }
31451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31452         LDKCResult_TxSignaturesDecodeErrorZ* arg_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(arg);
31453         int64_t ret_conv = CResult_TxSignaturesDecodeErrorZ_clone_ptr(arg_conv);
31454         return ret_conv;
31455 }
31456
31457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31458         LDKCResult_TxSignaturesDecodeErrorZ* orig_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(orig);
31459         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
31460         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(orig_conv);
31461         return tag_ptr(ret_conv, true);
31462 }
31463
31464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31465         LDKTxInitRbf o_conv;
31466         o_conv.inner = untag_ptr(o);
31467         o_conv.is_owned = ptr_is_owned(o);
31468         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31469         o_conv = TxInitRbf_clone(&o_conv);
31470         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
31471         *ret_conv = CResult_TxInitRbfDecodeErrorZ_ok(o_conv);
31472         return tag_ptr(ret_conv, true);
31473 }
31474
31475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31476         void* e_ptr = untag_ptr(e);
31477         CHECK_ACCESS(e_ptr);
31478         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31479         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31480         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
31481         *ret_conv = CResult_TxInitRbfDecodeErrorZ_err(e_conv);
31482         return tag_ptr(ret_conv, true);
31483 }
31484
31485 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31486         LDKCResult_TxInitRbfDecodeErrorZ* o_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(o);
31487         jboolean ret_conv = CResult_TxInitRbfDecodeErrorZ_is_ok(o_conv);
31488         return ret_conv;
31489 }
31490
31491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31492         if (!ptr_is_owned(_res)) return;
31493         void* _res_ptr = untag_ptr(_res);
31494         CHECK_ACCESS(_res_ptr);
31495         LDKCResult_TxInitRbfDecodeErrorZ _res_conv = *(LDKCResult_TxInitRbfDecodeErrorZ*)(_res_ptr);
31496         FREE(untag_ptr(_res));
31497         CResult_TxInitRbfDecodeErrorZ_free(_res_conv);
31498 }
31499
31500 static inline uint64_t CResult_TxInitRbfDecodeErrorZ_clone_ptr(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR arg) {
31501         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
31502         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(arg);
31503         return tag_ptr(ret_conv, true);
31504 }
31505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31506         LDKCResult_TxInitRbfDecodeErrorZ* arg_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(arg);
31507         int64_t ret_conv = CResult_TxInitRbfDecodeErrorZ_clone_ptr(arg_conv);
31508         return ret_conv;
31509 }
31510
31511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31512         LDKCResult_TxInitRbfDecodeErrorZ* orig_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(orig);
31513         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
31514         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(orig_conv);
31515         return tag_ptr(ret_conv, true);
31516 }
31517
31518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31519         LDKTxAckRbf o_conv;
31520         o_conv.inner = untag_ptr(o);
31521         o_conv.is_owned = ptr_is_owned(o);
31522         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31523         o_conv = TxAckRbf_clone(&o_conv);
31524         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
31525         *ret_conv = CResult_TxAckRbfDecodeErrorZ_ok(o_conv);
31526         return tag_ptr(ret_conv, true);
31527 }
31528
31529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31530         void* e_ptr = untag_ptr(e);
31531         CHECK_ACCESS(e_ptr);
31532         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31533         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31534         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
31535         *ret_conv = CResult_TxAckRbfDecodeErrorZ_err(e_conv);
31536         return tag_ptr(ret_conv, true);
31537 }
31538
31539 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31540         LDKCResult_TxAckRbfDecodeErrorZ* o_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(o);
31541         jboolean ret_conv = CResult_TxAckRbfDecodeErrorZ_is_ok(o_conv);
31542         return ret_conv;
31543 }
31544
31545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31546         if (!ptr_is_owned(_res)) return;
31547         void* _res_ptr = untag_ptr(_res);
31548         CHECK_ACCESS(_res_ptr);
31549         LDKCResult_TxAckRbfDecodeErrorZ _res_conv = *(LDKCResult_TxAckRbfDecodeErrorZ*)(_res_ptr);
31550         FREE(untag_ptr(_res));
31551         CResult_TxAckRbfDecodeErrorZ_free(_res_conv);
31552 }
31553
31554 static inline uint64_t CResult_TxAckRbfDecodeErrorZ_clone_ptr(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR arg) {
31555         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
31556         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(arg);
31557         return tag_ptr(ret_conv, true);
31558 }
31559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31560         LDKCResult_TxAckRbfDecodeErrorZ* arg_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(arg);
31561         int64_t ret_conv = CResult_TxAckRbfDecodeErrorZ_clone_ptr(arg_conv);
31562         return ret_conv;
31563 }
31564
31565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31566         LDKCResult_TxAckRbfDecodeErrorZ* orig_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(orig);
31567         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
31568         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(orig_conv);
31569         return tag_ptr(ret_conv, true);
31570 }
31571
31572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31573         LDKTxAbort o_conv;
31574         o_conv.inner = untag_ptr(o);
31575         o_conv.is_owned = ptr_is_owned(o);
31576         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31577         o_conv = TxAbort_clone(&o_conv);
31578         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
31579         *ret_conv = CResult_TxAbortDecodeErrorZ_ok(o_conv);
31580         return tag_ptr(ret_conv, true);
31581 }
31582
31583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31584         void* e_ptr = untag_ptr(e);
31585         CHECK_ACCESS(e_ptr);
31586         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31587         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31588         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
31589         *ret_conv = CResult_TxAbortDecodeErrorZ_err(e_conv);
31590         return tag_ptr(ret_conv, true);
31591 }
31592
31593 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31594         LDKCResult_TxAbortDecodeErrorZ* o_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(o);
31595         jboolean ret_conv = CResult_TxAbortDecodeErrorZ_is_ok(o_conv);
31596         return ret_conv;
31597 }
31598
31599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31600         if (!ptr_is_owned(_res)) return;
31601         void* _res_ptr = untag_ptr(_res);
31602         CHECK_ACCESS(_res_ptr);
31603         LDKCResult_TxAbortDecodeErrorZ _res_conv = *(LDKCResult_TxAbortDecodeErrorZ*)(_res_ptr);
31604         FREE(untag_ptr(_res));
31605         CResult_TxAbortDecodeErrorZ_free(_res_conv);
31606 }
31607
31608 static inline uint64_t CResult_TxAbortDecodeErrorZ_clone_ptr(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR arg) {
31609         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
31610         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(arg);
31611         return tag_ptr(ret_conv, true);
31612 }
31613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31614         LDKCResult_TxAbortDecodeErrorZ* arg_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(arg);
31615         int64_t ret_conv = CResult_TxAbortDecodeErrorZ_clone_ptr(arg_conv);
31616         return ret_conv;
31617 }
31618
31619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31620         LDKCResult_TxAbortDecodeErrorZ* orig_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(orig);
31621         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
31622         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(orig_conv);
31623         return tag_ptr(ret_conv, true);
31624 }
31625
31626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31627         LDKAnnouncementSignatures o_conv;
31628         o_conv.inner = untag_ptr(o);
31629         o_conv.is_owned = ptr_is_owned(o);
31630         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31631         o_conv = AnnouncementSignatures_clone(&o_conv);
31632         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
31633         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
31634         return tag_ptr(ret_conv, true);
31635 }
31636
31637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31638         void* e_ptr = untag_ptr(e);
31639         CHECK_ACCESS(e_ptr);
31640         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31641         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31642         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
31643         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
31644         return tag_ptr(ret_conv, true);
31645 }
31646
31647 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31648         LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(o);
31649         jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
31650         return ret_conv;
31651 }
31652
31653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31654         if (!ptr_is_owned(_res)) return;
31655         void* _res_ptr = untag_ptr(_res);
31656         CHECK_ACCESS(_res_ptr);
31657         LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
31658         FREE(untag_ptr(_res));
31659         CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
31660 }
31661
31662 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
31663         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
31664         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
31665         return tag_ptr(ret_conv, true);
31666 }
31667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31668         LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(arg);
31669         int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
31670         return ret_conv;
31671 }
31672
31673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31674         LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(orig);
31675         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
31676         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
31677         return tag_ptr(ret_conv, true);
31678 }
31679
31680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31681         LDKChannelReestablish o_conv;
31682         o_conv.inner = untag_ptr(o);
31683         o_conv.is_owned = ptr_is_owned(o);
31684         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31685         o_conv = ChannelReestablish_clone(&o_conv);
31686         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
31687         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
31688         return tag_ptr(ret_conv, true);
31689 }
31690
31691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31692         void* e_ptr = untag_ptr(e);
31693         CHECK_ACCESS(e_ptr);
31694         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31695         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31696         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
31697         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
31698         return tag_ptr(ret_conv, true);
31699 }
31700
31701 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31702         LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(o);
31703         jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
31704         return ret_conv;
31705 }
31706
31707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31708         if (!ptr_is_owned(_res)) return;
31709         void* _res_ptr = untag_ptr(_res);
31710         CHECK_ACCESS(_res_ptr);
31711         LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
31712         FREE(untag_ptr(_res));
31713         CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
31714 }
31715
31716 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
31717         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
31718         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
31719         return tag_ptr(ret_conv, true);
31720 }
31721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31722         LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(arg);
31723         int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
31724         return ret_conv;
31725 }
31726
31727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31728         LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(orig);
31729         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
31730         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
31731         return tag_ptr(ret_conv, true);
31732 }
31733
31734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31735         LDKClosingSigned o_conv;
31736         o_conv.inner = untag_ptr(o);
31737         o_conv.is_owned = ptr_is_owned(o);
31738         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31739         o_conv = ClosingSigned_clone(&o_conv);
31740         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
31741         *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
31742         return tag_ptr(ret_conv, true);
31743 }
31744
31745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31746         void* e_ptr = untag_ptr(e);
31747         CHECK_ACCESS(e_ptr);
31748         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31749         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31750         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
31751         *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
31752         return tag_ptr(ret_conv, true);
31753 }
31754
31755 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31756         LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(o);
31757         jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
31758         return ret_conv;
31759 }
31760
31761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31762         if (!ptr_is_owned(_res)) return;
31763         void* _res_ptr = untag_ptr(_res);
31764         CHECK_ACCESS(_res_ptr);
31765         LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
31766         FREE(untag_ptr(_res));
31767         CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
31768 }
31769
31770 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
31771         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
31772         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
31773         return tag_ptr(ret_conv, true);
31774 }
31775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31776         LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(arg);
31777         int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
31778         return ret_conv;
31779 }
31780
31781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31782         LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(orig);
31783         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
31784         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
31785         return tag_ptr(ret_conv, true);
31786 }
31787
31788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31789         LDKClosingSignedFeeRange o_conv;
31790         o_conv.inner = untag_ptr(o);
31791         o_conv.is_owned = ptr_is_owned(o);
31792         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31793         o_conv = ClosingSignedFeeRange_clone(&o_conv);
31794         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
31795         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
31796         return tag_ptr(ret_conv, true);
31797 }
31798
31799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31800         void* e_ptr = untag_ptr(e);
31801         CHECK_ACCESS(e_ptr);
31802         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31803         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31804         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
31805         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
31806         return tag_ptr(ret_conv, true);
31807 }
31808
31809 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31810         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(o);
31811         jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
31812         return ret_conv;
31813 }
31814
31815 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31816         if (!ptr_is_owned(_res)) return;
31817         void* _res_ptr = untag_ptr(_res);
31818         CHECK_ACCESS(_res_ptr);
31819         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
31820         FREE(untag_ptr(_res));
31821         CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
31822 }
31823
31824 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
31825         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
31826         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
31827         return tag_ptr(ret_conv, true);
31828 }
31829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31830         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(arg);
31831         int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
31832         return ret_conv;
31833 }
31834
31835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31836         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(orig);
31837         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
31838         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
31839         return tag_ptr(ret_conv, true);
31840 }
31841
31842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31843         LDKCommitmentSigned o_conv;
31844         o_conv.inner = untag_ptr(o);
31845         o_conv.is_owned = ptr_is_owned(o);
31846         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31847         o_conv = CommitmentSigned_clone(&o_conv);
31848         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
31849         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
31850         return tag_ptr(ret_conv, true);
31851 }
31852
31853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31854         void* e_ptr = untag_ptr(e);
31855         CHECK_ACCESS(e_ptr);
31856         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31857         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31858         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
31859         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
31860         return tag_ptr(ret_conv, true);
31861 }
31862
31863 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31864         LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(o);
31865         jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
31866         return ret_conv;
31867 }
31868
31869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31870         if (!ptr_is_owned(_res)) return;
31871         void* _res_ptr = untag_ptr(_res);
31872         CHECK_ACCESS(_res_ptr);
31873         LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
31874         FREE(untag_ptr(_res));
31875         CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
31876 }
31877
31878 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
31879         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
31880         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
31881         return tag_ptr(ret_conv, true);
31882 }
31883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31884         LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(arg);
31885         int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
31886         return ret_conv;
31887 }
31888
31889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31890         LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(orig);
31891         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
31892         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
31893         return tag_ptr(ret_conv, true);
31894 }
31895
31896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31897         LDKFundingCreated o_conv;
31898         o_conv.inner = untag_ptr(o);
31899         o_conv.is_owned = ptr_is_owned(o);
31900         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31901         o_conv = FundingCreated_clone(&o_conv);
31902         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
31903         *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
31904         return tag_ptr(ret_conv, true);
31905 }
31906
31907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31908         void* e_ptr = untag_ptr(e);
31909         CHECK_ACCESS(e_ptr);
31910         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31911         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31912         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
31913         *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
31914         return tag_ptr(ret_conv, true);
31915 }
31916
31917 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31918         LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(o);
31919         jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
31920         return ret_conv;
31921 }
31922
31923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31924         if (!ptr_is_owned(_res)) return;
31925         void* _res_ptr = untag_ptr(_res);
31926         CHECK_ACCESS(_res_ptr);
31927         LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
31928         FREE(untag_ptr(_res));
31929         CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
31930 }
31931
31932 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
31933         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
31934         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
31935         return tag_ptr(ret_conv, true);
31936 }
31937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31938         LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(arg);
31939         int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
31940         return ret_conv;
31941 }
31942
31943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31944         LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(orig);
31945         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
31946         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
31947         return tag_ptr(ret_conv, true);
31948 }
31949
31950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31951         LDKFundingSigned o_conv;
31952         o_conv.inner = untag_ptr(o);
31953         o_conv.is_owned = ptr_is_owned(o);
31954         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31955         o_conv = FundingSigned_clone(&o_conv);
31956         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
31957         *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
31958         return tag_ptr(ret_conv, true);
31959 }
31960
31961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31962         void* e_ptr = untag_ptr(e);
31963         CHECK_ACCESS(e_ptr);
31964         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31965         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31966         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
31967         *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
31968         return tag_ptr(ret_conv, true);
31969 }
31970
31971 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31972         LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(o);
31973         jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
31974         return ret_conv;
31975 }
31976
31977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31978         if (!ptr_is_owned(_res)) return;
31979         void* _res_ptr = untag_ptr(_res);
31980         CHECK_ACCESS(_res_ptr);
31981         LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
31982         FREE(untag_ptr(_res));
31983         CResult_FundingSignedDecodeErrorZ_free(_res_conv);
31984 }
31985
31986 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
31987         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
31988         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
31989         return tag_ptr(ret_conv, true);
31990 }
31991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31992         LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(arg);
31993         int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
31994         return ret_conv;
31995 }
31996
31997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31998         LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(orig);
31999         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
32000         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
32001         return tag_ptr(ret_conv, true);
32002 }
32003
32004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32005         LDKChannelReady o_conv;
32006         o_conv.inner = untag_ptr(o);
32007         o_conv.is_owned = ptr_is_owned(o);
32008         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32009         o_conv = ChannelReady_clone(&o_conv);
32010         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
32011         *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
32012         return tag_ptr(ret_conv, true);
32013 }
32014
32015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32016         void* e_ptr = untag_ptr(e);
32017         CHECK_ACCESS(e_ptr);
32018         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32019         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32020         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
32021         *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
32022         return tag_ptr(ret_conv, true);
32023 }
32024
32025 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32026         LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(o);
32027         jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
32028         return ret_conv;
32029 }
32030
32031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32032         if (!ptr_is_owned(_res)) return;
32033         void* _res_ptr = untag_ptr(_res);
32034         CHECK_ACCESS(_res_ptr);
32035         LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
32036         FREE(untag_ptr(_res));
32037         CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
32038 }
32039
32040 static inline uint64_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
32041         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
32042         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
32043         return tag_ptr(ret_conv, true);
32044 }
32045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32046         LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(arg);
32047         int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
32048         return ret_conv;
32049 }
32050
32051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32052         LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(orig);
32053         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
32054         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
32055         return tag_ptr(ret_conv, true);
32056 }
32057
32058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32059         LDKInit o_conv;
32060         o_conv.inner = untag_ptr(o);
32061         o_conv.is_owned = ptr_is_owned(o);
32062         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32063         o_conv = Init_clone(&o_conv);
32064         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
32065         *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
32066         return tag_ptr(ret_conv, true);
32067 }
32068
32069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32070         void* e_ptr = untag_ptr(e);
32071         CHECK_ACCESS(e_ptr);
32072         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32073         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32074         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
32075         *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
32076         return tag_ptr(ret_conv, true);
32077 }
32078
32079 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32080         LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(o);
32081         jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
32082         return ret_conv;
32083 }
32084
32085 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32086         if (!ptr_is_owned(_res)) return;
32087         void* _res_ptr = untag_ptr(_res);
32088         CHECK_ACCESS(_res_ptr);
32089         LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
32090         FREE(untag_ptr(_res));
32091         CResult_InitDecodeErrorZ_free(_res_conv);
32092 }
32093
32094 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
32095         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
32096         *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
32097         return tag_ptr(ret_conv, true);
32098 }
32099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32100         LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(arg);
32101         int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
32102         return ret_conv;
32103 }
32104
32105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32106         LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(orig);
32107         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
32108         *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
32109         return tag_ptr(ret_conv, true);
32110 }
32111
32112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32113         LDKOpenChannel o_conv;
32114         o_conv.inner = untag_ptr(o);
32115         o_conv.is_owned = ptr_is_owned(o);
32116         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32117         o_conv = OpenChannel_clone(&o_conv);
32118         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
32119         *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
32120         return tag_ptr(ret_conv, true);
32121 }
32122
32123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32124         void* e_ptr = untag_ptr(e);
32125         CHECK_ACCESS(e_ptr);
32126         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32127         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32128         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
32129         *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
32130         return tag_ptr(ret_conv, true);
32131 }
32132
32133 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32134         LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(o);
32135         jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
32136         return ret_conv;
32137 }
32138
32139 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32140         if (!ptr_is_owned(_res)) return;
32141         void* _res_ptr = untag_ptr(_res);
32142         CHECK_ACCESS(_res_ptr);
32143         LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
32144         FREE(untag_ptr(_res));
32145         CResult_OpenChannelDecodeErrorZ_free(_res_conv);
32146 }
32147
32148 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
32149         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
32150         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
32151         return tag_ptr(ret_conv, true);
32152 }
32153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32154         LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(arg);
32155         int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
32156         return ret_conv;
32157 }
32158
32159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32160         LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(orig);
32161         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
32162         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
32163         return tag_ptr(ret_conv, true);
32164 }
32165
32166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32167         LDKOpenChannelV2 o_conv;
32168         o_conv.inner = untag_ptr(o);
32169         o_conv.is_owned = ptr_is_owned(o);
32170         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32171         o_conv = OpenChannelV2_clone(&o_conv);
32172         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
32173         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_ok(o_conv);
32174         return tag_ptr(ret_conv, true);
32175 }
32176
32177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32178         void* e_ptr = untag_ptr(e);
32179         CHECK_ACCESS(e_ptr);
32180         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32181         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32182         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
32183         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_err(e_conv);
32184         return tag_ptr(ret_conv, true);
32185 }
32186
32187 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32188         LDKCResult_OpenChannelV2DecodeErrorZ* o_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(o);
32189         jboolean ret_conv = CResult_OpenChannelV2DecodeErrorZ_is_ok(o_conv);
32190         return ret_conv;
32191 }
32192
32193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32194         if (!ptr_is_owned(_res)) return;
32195         void* _res_ptr = untag_ptr(_res);
32196         CHECK_ACCESS(_res_ptr);
32197         LDKCResult_OpenChannelV2DecodeErrorZ _res_conv = *(LDKCResult_OpenChannelV2DecodeErrorZ*)(_res_ptr);
32198         FREE(untag_ptr(_res));
32199         CResult_OpenChannelV2DecodeErrorZ_free(_res_conv);
32200 }
32201
32202 static inline uint64_t CResult_OpenChannelV2DecodeErrorZ_clone_ptr(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR arg) {
32203         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
32204         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(arg);
32205         return tag_ptr(ret_conv, true);
32206 }
32207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32208         LDKCResult_OpenChannelV2DecodeErrorZ* arg_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(arg);
32209         int64_t ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone_ptr(arg_conv);
32210         return ret_conv;
32211 }
32212
32213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32214         LDKCResult_OpenChannelV2DecodeErrorZ* orig_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(orig);
32215         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
32216         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(orig_conv);
32217         return tag_ptr(ret_conv, true);
32218 }
32219
32220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32221         LDKRevokeAndACK o_conv;
32222         o_conv.inner = untag_ptr(o);
32223         o_conv.is_owned = ptr_is_owned(o);
32224         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32225         o_conv = RevokeAndACK_clone(&o_conv);
32226         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
32227         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
32228         return tag_ptr(ret_conv, true);
32229 }
32230
32231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32232         void* e_ptr = untag_ptr(e);
32233         CHECK_ACCESS(e_ptr);
32234         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32235         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32236         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
32237         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
32238         return tag_ptr(ret_conv, true);
32239 }
32240
32241 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32242         LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(o);
32243         jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
32244         return ret_conv;
32245 }
32246
32247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32248         if (!ptr_is_owned(_res)) return;
32249         void* _res_ptr = untag_ptr(_res);
32250         CHECK_ACCESS(_res_ptr);
32251         LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
32252         FREE(untag_ptr(_res));
32253         CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
32254 }
32255
32256 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
32257         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
32258         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
32259         return tag_ptr(ret_conv, true);
32260 }
32261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32262         LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(arg);
32263         int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
32264         return ret_conv;
32265 }
32266
32267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32268         LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(orig);
32269         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
32270         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
32271         return tag_ptr(ret_conv, true);
32272 }
32273
32274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32275         LDKShutdown o_conv;
32276         o_conv.inner = untag_ptr(o);
32277         o_conv.is_owned = ptr_is_owned(o);
32278         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32279         o_conv = Shutdown_clone(&o_conv);
32280         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
32281         *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
32282         return tag_ptr(ret_conv, true);
32283 }
32284
32285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32286         void* e_ptr = untag_ptr(e);
32287         CHECK_ACCESS(e_ptr);
32288         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32289         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32290         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
32291         *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
32292         return tag_ptr(ret_conv, true);
32293 }
32294
32295 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32296         LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(o);
32297         jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
32298         return ret_conv;
32299 }
32300
32301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32302         if (!ptr_is_owned(_res)) return;
32303         void* _res_ptr = untag_ptr(_res);
32304         CHECK_ACCESS(_res_ptr);
32305         LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
32306         FREE(untag_ptr(_res));
32307         CResult_ShutdownDecodeErrorZ_free(_res_conv);
32308 }
32309
32310 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
32311         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
32312         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
32313         return tag_ptr(ret_conv, true);
32314 }
32315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32316         LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(arg);
32317         int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
32318         return ret_conv;
32319 }
32320
32321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32322         LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(orig);
32323         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
32324         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
32325         return tag_ptr(ret_conv, true);
32326 }
32327
32328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32329         LDKUpdateFailHTLC o_conv;
32330         o_conv.inner = untag_ptr(o);
32331         o_conv.is_owned = ptr_is_owned(o);
32332         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32333         o_conv = UpdateFailHTLC_clone(&o_conv);
32334         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
32335         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
32336         return tag_ptr(ret_conv, true);
32337 }
32338
32339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32340         void* e_ptr = untag_ptr(e);
32341         CHECK_ACCESS(e_ptr);
32342         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32343         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32344         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
32345         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
32346         return tag_ptr(ret_conv, true);
32347 }
32348
32349 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32350         LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(o);
32351         jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
32352         return ret_conv;
32353 }
32354
32355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32356         if (!ptr_is_owned(_res)) return;
32357         void* _res_ptr = untag_ptr(_res);
32358         CHECK_ACCESS(_res_ptr);
32359         LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
32360         FREE(untag_ptr(_res));
32361         CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
32362 }
32363
32364 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
32365         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
32366         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
32367         return tag_ptr(ret_conv, true);
32368 }
32369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32370         LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(arg);
32371         int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
32372         return ret_conv;
32373 }
32374
32375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32376         LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(orig);
32377         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
32378         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
32379         return tag_ptr(ret_conv, true);
32380 }
32381
32382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32383         LDKUpdateFailMalformedHTLC o_conv;
32384         o_conv.inner = untag_ptr(o);
32385         o_conv.is_owned = ptr_is_owned(o);
32386         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32387         o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
32388         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
32389         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
32390         return tag_ptr(ret_conv, true);
32391 }
32392
32393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32394         void* e_ptr = untag_ptr(e);
32395         CHECK_ACCESS(e_ptr);
32396         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32397         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32398         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
32399         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
32400         return tag_ptr(ret_conv, true);
32401 }
32402
32403 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32404         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(o);
32405         jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
32406         return ret_conv;
32407 }
32408
32409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32410         if (!ptr_is_owned(_res)) return;
32411         void* _res_ptr = untag_ptr(_res);
32412         CHECK_ACCESS(_res_ptr);
32413         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
32414         FREE(untag_ptr(_res));
32415         CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
32416 }
32417
32418 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
32419         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
32420         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
32421         return tag_ptr(ret_conv, true);
32422 }
32423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32424         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(arg);
32425         int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
32426         return ret_conv;
32427 }
32428
32429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32430         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(orig);
32431         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
32432         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
32433         return tag_ptr(ret_conv, true);
32434 }
32435
32436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32437         LDKUpdateFee o_conv;
32438         o_conv.inner = untag_ptr(o);
32439         o_conv.is_owned = ptr_is_owned(o);
32440         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32441         o_conv = UpdateFee_clone(&o_conv);
32442         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
32443         *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
32444         return tag_ptr(ret_conv, true);
32445 }
32446
32447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32448         void* e_ptr = untag_ptr(e);
32449         CHECK_ACCESS(e_ptr);
32450         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32451         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32452         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
32453         *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
32454         return tag_ptr(ret_conv, true);
32455 }
32456
32457 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32458         LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(o);
32459         jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
32460         return ret_conv;
32461 }
32462
32463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32464         if (!ptr_is_owned(_res)) return;
32465         void* _res_ptr = untag_ptr(_res);
32466         CHECK_ACCESS(_res_ptr);
32467         LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
32468         FREE(untag_ptr(_res));
32469         CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
32470 }
32471
32472 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
32473         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
32474         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
32475         return tag_ptr(ret_conv, true);
32476 }
32477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32478         LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(arg);
32479         int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
32480         return ret_conv;
32481 }
32482
32483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32484         LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(orig);
32485         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
32486         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
32487         return tag_ptr(ret_conv, true);
32488 }
32489
32490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32491         LDKUpdateFulfillHTLC o_conv;
32492         o_conv.inner = untag_ptr(o);
32493         o_conv.is_owned = ptr_is_owned(o);
32494         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32495         o_conv = UpdateFulfillHTLC_clone(&o_conv);
32496         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
32497         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
32498         return tag_ptr(ret_conv, true);
32499 }
32500
32501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32502         void* e_ptr = untag_ptr(e);
32503         CHECK_ACCESS(e_ptr);
32504         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32505         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32506         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
32507         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
32508         return tag_ptr(ret_conv, true);
32509 }
32510
32511 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32512         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(o);
32513         jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
32514         return ret_conv;
32515 }
32516
32517 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32518         if (!ptr_is_owned(_res)) return;
32519         void* _res_ptr = untag_ptr(_res);
32520         CHECK_ACCESS(_res_ptr);
32521         LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
32522         FREE(untag_ptr(_res));
32523         CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
32524 }
32525
32526 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
32527         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
32528         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
32529         return tag_ptr(ret_conv, true);
32530 }
32531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32532         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(arg);
32533         int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
32534         return ret_conv;
32535 }
32536
32537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32538         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(orig);
32539         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
32540         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
32541         return tag_ptr(ret_conv, true);
32542 }
32543
32544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionPacketDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32545         LDKOnionPacket o_conv;
32546         o_conv.inner = untag_ptr(o);
32547         o_conv.is_owned = ptr_is_owned(o);
32548         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32549         o_conv = OnionPacket_clone(&o_conv);
32550         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
32551         *ret_conv = CResult_OnionPacketDecodeErrorZ_ok(o_conv);
32552         return tag_ptr(ret_conv, true);
32553 }
32554
32555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionPacketDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32556         void* e_ptr = untag_ptr(e);
32557         CHECK_ACCESS(e_ptr);
32558         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32559         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32560         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
32561         *ret_conv = CResult_OnionPacketDecodeErrorZ_err(e_conv);
32562         return tag_ptr(ret_conv, true);
32563 }
32564
32565 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OnionPacketDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32566         LDKCResult_OnionPacketDecodeErrorZ* o_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(o);
32567         jboolean ret_conv = CResult_OnionPacketDecodeErrorZ_is_ok(o_conv);
32568         return ret_conv;
32569 }
32570
32571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OnionPacketDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32572         if (!ptr_is_owned(_res)) return;
32573         void* _res_ptr = untag_ptr(_res);
32574         CHECK_ACCESS(_res_ptr);
32575         LDKCResult_OnionPacketDecodeErrorZ _res_conv = *(LDKCResult_OnionPacketDecodeErrorZ*)(_res_ptr);
32576         FREE(untag_ptr(_res));
32577         CResult_OnionPacketDecodeErrorZ_free(_res_conv);
32578 }
32579
32580 static inline uint64_t CResult_OnionPacketDecodeErrorZ_clone_ptr(LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR arg) {
32581         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
32582         *ret_conv = CResult_OnionPacketDecodeErrorZ_clone(arg);
32583         return tag_ptr(ret_conv, true);
32584 }
32585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionPacketDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32586         LDKCResult_OnionPacketDecodeErrorZ* arg_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(arg);
32587         int64_t ret_conv = CResult_OnionPacketDecodeErrorZ_clone_ptr(arg_conv);
32588         return ret_conv;
32589 }
32590
32591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionPacketDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32592         LDKCResult_OnionPacketDecodeErrorZ* orig_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(orig);
32593         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
32594         *ret_conv = CResult_OnionPacketDecodeErrorZ_clone(orig_conv);
32595         return tag_ptr(ret_conv, true);
32596 }
32597
32598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32599         LDKUpdateAddHTLC o_conv;
32600         o_conv.inner = untag_ptr(o);
32601         o_conv.is_owned = ptr_is_owned(o);
32602         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32603         o_conv = UpdateAddHTLC_clone(&o_conv);
32604         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
32605         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
32606         return tag_ptr(ret_conv, true);
32607 }
32608
32609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32610         void* e_ptr = untag_ptr(e);
32611         CHECK_ACCESS(e_ptr);
32612         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32613         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32614         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
32615         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
32616         return tag_ptr(ret_conv, true);
32617 }
32618
32619 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32620         LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(o);
32621         jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
32622         return ret_conv;
32623 }
32624
32625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32626         if (!ptr_is_owned(_res)) return;
32627         void* _res_ptr = untag_ptr(_res);
32628         CHECK_ACCESS(_res_ptr);
32629         LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
32630         FREE(untag_ptr(_res));
32631         CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
32632 }
32633
32634 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
32635         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
32636         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
32637         return tag_ptr(ret_conv, true);
32638 }
32639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32640         LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(arg);
32641         int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
32642         return ret_conv;
32643 }
32644
32645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32646         LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(orig);
32647         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
32648         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
32649         return tag_ptr(ret_conv, true);
32650 }
32651
32652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32653         LDKOnionMessage o_conv;
32654         o_conv.inner = untag_ptr(o);
32655         o_conv.is_owned = ptr_is_owned(o);
32656         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32657         o_conv = OnionMessage_clone(&o_conv);
32658         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
32659         *ret_conv = CResult_OnionMessageDecodeErrorZ_ok(o_conv);
32660         return tag_ptr(ret_conv, true);
32661 }
32662
32663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32664         void* e_ptr = untag_ptr(e);
32665         CHECK_ACCESS(e_ptr);
32666         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32667         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32668         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
32669         *ret_conv = CResult_OnionMessageDecodeErrorZ_err(e_conv);
32670         return tag_ptr(ret_conv, true);
32671 }
32672
32673 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32674         LDKCResult_OnionMessageDecodeErrorZ* o_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(o);
32675         jboolean ret_conv = CResult_OnionMessageDecodeErrorZ_is_ok(o_conv);
32676         return ret_conv;
32677 }
32678
32679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32680         if (!ptr_is_owned(_res)) return;
32681         void* _res_ptr = untag_ptr(_res);
32682         CHECK_ACCESS(_res_ptr);
32683         LDKCResult_OnionMessageDecodeErrorZ _res_conv = *(LDKCResult_OnionMessageDecodeErrorZ*)(_res_ptr);
32684         FREE(untag_ptr(_res));
32685         CResult_OnionMessageDecodeErrorZ_free(_res_conv);
32686 }
32687
32688 static inline uint64_t CResult_OnionMessageDecodeErrorZ_clone_ptr(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR arg) {
32689         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
32690         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(arg);
32691         return tag_ptr(ret_conv, true);
32692 }
32693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32694         LDKCResult_OnionMessageDecodeErrorZ* arg_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(arg);
32695         int64_t ret_conv = CResult_OnionMessageDecodeErrorZ_clone_ptr(arg_conv);
32696         return ret_conv;
32697 }
32698
32699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32700         LDKCResult_OnionMessageDecodeErrorZ* orig_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(orig);
32701         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
32702         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(orig_conv);
32703         return tag_ptr(ret_conv, true);
32704 }
32705
32706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FinalOnionHopDataDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32707         LDKFinalOnionHopData o_conv;
32708         o_conv.inner = untag_ptr(o);
32709         o_conv.is_owned = ptr_is_owned(o);
32710         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32711         o_conv = FinalOnionHopData_clone(&o_conv);
32712         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
32713         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_ok(o_conv);
32714         return tag_ptr(ret_conv, true);
32715 }
32716
32717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FinalOnionHopDataDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32718         void* e_ptr = untag_ptr(e);
32719         CHECK_ACCESS(e_ptr);
32720         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32721         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32722         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
32723         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_err(e_conv);
32724         return tag_ptr(ret_conv, true);
32725 }
32726
32727 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FinalOnionHopDataDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32728         LDKCResult_FinalOnionHopDataDecodeErrorZ* o_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(o);
32729         jboolean ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_is_ok(o_conv);
32730         return ret_conv;
32731 }
32732
32733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FinalOnionHopDataDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32734         if (!ptr_is_owned(_res)) return;
32735         void* _res_ptr = untag_ptr(_res);
32736         CHECK_ACCESS(_res_ptr);
32737         LDKCResult_FinalOnionHopDataDecodeErrorZ _res_conv = *(LDKCResult_FinalOnionHopDataDecodeErrorZ*)(_res_ptr);
32738         FREE(untag_ptr(_res));
32739         CResult_FinalOnionHopDataDecodeErrorZ_free(_res_conv);
32740 }
32741
32742 static inline uint64_t CResult_FinalOnionHopDataDecodeErrorZ_clone_ptr(LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR arg) {
32743         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
32744         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_clone(arg);
32745         return tag_ptr(ret_conv, true);
32746 }
32747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FinalOnionHopDataDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32748         LDKCResult_FinalOnionHopDataDecodeErrorZ* arg_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(arg);
32749         int64_t ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_clone_ptr(arg_conv);
32750         return ret_conv;
32751 }
32752
32753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FinalOnionHopDataDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32754         LDKCResult_FinalOnionHopDataDecodeErrorZ* orig_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(orig);
32755         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
32756         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_clone(orig_conv);
32757         return tag_ptr(ret_conv, true);
32758 }
32759
32760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32761         LDKPing o_conv;
32762         o_conv.inner = untag_ptr(o);
32763         o_conv.is_owned = ptr_is_owned(o);
32764         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32765         o_conv = Ping_clone(&o_conv);
32766         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
32767         *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
32768         return tag_ptr(ret_conv, true);
32769 }
32770
32771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32772         void* e_ptr = untag_ptr(e);
32773         CHECK_ACCESS(e_ptr);
32774         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32775         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32776         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
32777         *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
32778         return tag_ptr(ret_conv, true);
32779 }
32780
32781 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32782         LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(o);
32783         jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
32784         return ret_conv;
32785 }
32786
32787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32788         if (!ptr_is_owned(_res)) return;
32789         void* _res_ptr = untag_ptr(_res);
32790         CHECK_ACCESS(_res_ptr);
32791         LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
32792         FREE(untag_ptr(_res));
32793         CResult_PingDecodeErrorZ_free(_res_conv);
32794 }
32795
32796 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
32797         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
32798         *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
32799         return tag_ptr(ret_conv, true);
32800 }
32801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32802         LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(arg);
32803         int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
32804         return ret_conv;
32805 }
32806
32807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32808         LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(orig);
32809         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
32810         *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
32811         return tag_ptr(ret_conv, true);
32812 }
32813
32814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32815         LDKPong o_conv;
32816         o_conv.inner = untag_ptr(o);
32817         o_conv.is_owned = ptr_is_owned(o);
32818         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32819         o_conv = Pong_clone(&o_conv);
32820         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
32821         *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
32822         return tag_ptr(ret_conv, true);
32823 }
32824
32825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32826         void* e_ptr = untag_ptr(e);
32827         CHECK_ACCESS(e_ptr);
32828         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32829         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32830         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
32831         *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
32832         return tag_ptr(ret_conv, true);
32833 }
32834
32835 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32836         LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(o);
32837         jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
32838         return ret_conv;
32839 }
32840
32841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32842         if (!ptr_is_owned(_res)) return;
32843         void* _res_ptr = untag_ptr(_res);
32844         CHECK_ACCESS(_res_ptr);
32845         LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
32846         FREE(untag_ptr(_res));
32847         CResult_PongDecodeErrorZ_free(_res_conv);
32848 }
32849
32850 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
32851         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
32852         *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
32853         return tag_ptr(ret_conv, true);
32854 }
32855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32856         LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(arg);
32857         int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
32858         return ret_conv;
32859 }
32860
32861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32862         LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(orig);
32863         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
32864         *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
32865         return tag_ptr(ret_conv, true);
32866 }
32867
32868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32869         LDKUnsignedChannelAnnouncement o_conv;
32870         o_conv.inner = untag_ptr(o);
32871         o_conv.is_owned = ptr_is_owned(o);
32872         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32873         o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
32874         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
32875         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
32876         return tag_ptr(ret_conv, true);
32877 }
32878
32879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32880         void* e_ptr = untag_ptr(e);
32881         CHECK_ACCESS(e_ptr);
32882         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32883         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32884         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
32885         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
32886         return tag_ptr(ret_conv, true);
32887 }
32888
32889 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32890         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
32891         jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
32892         return ret_conv;
32893 }
32894
32895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32896         if (!ptr_is_owned(_res)) return;
32897         void* _res_ptr = untag_ptr(_res);
32898         CHECK_ACCESS(_res_ptr);
32899         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
32900         FREE(untag_ptr(_res));
32901         CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
32902 }
32903
32904 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
32905         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
32906         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
32907         return tag_ptr(ret_conv, true);
32908 }
32909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32910         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
32911         int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
32912         return ret_conv;
32913 }
32914
32915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32916         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
32917         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
32918         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
32919         return tag_ptr(ret_conv, true);
32920 }
32921
32922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32923         LDKChannelAnnouncement o_conv;
32924         o_conv.inner = untag_ptr(o);
32925         o_conv.is_owned = ptr_is_owned(o);
32926         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32927         o_conv = ChannelAnnouncement_clone(&o_conv);
32928         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
32929         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
32930         return tag_ptr(ret_conv, true);
32931 }
32932
32933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32934         void* e_ptr = untag_ptr(e);
32935         CHECK_ACCESS(e_ptr);
32936         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32937         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32938         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
32939         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
32940         return tag_ptr(ret_conv, true);
32941 }
32942
32943 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32944         LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
32945         jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
32946         return ret_conv;
32947 }
32948
32949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32950         if (!ptr_is_owned(_res)) return;
32951         void* _res_ptr = untag_ptr(_res);
32952         CHECK_ACCESS(_res_ptr);
32953         LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
32954         FREE(untag_ptr(_res));
32955         CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
32956 }
32957
32958 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
32959         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
32960         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
32961         return tag_ptr(ret_conv, true);
32962 }
32963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32964         LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
32965         int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
32966         return ret_conv;
32967 }
32968
32969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32970         LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
32971         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
32972         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
32973         return tag_ptr(ret_conv, true);
32974 }
32975
32976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32977         LDKUnsignedChannelUpdate o_conv;
32978         o_conv.inner = untag_ptr(o);
32979         o_conv.is_owned = ptr_is_owned(o);
32980         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32981         o_conv = UnsignedChannelUpdate_clone(&o_conv);
32982         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
32983         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
32984         return tag_ptr(ret_conv, true);
32985 }
32986
32987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32988         void* e_ptr = untag_ptr(e);
32989         CHECK_ACCESS(e_ptr);
32990         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32991         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32992         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
32993         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
32994         return tag_ptr(ret_conv, true);
32995 }
32996
32997 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32998         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(o);
32999         jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
33000         return ret_conv;
33001 }
33002
33003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33004         if (!ptr_is_owned(_res)) return;
33005         void* _res_ptr = untag_ptr(_res);
33006         CHECK_ACCESS(_res_ptr);
33007         LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
33008         FREE(untag_ptr(_res));
33009         CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
33010 }
33011
33012 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
33013         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
33014         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
33015         return tag_ptr(ret_conv, true);
33016 }
33017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33018         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(arg);
33019         int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
33020         return ret_conv;
33021 }
33022
33023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33024         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(orig);
33025         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
33026         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
33027         return tag_ptr(ret_conv, true);
33028 }
33029
33030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33031         LDKChannelUpdate o_conv;
33032         o_conv.inner = untag_ptr(o);
33033         o_conv.is_owned = ptr_is_owned(o);
33034         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33035         o_conv = ChannelUpdate_clone(&o_conv);
33036         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
33037         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
33038         return tag_ptr(ret_conv, true);
33039 }
33040
33041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33042         void* e_ptr = untag_ptr(e);
33043         CHECK_ACCESS(e_ptr);
33044         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33045         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33046         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
33047         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
33048         return tag_ptr(ret_conv, true);
33049 }
33050
33051 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33052         LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(o);
33053         jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
33054         return ret_conv;
33055 }
33056
33057 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33058         if (!ptr_is_owned(_res)) return;
33059         void* _res_ptr = untag_ptr(_res);
33060         CHECK_ACCESS(_res_ptr);
33061         LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
33062         FREE(untag_ptr(_res));
33063         CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
33064 }
33065
33066 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
33067         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
33068         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
33069         return tag_ptr(ret_conv, true);
33070 }
33071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33072         LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(arg);
33073         int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
33074         return ret_conv;
33075 }
33076
33077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33078         LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(orig);
33079         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
33080         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
33081         return tag_ptr(ret_conv, true);
33082 }
33083
33084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33085         LDKErrorMessage o_conv;
33086         o_conv.inner = untag_ptr(o);
33087         o_conv.is_owned = ptr_is_owned(o);
33088         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33089         o_conv = ErrorMessage_clone(&o_conv);
33090         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
33091         *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
33092         return tag_ptr(ret_conv, true);
33093 }
33094
33095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33096         void* e_ptr = untag_ptr(e);
33097         CHECK_ACCESS(e_ptr);
33098         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33099         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33100         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
33101         *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
33102         return tag_ptr(ret_conv, true);
33103 }
33104
33105 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33106         LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(o);
33107         jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
33108         return ret_conv;
33109 }
33110
33111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33112         if (!ptr_is_owned(_res)) return;
33113         void* _res_ptr = untag_ptr(_res);
33114         CHECK_ACCESS(_res_ptr);
33115         LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
33116         FREE(untag_ptr(_res));
33117         CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
33118 }
33119
33120 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
33121         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
33122         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
33123         return tag_ptr(ret_conv, true);
33124 }
33125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33126         LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(arg);
33127         int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
33128         return ret_conv;
33129 }
33130
33131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33132         LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(orig);
33133         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
33134         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
33135         return tag_ptr(ret_conv, true);
33136 }
33137
33138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33139         LDKWarningMessage o_conv;
33140         o_conv.inner = untag_ptr(o);
33141         o_conv.is_owned = ptr_is_owned(o);
33142         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33143         o_conv = WarningMessage_clone(&o_conv);
33144         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
33145         *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
33146         return tag_ptr(ret_conv, true);
33147 }
33148
33149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33150         void* e_ptr = untag_ptr(e);
33151         CHECK_ACCESS(e_ptr);
33152         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33153         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33154         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
33155         *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
33156         return tag_ptr(ret_conv, true);
33157 }
33158
33159 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33160         LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(o);
33161         jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
33162         return ret_conv;
33163 }
33164
33165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33166         if (!ptr_is_owned(_res)) return;
33167         void* _res_ptr = untag_ptr(_res);
33168         CHECK_ACCESS(_res_ptr);
33169         LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
33170         FREE(untag_ptr(_res));
33171         CResult_WarningMessageDecodeErrorZ_free(_res_conv);
33172 }
33173
33174 static inline uint64_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
33175         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
33176         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
33177         return tag_ptr(ret_conv, true);
33178 }
33179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33180         LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(arg);
33181         int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
33182         return ret_conv;
33183 }
33184
33185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33186         LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(orig);
33187         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
33188         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
33189         return tag_ptr(ret_conv, true);
33190 }
33191
33192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33193         LDKUnsignedNodeAnnouncement o_conv;
33194         o_conv.inner = untag_ptr(o);
33195         o_conv.is_owned = ptr_is_owned(o);
33196         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33197         o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
33198         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
33199         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
33200         return tag_ptr(ret_conv, true);
33201 }
33202
33203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33204         void* e_ptr = untag_ptr(e);
33205         CHECK_ACCESS(e_ptr);
33206         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33207         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33208         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
33209         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
33210         return tag_ptr(ret_conv, true);
33211 }
33212
33213 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33214         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(o);
33215         jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
33216         return ret_conv;
33217 }
33218
33219 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33220         if (!ptr_is_owned(_res)) return;
33221         void* _res_ptr = untag_ptr(_res);
33222         CHECK_ACCESS(_res_ptr);
33223         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
33224         FREE(untag_ptr(_res));
33225         CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
33226 }
33227
33228 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
33229         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
33230         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
33231         return tag_ptr(ret_conv, true);
33232 }
33233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33234         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
33235         int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
33236         return ret_conv;
33237 }
33238
33239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33240         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
33241         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
33242         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
33243         return tag_ptr(ret_conv, true);
33244 }
33245
33246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33247         LDKNodeAnnouncement o_conv;
33248         o_conv.inner = untag_ptr(o);
33249         o_conv.is_owned = ptr_is_owned(o);
33250         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33251         o_conv = NodeAnnouncement_clone(&o_conv);
33252         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
33253         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
33254         return tag_ptr(ret_conv, true);
33255 }
33256
33257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33258         void* e_ptr = untag_ptr(e);
33259         CHECK_ACCESS(e_ptr);
33260         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33261         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33262         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
33263         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
33264         return tag_ptr(ret_conv, true);
33265 }
33266
33267 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33268         LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(o);
33269         jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
33270         return ret_conv;
33271 }
33272
33273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33274         if (!ptr_is_owned(_res)) return;
33275         void* _res_ptr = untag_ptr(_res);
33276         CHECK_ACCESS(_res_ptr);
33277         LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
33278         FREE(untag_ptr(_res));
33279         CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
33280 }
33281
33282 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
33283         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
33284         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
33285         return tag_ptr(ret_conv, true);
33286 }
33287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33288         LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
33289         int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
33290         return ret_conv;
33291 }
33292
33293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33294         LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
33295         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
33296         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
33297         return tag_ptr(ret_conv, true);
33298 }
33299
33300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33301         LDKQueryShortChannelIds o_conv;
33302         o_conv.inner = untag_ptr(o);
33303         o_conv.is_owned = ptr_is_owned(o);
33304         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33305         o_conv = QueryShortChannelIds_clone(&o_conv);
33306         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
33307         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
33308         return tag_ptr(ret_conv, true);
33309 }
33310
33311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33312         void* e_ptr = untag_ptr(e);
33313         CHECK_ACCESS(e_ptr);
33314         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33315         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33316         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
33317         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
33318         return tag_ptr(ret_conv, true);
33319 }
33320
33321 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33322         LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(o);
33323         jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
33324         return ret_conv;
33325 }
33326
33327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33328         if (!ptr_is_owned(_res)) return;
33329         void* _res_ptr = untag_ptr(_res);
33330         CHECK_ACCESS(_res_ptr);
33331         LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
33332         FREE(untag_ptr(_res));
33333         CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
33334 }
33335
33336 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
33337         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
33338         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
33339         return tag_ptr(ret_conv, true);
33340 }
33341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33342         LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(arg);
33343         int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
33344         return ret_conv;
33345 }
33346
33347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33348         LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(orig);
33349         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
33350         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
33351         return tag_ptr(ret_conv, true);
33352 }
33353
33354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33355         LDKReplyShortChannelIdsEnd o_conv;
33356         o_conv.inner = untag_ptr(o);
33357         o_conv.is_owned = ptr_is_owned(o);
33358         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33359         o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
33360         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
33361         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
33362         return tag_ptr(ret_conv, true);
33363 }
33364
33365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33366         void* e_ptr = untag_ptr(e);
33367         CHECK_ACCESS(e_ptr);
33368         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33369         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33370         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
33371         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
33372         return tag_ptr(ret_conv, true);
33373 }
33374
33375 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33376         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(o);
33377         jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
33378         return ret_conv;
33379 }
33380
33381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33382         if (!ptr_is_owned(_res)) return;
33383         void* _res_ptr = untag_ptr(_res);
33384         CHECK_ACCESS(_res_ptr);
33385         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
33386         FREE(untag_ptr(_res));
33387         CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
33388 }
33389
33390 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
33391         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
33392         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
33393         return tag_ptr(ret_conv, true);
33394 }
33395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33396         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(arg);
33397         int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
33398         return ret_conv;
33399 }
33400
33401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33402         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(orig);
33403         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
33404         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
33405         return tag_ptr(ret_conv, true);
33406 }
33407
33408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33409         LDKQueryChannelRange o_conv;
33410         o_conv.inner = untag_ptr(o);
33411         o_conv.is_owned = ptr_is_owned(o);
33412         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33413         o_conv = QueryChannelRange_clone(&o_conv);
33414         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
33415         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
33416         return tag_ptr(ret_conv, true);
33417 }
33418
33419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33420         void* e_ptr = untag_ptr(e);
33421         CHECK_ACCESS(e_ptr);
33422         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33423         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33424         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
33425         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
33426         return tag_ptr(ret_conv, true);
33427 }
33428
33429 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33430         LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(o);
33431         jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
33432         return ret_conv;
33433 }
33434
33435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33436         if (!ptr_is_owned(_res)) return;
33437         void* _res_ptr = untag_ptr(_res);
33438         CHECK_ACCESS(_res_ptr);
33439         LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
33440         FREE(untag_ptr(_res));
33441         CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
33442 }
33443
33444 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
33445         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
33446         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
33447         return tag_ptr(ret_conv, true);
33448 }
33449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33450         LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(arg);
33451         int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
33452         return ret_conv;
33453 }
33454
33455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33456         LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(orig);
33457         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
33458         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
33459         return tag_ptr(ret_conv, true);
33460 }
33461
33462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33463         LDKReplyChannelRange o_conv;
33464         o_conv.inner = untag_ptr(o);
33465         o_conv.is_owned = ptr_is_owned(o);
33466         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33467         o_conv = ReplyChannelRange_clone(&o_conv);
33468         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
33469         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
33470         return tag_ptr(ret_conv, true);
33471 }
33472
33473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33474         void* e_ptr = untag_ptr(e);
33475         CHECK_ACCESS(e_ptr);
33476         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33477         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33478         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
33479         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
33480         return tag_ptr(ret_conv, true);
33481 }
33482
33483 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33484         LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(o);
33485         jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
33486         return ret_conv;
33487 }
33488
33489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33490         if (!ptr_is_owned(_res)) return;
33491         void* _res_ptr = untag_ptr(_res);
33492         CHECK_ACCESS(_res_ptr);
33493         LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
33494         FREE(untag_ptr(_res));
33495         CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
33496 }
33497
33498 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
33499         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
33500         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
33501         return tag_ptr(ret_conv, true);
33502 }
33503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33504         LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(arg);
33505         int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
33506         return ret_conv;
33507 }
33508
33509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33510         LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(orig);
33511         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
33512         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
33513         return tag_ptr(ret_conv, true);
33514 }
33515
33516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33517         LDKGossipTimestampFilter o_conv;
33518         o_conv.inner = untag_ptr(o);
33519         o_conv.is_owned = ptr_is_owned(o);
33520         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33521         o_conv = GossipTimestampFilter_clone(&o_conv);
33522         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
33523         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
33524         return tag_ptr(ret_conv, true);
33525 }
33526
33527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33528         void* e_ptr = untag_ptr(e);
33529         CHECK_ACCESS(e_ptr);
33530         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33531         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33532         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
33533         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
33534         return tag_ptr(ret_conv, true);
33535 }
33536
33537 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33538         LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(o);
33539         jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
33540         return ret_conv;
33541 }
33542
33543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33544         if (!ptr_is_owned(_res)) return;
33545         void* _res_ptr = untag_ptr(_res);
33546         CHECK_ACCESS(_res_ptr);
33547         LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
33548         FREE(untag_ptr(_res));
33549         CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
33550 }
33551
33552 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
33553         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
33554         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
33555         return tag_ptr(ret_conv, true);
33556 }
33557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33558         LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(arg);
33559         int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
33560         return ret_conv;
33561 }
33562
33563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33564         LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(orig);
33565         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
33566         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
33567         return tag_ptr(ret_conv, true);
33568 }
33569
33570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PhantomRouteHintsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
33571         LDKCVec_PhantomRouteHintsZ _res_constr;
33572         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
33573         if (_res_constr.datalen > 0)
33574                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
33575         else
33576                 _res_constr.data = NULL;
33577         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
33578         for (size_t t = 0; t < _res_constr.datalen; t++) {
33579                 int64_t _res_conv_19 = _res_vals[t];
33580                 LDKPhantomRouteHints _res_conv_19_conv;
33581                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
33582                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
33583                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
33584                 _res_constr.data[t] = _res_conv_19_conv;
33585         }
33586         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
33587         CVec_PhantomRouteHintsZ_free(_res_constr);
33588 }
33589
33590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33591         LDKBolt11Invoice o_conv;
33592         o_conv.inner = untag_ptr(o);
33593         o_conv.is_owned = ptr_is_owned(o);
33594         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33595         o_conv = Bolt11Invoice_clone(&o_conv);
33596         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
33597         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(o_conv);
33598         return tag_ptr(ret_conv, true);
33599 }
33600
33601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33602         void* e_ptr = untag_ptr(e);
33603         CHECK_ACCESS(e_ptr);
33604         LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
33605         e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)untag_ptr(e));
33606         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
33607         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e_conv);
33608         return tag_ptr(ret_conv, true);
33609 }
33610
33611 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33612         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(o);
33613         jboolean ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(o_conv);
33614         return ret_conv;
33615 }
33616
33617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33618         if (!ptr_is_owned(_res)) return;
33619         void* _res_ptr = untag_ptr(_res);
33620         CHECK_ACCESS(_res_ptr);
33621         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)(_res_ptr);
33622         FREE(untag_ptr(_res));
33623         CResult_Bolt11InvoiceSignOrCreationErrorZ_free(_res_conv);
33624 }
33625
33626 static inline uint64_t CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
33627         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
33628         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(arg);
33629         return tag_ptr(ret_conv, true);
33630 }
33631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33632         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(arg);
33633         int64_t ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
33634         return ret_conv;
33635 }
33636
33637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33638         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(orig);
33639         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
33640         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(orig_conv);
33641         return tag_ptr(ret_conv, true);
33642 }
33643
33644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1FutureZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
33645         LDKCVec_FutureZ _res_constr;
33646         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
33647         if (_res_constr.datalen > 0)
33648                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKFuture), "LDKCVec_FutureZ Elements");
33649         else
33650                 _res_constr.data = NULL;
33651         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
33652         for (size_t i = 0; i < _res_constr.datalen; i++) {
33653                 int64_t _res_conv_8 = _res_vals[i];
33654                 LDKFuture _res_conv_8_conv;
33655                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
33656                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
33657                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
33658                 _res_constr.data[i] = _res_conv_8_conv;
33659         }
33660         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
33661         CVec_FutureZ_free(_res_constr);
33662 }
33663
33664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33665         void* o_ptr = untag_ptr(o);
33666         CHECK_ACCESS(o_ptr);
33667         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
33668         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
33669         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
33670         *ret_conv = CResult_OffersMessageDecodeErrorZ_ok(o_conv);
33671         return tag_ptr(ret_conv, true);
33672 }
33673
33674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33675         void* e_ptr = untag_ptr(e);
33676         CHECK_ACCESS(e_ptr);
33677         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33678         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33679         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
33680         *ret_conv = CResult_OffersMessageDecodeErrorZ_err(e_conv);
33681         return tag_ptr(ret_conv, true);
33682 }
33683
33684 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33685         LDKCResult_OffersMessageDecodeErrorZ* o_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(o);
33686         jboolean ret_conv = CResult_OffersMessageDecodeErrorZ_is_ok(o_conv);
33687         return ret_conv;
33688 }
33689
33690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33691         if (!ptr_is_owned(_res)) return;
33692         void* _res_ptr = untag_ptr(_res);
33693         CHECK_ACCESS(_res_ptr);
33694         LDKCResult_OffersMessageDecodeErrorZ _res_conv = *(LDKCResult_OffersMessageDecodeErrorZ*)(_res_ptr);
33695         FREE(untag_ptr(_res));
33696         CResult_OffersMessageDecodeErrorZ_free(_res_conv);
33697 }
33698
33699 static inline uint64_t CResult_OffersMessageDecodeErrorZ_clone_ptr(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR arg) {
33700         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
33701         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(arg);
33702         return tag_ptr(ret_conv, true);
33703 }
33704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33705         LDKCResult_OffersMessageDecodeErrorZ* arg_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(arg);
33706         int64_t ret_conv = CResult_OffersMessageDecodeErrorZ_clone_ptr(arg_conv);
33707         return ret_conv;
33708 }
33709
33710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33711         LDKCResult_OffersMessageDecodeErrorZ* orig_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(orig);
33712         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
33713         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(orig_conv);
33714         return tag_ptr(ret_conv, true);
33715 }
33716
33717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCClaimZ_1some(JNIEnv *env, jclass clz, jclass o) {
33718         LDKHTLCClaim o_conv = LDKHTLCClaim_from_java(env, o);
33719         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
33720         *ret_copy = COption_HTLCClaimZ_some(o_conv);
33721         int64_t ret_ref = tag_ptr(ret_copy, true);
33722         return ret_ref;
33723 }
33724
33725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCClaimZ_1none(JNIEnv *env, jclass clz) {
33726         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
33727         *ret_copy = COption_HTLCClaimZ_none();
33728         int64_t ret_ref = tag_ptr(ret_copy, true);
33729         return ret_ref;
33730 }
33731
33732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1HTLCClaimZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33733         if (!ptr_is_owned(_res)) return;
33734         void* _res_ptr = untag_ptr(_res);
33735         CHECK_ACCESS(_res_ptr);
33736         LDKCOption_HTLCClaimZ _res_conv = *(LDKCOption_HTLCClaimZ*)(_res_ptr);
33737         FREE(untag_ptr(_res));
33738         COption_HTLCClaimZ_free(_res_conv);
33739 }
33740
33741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33742         LDKCounterpartyCommitmentSecrets o_conv;
33743         o_conv.inner = untag_ptr(o);
33744         o_conv.is_owned = ptr_is_owned(o);
33745         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33746         o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
33747         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
33748         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
33749         return tag_ptr(ret_conv, true);
33750 }
33751
33752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33753         void* e_ptr = untag_ptr(e);
33754         CHECK_ACCESS(e_ptr);
33755         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33756         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33757         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
33758         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
33759         return tag_ptr(ret_conv, true);
33760 }
33761
33762 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33763         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(o);
33764         jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
33765         return ret_conv;
33766 }
33767
33768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33769         if (!ptr_is_owned(_res)) return;
33770         void* _res_ptr = untag_ptr(_res);
33771         CHECK_ACCESS(_res_ptr);
33772         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
33773         FREE(untag_ptr(_res));
33774         CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
33775 }
33776
33777 static inline uint64_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
33778         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
33779         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
33780         return tag_ptr(ret_conv, true);
33781 }
33782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33783         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(arg);
33784         int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
33785         return ret_conv;
33786 }
33787
33788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33789         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(orig);
33790         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
33791         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
33792         return tag_ptr(ret_conv, true);
33793 }
33794
33795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33796         LDKTxCreationKeys o_conv;
33797         o_conv.inner = untag_ptr(o);
33798         o_conv.is_owned = ptr_is_owned(o);
33799         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33800         o_conv = TxCreationKeys_clone(&o_conv);
33801         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
33802         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
33803         return tag_ptr(ret_conv, true);
33804 }
33805
33806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33807         void* e_ptr = untag_ptr(e);
33808         CHECK_ACCESS(e_ptr);
33809         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33810         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33811         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
33812         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
33813         return tag_ptr(ret_conv, true);
33814 }
33815
33816 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33817         LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(o);
33818         jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
33819         return ret_conv;
33820 }
33821
33822 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33823         if (!ptr_is_owned(_res)) return;
33824         void* _res_ptr = untag_ptr(_res);
33825         CHECK_ACCESS(_res_ptr);
33826         LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
33827         FREE(untag_ptr(_res));
33828         CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
33829 }
33830
33831 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
33832         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
33833         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
33834         return tag_ptr(ret_conv, true);
33835 }
33836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33837         LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(arg);
33838         int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
33839         return ret_conv;
33840 }
33841
33842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33843         LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(orig);
33844         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
33845         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
33846         return tag_ptr(ret_conv, true);
33847 }
33848
33849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33850         LDKChannelPublicKeys o_conv;
33851         o_conv.inner = untag_ptr(o);
33852         o_conv.is_owned = ptr_is_owned(o);
33853         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33854         o_conv = ChannelPublicKeys_clone(&o_conv);
33855         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
33856         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
33857         return tag_ptr(ret_conv, true);
33858 }
33859
33860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33861         void* e_ptr = untag_ptr(e);
33862         CHECK_ACCESS(e_ptr);
33863         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33864         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33865         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
33866         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
33867         return tag_ptr(ret_conv, true);
33868 }
33869
33870 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33871         LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(o);
33872         jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
33873         return ret_conv;
33874 }
33875
33876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33877         if (!ptr_is_owned(_res)) return;
33878         void* _res_ptr = untag_ptr(_res);
33879         CHECK_ACCESS(_res_ptr);
33880         LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
33881         FREE(untag_ptr(_res));
33882         CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
33883 }
33884
33885 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
33886         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
33887         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
33888         return tag_ptr(ret_conv, true);
33889 }
33890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33891         LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(arg);
33892         int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
33893         return ret_conv;
33894 }
33895
33896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33897         LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(orig);
33898         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
33899         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
33900         return tag_ptr(ret_conv, true);
33901 }
33902
33903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33904         LDKHTLCOutputInCommitment o_conv;
33905         o_conv.inner = untag_ptr(o);
33906         o_conv.is_owned = ptr_is_owned(o);
33907         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33908         o_conv = HTLCOutputInCommitment_clone(&o_conv);
33909         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
33910         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
33911         return tag_ptr(ret_conv, true);
33912 }
33913
33914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33915         void* e_ptr = untag_ptr(e);
33916         CHECK_ACCESS(e_ptr);
33917         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33918         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33919         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
33920         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
33921         return tag_ptr(ret_conv, true);
33922 }
33923
33924 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33925         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(o);
33926         jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
33927         return ret_conv;
33928 }
33929
33930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33931         if (!ptr_is_owned(_res)) return;
33932         void* _res_ptr = untag_ptr(_res);
33933         CHECK_ACCESS(_res_ptr);
33934         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
33935         FREE(untag_ptr(_res));
33936         CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
33937 }
33938
33939 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
33940         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
33941         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
33942         return tag_ptr(ret_conv, true);
33943 }
33944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33945         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(arg);
33946         int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
33947         return ret_conv;
33948 }
33949
33950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33951         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(orig);
33952         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
33953         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
33954         return tag_ptr(ret_conv, true);
33955 }
33956
33957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33958         LDKCounterpartyChannelTransactionParameters o_conv;
33959         o_conv.inner = untag_ptr(o);
33960         o_conv.is_owned = ptr_is_owned(o);
33961         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33962         o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
33963         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
33964         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
33965         return tag_ptr(ret_conv, true);
33966 }
33967
33968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33969         void* e_ptr = untag_ptr(e);
33970         CHECK_ACCESS(e_ptr);
33971         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33972         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33973         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
33974         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
33975         return tag_ptr(ret_conv, true);
33976 }
33977
33978 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33979         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
33980         jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
33981         return ret_conv;
33982 }
33983
33984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33985         if (!ptr_is_owned(_res)) return;
33986         void* _res_ptr = untag_ptr(_res);
33987         CHECK_ACCESS(_res_ptr);
33988         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
33989         FREE(untag_ptr(_res));
33990         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
33991 }
33992
33993 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
33994         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
33995         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
33996         return tag_ptr(ret_conv, true);
33997 }
33998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33999         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
34000         int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
34001         return ret_conv;
34002 }
34003
34004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34005         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
34006         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
34007         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
34008         return tag_ptr(ret_conv, true);
34009 }
34010
34011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34012         LDKChannelTransactionParameters o_conv;
34013         o_conv.inner = untag_ptr(o);
34014         o_conv.is_owned = ptr_is_owned(o);
34015         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34016         o_conv = ChannelTransactionParameters_clone(&o_conv);
34017         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
34018         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
34019         return tag_ptr(ret_conv, true);
34020 }
34021
34022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34023         void* e_ptr = untag_ptr(e);
34024         CHECK_ACCESS(e_ptr);
34025         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34026         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34027         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
34028         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
34029         return tag_ptr(ret_conv, true);
34030 }
34031
34032 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34033         LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
34034         jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
34035         return ret_conv;
34036 }
34037
34038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34039         if (!ptr_is_owned(_res)) return;
34040         void* _res_ptr = untag_ptr(_res);
34041         CHECK_ACCESS(_res_ptr);
34042         LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
34043         FREE(untag_ptr(_res));
34044         CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
34045 }
34046
34047 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
34048         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
34049         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
34050         return tag_ptr(ret_conv, true);
34051 }
34052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34053         LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
34054         int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
34055         return ret_conv;
34056 }
34057
34058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34059         LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
34060         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
34061         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
34062         return tag_ptr(ret_conv, true);
34063 }
34064
34065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34066         LDKHolderCommitmentTransaction o_conv;
34067         o_conv.inner = untag_ptr(o);
34068         o_conv.is_owned = ptr_is_owned(o);
34069         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34070         o_conv = HolderCommitmentTransaction_clone(&o_conv);
34071         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
34072         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
34073         return tag_ptr(ret_conv, true);
34074 }
34075
34076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34077         void* e_ptr = untag_ptr(e);
34078         CHECK_ACCESS(e_ptr);
34079         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34080         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34081         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
34082         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
34083         return tag_ptr(ret_conv, true);
34084 }
34085
34086 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34087         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
34088         jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
34089         return ret_conv;
34090 }
34091
34092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34093         if (!ptr_is_owned(_res)) return;
34094         void* _res_ptr = untag_ptr(_res);
34095         CHECK_ACCESS(_res_ptr);
34096         LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
34097         FREE(untag_ptr(_res));
34098         CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
34099 }
34100
34101 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
34102         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
34103         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
34104         return tag_ptr(ret_conv, true);
34105 }
34106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34107         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
34108         int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
34109         return ret_conv;
34110 }
34111
34112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34113         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
34114         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
34115         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
34116         return tag_ptr(ret_conv, true);
34117 }
34118
34119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34120         LDKBuiltCommitmentTransaction o_conv;
34121         o_conv.inner = untag_ptr(o);
34122         o_conv.is_owned = ptr_is_owned(o);
34123         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34124         o_conv = BuiltCommitmentTransaction_clone(&o_conv);
34125         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
34126         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
34127         return tag_ptr(ret_conv, true);
34128 }
34129
34130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34131         void* e_ptr = untag_ptr(e);
34132         CHECK_ACCESS(e_ptr);
34133         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34134         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34135         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
34136         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
34137         return tag_ptr(ret_conv, true);
34138 }
34139
34140 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34141         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
34142         jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
34143         return ret_conv;
34144 }
34145
34146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34147         if (!ptr_is_owned(_res)) return;
34148         void* _res_ptr = untag_ptr(_res);
34149         CHECK_ACCESS(_res_ptr);
34150         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
34151         FREE(untag_ptr(_res));
34152         CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
34153 }
34154
34155 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
34156         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
34157         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
34158         return tag_ptr(ret_conv, true);
34159 }
34160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34161         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
34162         int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
34163         return ret_conv;
34164 }
34165
34166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34167         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
34168         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
34169         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
34170         return tag_ptr(ret_conv, true);
34171 }
34172
34173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34174         LDKTrustedClosingTransaction o_conv;
34175         o_conv.inner = untag_ptr(o);
34176         o_conv.is_owned = ptr_is_owned(o);
34177         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34178         // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
34179         
34180         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
34181         *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
34182         return tag_ptr(ret_conv, true);
34183 }
34184
34185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
34186         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
34187         *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
34188         return tag_ptr(ret_conv, true);
34189 }
34190
34191 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34192         LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(o);
34193         jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
34194         return ret_conv;
34195 }
34196
34197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34198         if (!ptr_is_owned(_res)) return;
34199         void* _res_ptr = untag_ptr(_res);
34200         CHECK_ACCESS(_res_ptr);
34201         LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
34202         FREE(untag_ptr(_res));
34203         CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
34204 }
34205
34206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34207         LDKCommitmentTransaction o_conv;
34208         o_conv.inner = untag_ptr(o);
34209         o_conv.is_owned = ptr_is_owned(o);
34210         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34211         o_conv = CommitmentTransaction_clone(&o_conv);
34212         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
34213         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
34214         return tag_ptr(ret_conv, true);
34215 }
34216
34217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34218         void* e_ptr = untag_ptr(e);
34219         CHECK_ACCESS(e_ptr);
34220         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34221         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34222         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
34223         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
34224         return tag_ptr(ret_conv, true);
34225 }
34226
34227 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34228         LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(o);
34229         jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
34230         return ret_conv;
34231 }
34232
34233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34234         if (!ptr_is_owned(_res)) return;
34235         void* _res_ptr = untag_ptr(_res);
34236         CHECK_ACCESS(_res_ptr);
34237         LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
34238         FREE(untag_ptr(_res));
34239         CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
34240 }
34241
34242 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
34243         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
34244         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
34245         return tag_ptr(ret_conv, true);
34246 }
34247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34248         LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
34249         int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
34250         return ret_conv;
34251 }
34252
34253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34254         LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
34255         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
34256         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
34257         return tag_ptr(ret_conv, true);
34258 }
34259
34260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34261         LDKTrustedCommitmentTransaction o_conv;
34262         o_conv.inner = untag_ptr(o);
34263         o_conv.is_owned = ptr_is_owned(o);
34264         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34265         // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
34266         
34267         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
34268         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
34269         return tag_ptr(ret_conv, true);
34270 }
34271
34272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
34273         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
34274         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
34275         return tag_ptr(ret_conv, true);
34276 }
34277
34278 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34279         LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(o);
34280         jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
34281         return ret_conv;
34282 }
34283
34284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34285         if (!ptr_is_owned(_res)) return;
34286         void* _res_ptr = untag_ptr(_res);
34287         CHECK_ACCESS(_res_ptr);
34288         LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
34289         FREE(untag_ptr(_res));
34290         CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
34291 }
34292
34293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
34294         LDKCVec_ECDSASignatureZ o_constr;
34295         o_constr.datalen = (*env)->GetArrayLength(env, o);
34296         if (o_constr.datalen > 0)
34297                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
34298         else
34299                 o_constr.data = NULL;
34300         for (size_t i = 0; i < o_constr.datalen; i++) {
34301                 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
34302                 LDKECDSASignature o_conv_8_ref;
34303                 CHECK((*env)->GetArrayLength(env, o_conv_8) == 64);
34304                 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 64, o_conv_8_ref.compact_form);
34305                 o_constr.data[i] = o_conv_8_ref;
34306         }
34307         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
34308         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_ok(o_constr);
34309         return tag_ptr(ret_conv, true);
34310 }
34311
34312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
34313         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
34314         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_err();
34315         return tag_ptr(ret_conv, true);
34316 }
34317
34318 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34319         LDKCResult_CVec_ECDSASignatureZNoneZ* o_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(o);
34320         jboolean ret_conv = CResult_CVec_ECDSASignatureZNoneZ_is_ok(o_conv);
34321         return ret_conv;
34322 }
34323
34324 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34325         if (!ptr_is_owned(_res)) return;
34326         void* _res_ptr = untag_ptr(_res);
34327         CHECK_ACCESS(_res_ptr);
34328         LDKCResult_CVec_ECDSASignatureZNoneZ _res_conv = *(LDKCResult_CVec_ECDSASignatureZNoneZ*)(_res_ptr);
34329         FREE(untag_ptr(_res));
34330         CResult_CVec_ECDSASignatureZNoneZ_free(_res_conv);
34331 }
34332
34333 static inline uint64_t CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR arg) {
34334         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
34335         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone(arg);
34336         return tag_ptr(ret_conv, true);
34337 }
34338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34339         LDKCResult_CVec_ECDSASignatureZNoneZ* arg_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(arg);
34340         int64_t ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(arg_conv);
34341         return ret_conv;
34342 }
34343
34344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34345         LDKCResult_CVec_ECDSASignatureZNoneZ* orig_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(orig);
34346         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
34347         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone(orig_conv);
34348         return tag_ptr(ret_conv, true);
34349 }
34350
34351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1usizeZ_1some(JNIEnv *env, jclass clz, int64_t o) {
34352         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
34353         *ret_copy = COption_usizeZ_some(o);
34354         int64_t ret_ref = tag_ptr(ret_copy, true);
34355         return ret_ref;
34356 }
34357
34358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1usizeZ_1none(JNIEnv *env, jclass clz) {
34359         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
34360         *ret_copy = COption_usizeZ_none();
34361         int64_t ret_ref = tag_ptr(ret_copy, true);
34362         return ret_ref;
34363 }
34364
34365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1usizeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34366         if (!ptr_is_owned(_res)) return;
34367         void* _res_ptr = untag_ptr(_res);
34368         CHECK_ACCESS(_res_ptr);
34369         LDKCOption_usizeZ _res_conv = *(LDKCOption_usizeZ*)(_res_ptr);
34370         FREE(untag_ptr(_res));
34371         COption_usizeZ_free(_res_conv);
34372 }
34373
34374 static inline uint64_t COption_usizeZ_clone_ptr(LDKCOption_usizeZ *NONNULL_PTR arg) {
34375         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
34376         *ret_copy = COption_usizeZ_clone(arg);
34377         int64_t ret_ref = tag_ptr(ret_copy, true);
34378         return ret_ref;
34379 }
34380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1usizeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34381         LDKCOption_usizeZ* arg_conv = (LDKCOption_usizeZ*)untag_ptr(arg);
34382         int64_t ret_conv = COption_usizeZ_clone_ptr(arg_conv);
34383         return ret_conv;
34384 }
34385
34386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1usizeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34387         LDKCOption_usizeZ* orig_conv = (LDKCOption_usizeZ*)untag_ptr(orig);
34388         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
34389         *ret_copy = COption_usizeZ_clone(orig_conv);
34390         int64_t ret_ref = tag_ptr(ret_copy, true);
34391         return ret_ref;
34392 }
34393
34394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34395         LDKShutdownScript o_conv;
34396         o_conv.inner = untag_ptr(o);
34397         o_conv.is_owned = ptr_is_owned(o);
34398         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34399         o_conv = ShutdownScript_clone(&o_conv);
34400         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
34401         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
34402         return tag_ptr(ret_conv, true);
34403 }
34404
34405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34406         void* e_ptr = untag_ptr(e);
34407         CHECK_ACCESS(e_ptr);
34408         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34409         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34410         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
34411         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
34412         return tag_ptr(ret_conv, true);
34413 }
34414
34415 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34416         LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(o);
34417         jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
34418         return ret_conv;
34419 }
34420
34421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34422         if (!ptr_is_owned(_res)) return;
34423         void* _res_ptr = untag_ptr(_res);
34424         CHECK_ACCESS(_res_ptr);
34425         LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
34426         FREE(untag_ptr(_res));
34427         CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
34428 }
34429
34430 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
34431         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
34432         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
34433         return tag_ptr(ret_conv, true);
34434 }
34435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34436         LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(arg);
34437         int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
34438         return ret_conv;
34439 }
34440
34441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34442         LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(orig);
34443         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
34444         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
34445         return tag_ptr(ret_conv, true);
34446 }
34447
34448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34449         LDKShutdownScript o_conv;
34450         o_conv.inner = untag_ptr(o);
34451         o_conv.is_owned = ptr_is_owned(o);
34452         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34453         o_conv = ShutdownScript_clone(&o_conv);
34454         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
34455         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
34456         return tag_ptr(ret_conv, true);
34457 }
34458
34459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34460         LDKInvalidShutdownScript e_conv;
34461         e_conv.inner = untag_ptr(e);
34462         e_conv.is_owned = ptr_is_owned(e);
34463         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
34464         e_conv = InvalidShutdownScript_clone(&e_conv);
34465         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
34466         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
34467         return tag_ptr(ret_conv, true);
34468 }
34469
34470 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34471         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(o);
34472         jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
34473         return ret_conv;
34474 }
34475
34476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34477         if (!ptr_is_owned(_res)) return;
34478         void* _res_ptr = untag_ptr(_res);
34479         CHECK_ACCESS(_res_ptr);
34480         LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
34481         FREE(untag_ptr(_res));
34482         CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
34483 }
34484
34485 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
34486         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
34487         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
34488         return tag_ptr(ret_conv, true);
34489 }
34490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34491         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(arg);
34492         int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
34493         return ret_conv;
34494 }
34495
34496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34497         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(orig);
34498         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
34499         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
34500         return tag_ptr(ret_conv, true);
34501 }
34502
34503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34504         void* o_ptr = untag_ptr(o);
34505         CHECK_ACCESS(o_ptr);
34506         LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
34507         o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(o));
34508         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
34509         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
34510         return tag_ptr(ret_conv, true);
34511 }
34512
34513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34514         void* e_ptr = untag_ptr(e);
34515         CHECK_ACCESS(e_ptr);
34516         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34517         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34518         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
34519         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
34520         return tag_ptr(ret_conv, true);
34521 }
34522
34523 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34524         LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(o);
34525         jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
34526         return ret_conv;
34527 }
34528
34529 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34530         if (!ptr_is_owned(_res)) return;
34531         void* _res_ptr = untag_ptr(_res);
34532         CHECK_ACCESS(_res_ptr);
34533         LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
34534         FREE(untag_ptr(_res));
34535         CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
34536 }
34537
34538 static inline uint64_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
34539         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
34540         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
34541         return tag_ptr(ret_conv, true);
34542 }
34543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34544         LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(arg);
34545         int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
34546         return ret_conv;
34547 }
34548
34549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34550         LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(orig);
34551         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
34552         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
34553         return tag_ptr(ret_conv, true);
34554 }
34555
34556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34557         LDKClaimedHTLC o_conv;
34558         o_conv.inner = untag_ptr(o);
34559         o_conv.is_owned = ptr_is_owned(o);
34560         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34561         o_conv = ClaimedHTLC_clone(&o_conv);
34562         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
34563         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_ok(o_conv);
34564         return tag_ptr(ret_conv, true);
34565 }
34566
34567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34568         void* e_ptr = untag_ptr(e);
34569         CHECK_ACCESS(e_ptr);
34570         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34571         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34572         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
34573         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_err(e_conv);
34574         return tag_ptr(ret_conv, true);
34575 }
34576
34577 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34578         LDKCResult_ClaimedHTLCDecodeErrorZ* o_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(o);
34579         jboolean ret_conv = CResult_ClaimedHTLCDecodeErrorZ_is_ok(o_conv);
34580         return ret_conv;
34581 }
34582
34583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34584         if (!ptr_is_owned(_res)) return;
34585         void* _res_ptr = untag_ptr(_res);
34586         CHECK_ACCESS(_res_ptr);
34587         LDKCResult_ClaimedHTLCDecodeErrorZ _res_conv = *(LDKCResult_ClaimedHTLCDecodeErrorZ*)(_res_ptr);
34588         FREE(untag_ptr(_res));
34589         CResult_ClaimedHTLCDecodeErrorZ_free(_res_conv);
34590 }
34591
34592 static inline uint64_t CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR arg) {
34593         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
34594         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone(arg);
34595         return tag_ptr(ret_conv, true);
34596 }
34597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34598         LDKCResult_ClaimedHTLCDecodeErrorZ* arg_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(arg);
34599         int64_t ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(arg_conv);
34600         return ret_conv;
34601 }
34602
34603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34604         LDKCResult_ClaimedHTLCDecodeErrorZ* orig_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(orig);
34605         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
34606         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone(orig_conv);
34607         return tag_ptr(ret_conv, true);
34608 }
34609
34610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1some(JNIEnv *env, jclass clz, int64_t o) {
34611         void* o_ptr = untag_ptr(o);
34612         CHECK_ACCESS(o_ptr);
34613         LDKPathFailure o_conv = *(LDKPathFailure*)(o_ptr);
34614         o_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(o));
34615         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
34616         *ret_copy = COption_PathFailureZ_some(o_conv);
34617         int64_t ret_ref = tag_ptr(ret_copy, true);
34618         return ret_ref;
34619 }
34620
34621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1none(JNIEnv *env, jclass clz) {
34622         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
34623         *ret_copy = COption_PathFailureZ_none();
34624         int64_t ret_ref = tag_ptr(ret_copy, true);
34625         return ret_ref;
34626 }
34627
34628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34629         if (!ptr_is_owned(_res)) return;
34630         void* _res_ptr = untag_ptr(_res);
34631         CHECK_ACCESS(_res_ptr);
34632         LDKCOption_PathFailureZ _res_conv = *(LDKCOption_PathFailureZ*)(_res_ptr);
34633         FREE(untag_ptr(_res));
34634         COption_PathFailureZ_free(_res_conv);
34635 }
34636
34637 static inline uint64_t COption_PathFailureZ_clone_ptr(LDKCOption_PathFailureZ *NONNULL_PTR arg) {
34638         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
34639         *ret_copy = COption_PathFailureZ_clone(arg);
34640         int64_t ret_ref = tag_ptr(ret_copy, true);
34641         return ret_ref;
34642 }
34643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34644         LDKCOption_PathFailureZ* arg_conv = (LDKCOption_PathFailureZ*)untag_ptr(arg);
34645         int64_t ret_conv = COption_PathFailureZ_clone_ptr(arg_conv);
34646         return ret_conv;
34647 }
34648
34649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34650         LDKCOption_PathFailureZ* orig_conv = (LDKCOption_PathFailureZ*)untag_ptr(orig);
34651         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
34652         *ret_copy = COption_PathFailureZ_clone(orig_conv);
34653         int64_t ret_ref = tag_ptr(ret_copy, true);
34654         return ret_ref;
34655 }
34656
34657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34658         void* o_ptr = untag_ptr(o);
34659         CHECK_ACCESS(o_ptr);
34660         LDKCOption_PathFailureZ o_conv = *(LDKCOption_PathFailureZ*)(o_ptr);
34661         o_conv = COption_PathFailureZ_clone((LDKCOption_PathFailureZ*)untag_ptr(o));
34662         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
34663         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_ok(o_conv);
34664         return tag_ptr(ret_conv, true);
34665 }
34666
34667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34668         void* e_ptr = untag_ptr(e);
34669         CHECK_ACCESS(e_ptr);
34670         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34671         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34672         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
34673         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_err(e_conv);
34674         return tag_ptr(ret_conv, true);
34675 }
34676
34677 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34678         LDKCResult_COption_PathFailureZDecodeErrorZ* o_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(o);
34679         jboolean ret_conv = CResult_COption_PathFailureZDecodeErrorZ_is_ok(o_conv);
34680         return ret_conv;
34681 }
34682
34683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34684         if (!ptr_is_owned(_res)) return;
34685         void* _res_ptr = untag_ptr(_res);
34686         CHECK_ACCESS(_res_ptr);
34687         LDKCResult_COption_PathFailureZDecodeErrorZ _res_conv = *(LDKCResult_COption_PathFailureZDecodeErrorZ*)(_res_ptr);
34688         FREE(untag_ptr(_res));
34689         CResult_COption_PathFailureZDecodeErrorZ_free(_res_conv);
34690 }
34691
34692 static inline uint64_t CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR arg) {
34693         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
34694         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(arg);
34695         return tag_ptr(ret_conv, true);
34696 }
34697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34698         LDKCResult_COption_PathFailureZDecodeErrorZ* arg_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(arg);
34699         int64_t ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(arg_conv);
34700         return ret_conv;
34701 }
34702
34703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34704         LDKCResult_COption_PathFailureZDecodeErrorZ* orig_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(orig);
34705         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
34706         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(orig_conv);
34707         return tag_ptr(ret_conv, true);
34708 }
34709
34710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1some(JNIEnv *env, jclass clz, int64_t o) {
34711         void* o_ptr = untag_ptr(o);
34712         CHECK_ACCESS(o_ptr);
34713         LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
34714         o_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(o));
34715         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
34716         *ret_copy = COption_ClosureReasonZ_some(o_conv);
34717         int64_t ret_ref = tag_ptr(ret_copy, true);
34718         return ret_ref;
34719 }
34720
34721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1none(JNIEnv *env, jclass clz) {
34722         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
34723         *ret_copy = COption_ClosureReasonZ_none();
34724         int64_t ret_ref = tag_ptr(ret_copy, true);
34725         return ret_ref;
34726 }
34727
34728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34729         if (!ptr_is_owned(_res)) return;
34730         void* _res_ptr = untag_ptr(_res);
34731         CHECK_ACCESS(_res_ptr);
34732         LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
34733         FREE(untag_ptr(_res));
34734         COption_ClosureReasonZ_free(_res_conv);
34735 }
34736
34737 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
34738         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
34739         *ret_copy = COption_ClosureReasonZ_clone(arg);
34740         int64_t ret_ref = tag_ptr(ret_copy, true);
34741         return ret_ref;
34742 }
34743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34744         LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(arg);
34745         int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
34746         return ret_conv;
34747 }
34748
34749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34750         LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(orig);
34751         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
34752         *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
34753         int64_t ret_ref = tag_ptr(ret_copy, true);
34754         return ret_ref;
34755 }
34756
34757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34758         void* o_ptr = untag_ptr(o);
34759         CHECK_ACCESS(o_ptr);
34760         LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
34761         o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)untag_ptr(o));
34762         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
34763         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
34764         return tag_ptr(ret_conv, true);
34765 }
34766
34767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34768         void* e_ptr = untag_ptr(e);
34769         CHECK_ACCESS(e_ptr);
34770         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34771         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34772         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
34773         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
34774         return tag_ptr(ret_conv, true);
34775 }
34776
34777 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34778         LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(o);
34779         jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
34780         return ret_conv;
34781 }
34782
34783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34784         if (!ptr_is_owned(_res)) return;
34785         void* _res_ptr = untag_ptr(_res);
34786         CHECK_ACCESS(_res_ptr);
34787         LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
34788         FREE(untag_ptr(_res));
34789         CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
34790 }
34791
34792 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
34793         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
34794         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
34795         return tag_ptr(ret_conv, true);
34796 }
34797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34798         LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(arg);
34799         int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
34800         return ret_conv;
34801 }
34802
34803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34804         LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(orig);
34805         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
34806         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
34807         return tag_ptr(ret_conv, true);
34808 }
34809
34810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1some(JNIEnv *env, jclass clz, int64_t o) {
34811         void* o_ptr = untag_ptr(o);
34812         CHECK_ACCESS(o_ptr);
34813         LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr);
34814         o_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(o));
34815         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
34816         *ret_copy = COption_HTLCDestinationZ_some(o_conv);
34817         int64_t ret_ref = tag_ptr(ret_copy, true);
34818         return ret_ref;
34819 }
34820
34821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1none(JNIEnv *env, jclass clz) {
34822         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
34823         *ret_copy = COption_HTLCDestinationZ_none();
34824         int64_t ret_ref = tag_ptr(ret_copy, true);
34825         return ret_ref;
34826 }
34827
34828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34829         if (!ptr_is_owned(_res)) return;
34830         void* _res_ptr = untag_ptr(_res);
34831         CHECK_ACCESS(_res_ptr);
34832         LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr);
34833         FREE(untag_ptr(_res));
34834         COption_HTLCDestinationZ_free(_res_conv);
34835 }
34836
34837 static inline uint64_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) {
34838         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
34839         *ret_copy = COption_HTLCDestinationZ_clone(arg);
34840         int64_t ret_ref = tag_ptr(ret_copy, true);
34841         return ret_ref;
34842 }
34843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34844         LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(arg);
34845         int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv);
34846         return ret_conv;
34847 }
34848
34849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34850         LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(orig);
34851         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
34852         *ret_copy = COption_HTLCDestinationZ_clone(orig_conv);
34853         int64_t ret_ref = tag_ptr(ret_copy, true);
34854         return ret_ref;
34855 }
34856
34857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34858         void* o_ptr = untag_ptr(o);
34859         CHECK_ACCESS(o_ptr);
34860         LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr);
34861         o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)untag_ptr(o));
34862         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
34863         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv);
34864         return tag_ptr(ret_conv, true);
34865 }
34866
34867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34868         void* e_ptr = untag_ptr(e);
34869         CHECK_ACCESS(e_ptr);
34870         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34871         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34872         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
34873         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv);
34874         return tag_ptr(ret_conv, true);
34875 }
34876
34877 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34878         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(o);
34879         jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv);
34880         return ret_conv;
34881 }
34882
34883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34884         if (!ptr_is_owned(_res)) return;
34885         void* _res_ptr = untag_ptr(_res);
34886         CHECK_ACCESS(_res_ptr);
34887         LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr);
34888         FREE(untag_ptr(_res));
34889         CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv);
34890 }
34891
34892 static inline uint64_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) {
34893         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
34894         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg);
34895         return tag_ptr(ret_conv, true);
34896 }
34897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34898         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(arg);
34899         int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv);
34900         return ret_conv;
34901 }
34902
34903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34904         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(orig);
34905         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
34906         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv);
34907         return tag_ptr(ret_conv, true);
34908 }
34909
34910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
34911         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_java(env, o);
34912         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
34913         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_ok(o_conv);
34914         return tag_ptr(ret_conv, true);
34915 }
34916
34917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34918         void* e_ptr = untag_ptr(e);
34919         CHECK_ACCESS(e_ptr);
34920         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34921         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34922         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
34923         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_err(e_conv);
34924         return tag_ptr(ret_conv, true);
34925 }
34926
34927 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34928         LDKCResult_PaymentFailureReasonDecodeErrorZ* o_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(o);
34929         jboolean ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_is_ok(o_conv);
34930         return ret_conv;
34931 }
34932
34933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34934         if (!ptr_is_owned(_res)) return;
34935         void* _res_ptr = untag_ptr(_res);
34936         CHECK_ACCESS(_res_ptr);
34937         LDKCResult_PaymentFailureReasonDecodeErrorZ _res_conv = *(LDKCResult_PaymentFailureReasonDecodeErrorZ*)(_res_ptr);
34938         FREE(untag_ptr(_res));
34939         CResult_PaymentFailureReasonDecodeErrorZ_free(_res_conv);
34940 }
34941
34942 static inline uint64_t CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR arg) {
34943         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
34944         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(arg);
34945         return tag_ptr(ret_conv, true);
34946 }
34947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34948         LDKCResult_PaymentFailureReasonDecodeErrorZ* arg_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(arg);
34949         int64_t ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(arg_conv);
34950         return ret_conv;
34951 }
34952
34953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34954         LDKCResult_PaymentFailureReasonDecodeErrorZ* orig_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(orig);
34955         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
34956         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(orig_conv);
34957         return tag_ptr(ret_conv, true);
34958 }
34959
34960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1U128Z_1some(JNIEnv *env, jclass clz, int8_tArray o) {
34961         LDKU128 o_ref;
34962         CHECK((*env)->GetArrayLength(env, o) == 16);
34963         (*env)->GetByteArrayRegion(env, o, 0, 16, o_ref.le_bytes);
34964         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
34965         *ret_copy = COption_U128Z_some(o_ref);
34966         int64_t ret_ref = tag_ptr(ret_copy, true);
34967         return ret_ref;
34968 }
34969
34970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1U128Z_1none(JNIEnv *env, jclass clz) {
34971         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
34972         *ret_copy = COption_U128Z_none();
34973         int64_t ret_ref = tag_ptr(ret_copy, true);
34974         return ret_ref;
34975 }
34976
34977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1U128Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
34978         if (!ptr_is_owned(_res)) return;
34979         void* _res_ptr = untag_ptr(_res);
34980         CHECK_ACCESS(_res_ptr);
34981         LDKCOption_U128Z _res_conv = *(LDKCOption_U128Z*)(_res_ptr);
34982         FREE(untag_ptr(_res));
34983         COption_U128Z_free(_res_conv);
34984 }
34985
34986 static inline uint64_t COption_U128Z_clone_ptr(LDKCOption_U128Z *NONNULL_PTR arg) {
34987         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
34988         *ret_copy = COption_U128Z_clone(arg);
34989         int64_t ret_ref = tag_ptr(ret_copy, true);
34990         return ret_ref;
34991 }
34992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1U128Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34993         LDKCOption_U128Z* arg_conv = (LDKCOption_U128Z*)untag_ptr(arg);
34994         int64_t ret_conv = COption_U128Z_clone_ptr(arg_conv);
34995         return ret_conv;
34996 }
34997
34998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1U128Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34999         LDKCOption_U128Z* orig_conv = (LDKCOption_U128Z*)untag_ptr(orig);
35000         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
35001         *ret_copy = COption_U128Z_clone(orig_conv);
35002         int64_t ret_ref = tag_ptr(ret_copy, true);
35003         return ret_ref;
35004 }
35005
35006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ClaimedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
35007         LDKCVec_ClaimedHTLCZ _res_constr;
35008         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
35009         if (_res_constr.datalen > 0)
35010                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKClaimedHTLC), "LDKCVec_ClaimedHTLCZ Elements");
35011         else
35012                 _res_constr.data = NULL;
35013         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
35014         for (size_t n = 0; n < _res_constr.datalen; n++) {
35015                 int64_t _res_conv_13 = _res_vals[n];
35016                 LDKClaimedHTLC _res_conv_13_conv;
35017                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
35018                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
35019                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
35020                 _res_constr.data[n] = _res_conv_13_conv;
35021         }
35022         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
35023         CVec_ClaimedHTLCZ_free(_res_constr);
35024 }
35025
35026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1some(JNIEnv *env, jclass clz, jclass o) {
35027         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_java(env, o);
35028         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
35029         *ret_copy = COption_PaymentFailureReasonZ_some(o_conv);
35030         int64_t ret_ref = tag_ptr(ret_copy, true);
35031         return ret_ref;
35032 }
35033
35034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1none(JNIEnv *env, jclass clz) {
35035         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
35036         *ret_copy = COption_PaymentFailureReasonZ_none();
35037         int64_t ret_ref = tag_ptr(ret_copy, true);
35038         return ret_ref;
35039 }
35040
35041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35042         if (!ptr_is_owned(_res)) return;
35043         void* _res_ptr = untag_ptr(_res);
35044         CHECK_ACCESS(_res_ptr);
35045         LDKCOption_PaymentFailureReasonZ _res_conv = *(LDKCOption_PaymentFailureReasonZ*)(_res_ptr);
35046         FREE(untag_ptr(_res));
35047         COption_PaymentFailureReasonZ_free(_res_conv);
35048 }
35049
35050 static inline uint64_t COption_PaymentFailureReasonZ_clone_ptr(LDKCOption_PaymentFailureReasonZ *NONNULL_PTR arg) {
35051         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
35052         *ret_copy = COption_PaymentFailureReasonZ_clone(arg);
35053         int64_t ret_ref = tag_ptr(ret_copy, true);
35054         return ret_ref;
35055 }
35056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35057         LDKCOption_PaymentFailureReasonZ* arg_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(arg);
35058         int64_t ret_conv = COption_PaymentFailureReasonZ_clone_ptr(arg_conv);
35059         return ret_conv;
35060 }
35061
35062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35063         LDKCOption_PaymentFailureReasonZ* orig_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(orig);
35064         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
35065         *ret_copy = COption_PaymentFailureReasonZ_clone(orig_conv);
35066         int64_t ret_ref = tag_ptr(ret_copy, true);
35067         return ret_ref;
35068 }
35069
35070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
35071         void* o_ptr = untag_ptr(o);
35072         CHECK_ACCESS(o_ptr);
35073         LDKEvent o_conv = *(LDKEvent*)(o_ptr);
35074         o_conv = Event_clone((LDKEvent*)untag_ptr(o));
35075         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
35076         *ret_copy = COption_EventZ_some(o_conv);
35077         int64_t ret_ref = tag_ptr(ret_copy, true);
35078         return ret_ref;
35079 }
35080
35081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1none(JNIEnv *env, jclass clz) {
35082         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
35083         *ret_copy = COption_EventZ_none();
35084         int64_t ret_ref = tag_ptr(ret_copy, true);
35085         return ret_ref;
35086 }
35087
35088 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35089         if (!ptr_is_owned(_res)) return;
35090         void* _res_ptr = untag_ptr(_res);
35091         CHECK_ACCESS(_res_ptr);
35092         LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
35093         FREE(untag_ptr(_res));
35094         COption_EventZ_free(_res_conv);
35095 }
35096
35097 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
35098         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
35099         *ret_copy = COption_EventZ_clone(arg);
35100         int64_t ret_ref = tag_ptr(ret_copy, true);
35101         return ret_ref;
35102 }
35103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35104         LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)untag_ptr(arg);
35105         int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
35106         return ret_conv;
35107 }
35108
35109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35110         LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)untag_ptr(orig);
35111         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
35112         *ret_copy = COption_EventZ_clone(orig_conv);
35113         int64_t ret_ref = tag_ptr(ret_copy, true);
35114         return ret_ref;
35115 }
35116
35117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35118         void* o_ptr = untag_ptr(o);
35119         CHECK_ACCESS(o_ptr);
35120         LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
35121         o_conv = COption_EventZ_clone((LDKCOption_EventZ*)untag_ptr(o));
35122         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
35123         *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
35124         return tag_ptr(ret_conv, true);
35125 }
35126
35127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35128         void* e_ptr = untag_ptr(e);
35129         CHECK_ACCESS(e_ptr);
35130         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35131         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35132         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
35133         *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
35134         return tag_ptr(ret_conv, true);
35135 }
35136
35137 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35138         LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(o);
35139         jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
35140         return ret_conv;
35141 }
35142
35143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35144         if (!ptr_is_owned(_res)) return;
35145         void* _res_ptr = untag_ptr(_res);
35146         CHECK_ACCESS(_res_ptr);
35147         LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
35148         FREE(untag_ptr(_res));
35149         CResult_COption_EventZDecodeErrorZ_free(_res_conv);
35150 }
35151
35152 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
35153         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
35154         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
35155         return tag_ptr(ret_conv, true);
35156 }
35157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35158         LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(arg);
35159         int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
35160         return ret_conv;
35161 }
35162
35163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35164         LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(orig);
35165         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
35166         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
35167         return tag_ptr(ret_conv, true);
35168 }
35169
35170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
35171         LDKSiPrefix o_conv = LDKSiPrefix_from_java(env, o);
35172         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
35173         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_ok(o_conv);
35174         return tag_ptr(ret_conv, true);
35175 }
35176
35177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35178         void* e_ptr = untag_ptr(e);
35179         CHECK_ACCESS(e_ptr);
35180         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
35181         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
35182         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
35183         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_err(e_conv);
35184         return tag_ptr(ret_conv, true);
35185 }
35186
35187 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35188         LDKCResult_SiPrefixBolt11ParseErrorZ* o_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(o);
35189         jboolean ret_conv = CResult_SiPrefixBolt11ParseErrorZ_is_ok(o_conv);
35190         return ret_conv;
35191 }
35192
35193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35194         if (!ptr_is_owned(_res)) return;
35195         void* _res_ptr = untag_ptr(_res);
35196         CHECK_ACCESS(_res_ptr);
35197         LDKCResult_SiPrefixBolt11ParseErrorZ _res_conv = *(LDKCResult_SiPrefixBolt11ParseErrorZ*)(_res_ptr);
35198         FREE(untag_ptr(_res));
35199         CResult_SiPrefixBolt11ParseErrorZ_free(_res_conv);
35200 }
35201
35202 static inline uint64_t CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR arg) {
35203         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
35204         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(arg);
35205         return tag_ptr(ret_conv, true);
35206 }
35207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35208         LDKCResult_SiPrefixBolt11ParseErrorZ* arg_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(arg);
35209         int64_t ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(arg_conv);
35210         return ret_conv;
35211 }
35212
35213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35214         LDKCResult_SiPrefixBolt11ParseErrorZ* orig_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(orig);
35215         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
35216         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(orig_conv);
35217         return tag_ptr(ret_conv, true);
35218 }
35219
35220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35221         LDKBolt11Invoice o_conv;
35222         o_conv.inner = untag_ptr(o);
35223         o_conv.is_owned = ptr_is_owned(o);
35224         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35225         o_conv = Bolt11Invoice_clone(&o_conv);
35226         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
35227         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(o_conv);
35228         return tag_ptr(ret_conv, true);
35229 }
35230
35231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35232         void* e_ptr = untag_ptr(e);
35233         CHECK_ACCESS(e_ptr);
35234         LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
35235         e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e));
35236         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
35237         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(e_conv);
35238         return tag_ptr(ret_conv, true);
35239 }
35240
35241 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35242         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(o);
35243         jboolean ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
35244         return ret_conv;
35245 }
35246
35247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35248         if (!ptr_is_owned(_res)) return;
35249         void* _res_ptr = untag_ptr(_res);
35250         CHECK_ACCESS(_res_ptr);
35251         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)(_res_ptr);
35252         FREE(untag_ptr(_res));
35253         CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(_res_conv);
35254 }
35255
35256 static inline uint64_t CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
35257         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
35258         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(arg);
35259         return tag_ptr(ret_conv, true);
35260 }
35261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35262         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(arg);
35263         int64_t ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
35264         return ret_conv;
35265 }
35266
35267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35268         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(orig);
35269         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
35270         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(orig_conv);
35271         return tag_ptr(ret_conv, true);
35272 }
35273
35274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35275         LDKSignedRawBolt11Invoice o_conv;
35276         o_conv.inner = untag_ptr(o);
35277         o_conv.is_owned = ptr_is_owned(o);
35278         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35279         o_conv = SignedRawBolt11Invoice_clone(&o_conv);
35280         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
35281         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(o_conv);
35282         return tag_ptr(ret_conv, true);
35283 }
35284
35285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35286         void* e_ptr = untag_ptr(e);
35287         CHECK_ACCESS(e_ptr);
35288         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
35289         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
35290         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
35291         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(e_conv);
35292         return tag_ptr(ret_conv, true);
35293 }
35294
35295 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35296         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* o_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(o);
35297         jboolean ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(o_conv);
35298         return ret_conv;
35299 }
35300
35301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35302         if (!ptr_is_owned(_res)) return;
35303         void* _res_ptr = untag_ptr(_res);
35304         CHECK_ACCESS(_res_ptr);
35305         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ _res_conv = *(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)(_res_ptr);
35306         FREE(untag_ptr(_res));
35307         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(_res_conv);
35308 }
35309
35310 static inline uint64_t CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR arg) {
35311         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
35312         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(arg);
35313         return tag_ptr(ret_conv, true);
35314 }
35315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35316         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* arg_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(arg);
35317         int64_t ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(arg_conv);
35318         return ret_conv;
35319 }
35320
35321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35322         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* orig_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(orig);
35323         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
35324         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(orig_conv);
35325         return tag_ptr(ret_conv, true);
35326 }
35327
35328 static inline uint64_t C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR arg) {
35329         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
35330         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(arg);
35331         return tag_ptr(ret_conv, true);
35332 }
35333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35334         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(arg);
35335         int64_t ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(arg_conv);
35336         return ret_conv;
35337 }
35338
35339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35340         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(orig);
35341         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
35342         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(orig_conv);
35343         return tag_ptr(ret_conv, true);
35344 }
35345
35346 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) {
35347         LDKRawBolt11Invoice a_conv;
35348         a_conv.inner = untag_ptr(a);
35349         a_conv.is_owned = ptr_is_owned(a);
35350         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35351         a_conv = RawBolt11Invoice_clone(&a_conv);
35352         LDKThirtyTwoBytes b_ref;
35353         CHECK((*env)->GetArrayLength(env, b) == 32);
35354         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
35355         LDKBolt11InvoiceSignature c_conv;
35356         c_conv.inner = untag_ptr(c);
35357         c_conv.is_owned = ptr_is_owned(c);
35358         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
35359         c_conv = Bolt11InvoiceSignature_clone(&c_conv);
35360         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
35361         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
35362         return tag_ptr(ret_conv, true);
35363 }
35364
35365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35366         if (!ptr_is_owned(_res)) return;
35367         void* _res_ptr = untag_ptr(_res);
35368         CHECK_ACCESS(_res_ptr);
35369         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)(_res_ptr);
35370         FREE(untag_ptr(_res));
35371         C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(_res_conv);
35372 }
35373
35374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35375         LDKPayeePubKey o_conv;
35376         o_conv.inner = untag_ptr(o);
35377         o_conv.is_owned = ptr_is_owned(o);
35378         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35379         o_conv = PayeePubKey_clone(&o_conv);
35380         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
35381         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_ok(o_conv);
35382         return tag_ptr(ret_conv, true);
35383 }
35384
35385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
35386         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
35387         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
35388         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_err(e_conv);
35389         return tag_ptr(ret_conv, true);
35390 }
35391
35392 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35393         LDKCResult_PayeePubKeySecp256k1ErrorZ* o_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(o);
35394         jboolean ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_is_ok(o_conv);
35395         return ret_conv;
35396 }
35397
35398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35399         if (!ptr_is_owned(_res)) return;
35400         void* _res_ptr = untag_ptr(_res);
35401         CHECK_ACCESS(_res_ptr);
35402         LDKCResult_PayeePubKeySecp256k1ErrorZ _res_conv = *(LDKCResult_PayeePubKeySecp256k1ErrorZ*)(_res_ptr);
35403         FREE(untag_ptr(_res));
35404         CResult_PayeePubKeySecp256k1ErrorZ_free(_res_conv);
35405 }
35406
35407 static inline uint64_t CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR arg) {
35408         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
35409         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone(arg);
35410         return tag_ptr(ret_conv, true);
35411 }
35412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35413         LDKCResult_PayeePubKeySecp256k1ErrorZ* arg_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(arg);
35414         int64_t ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(arg_conv);
35415         return ret_conv;
35416 }
35417
35418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35419         LDKCResult_PayeePubKeySecp256k1ErrorZ* orig_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(orig);
35420         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
35421         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone(orig_conv);
35422         return tag_ptr(ret_conv, true);
35423 }
35424
35425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PrivateRouteZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
35426         LDKCVec_PrivateRouteZ _res_constr;
35427         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
35428         if (_res_constr.datalen > 0)
35429                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
35430         else
35431                 _res_constr.data = NULL;
35432         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
35433         for (size_t o = 0; o < _res_constr.datalen; o++) {
35434                 int64_t _res_conv_14 = _res_vals[o];
35435                 LDKPrivateRoute _res_conv_14_conv;
35436                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
35437                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
35438                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
35439                 _res_constr.data[o] = _res_conv_14_conv;
35440         }
35441         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
35442         CVec_PrivateRouteZ_free(_res_constr);
35443 }
35444
35445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35446         LDKPositiveTimestamp o_conv;
35447         o_conv.inner = untag_ptr(o);
35448         o_conv.is_owned = ptr_is_owned(o);
35449         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35450         o_conv = PositiveTimestamp_clone(&o_conv);
35451         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
35452         *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
35453         return tag_ptr(ret_conv, true);
35454 }
35455
35456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
35457         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
35458         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
35459         *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
35460         return tag_ptr(ret_conv, true);
35461 }
35462
35463 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35464         LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o);
35465         jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
35466         return ret_conv;
35467 }
35468
35469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35470         if (!ptr_is_owned(_res)) return;
35471         void* _res_ptr = untag_ptr(_res);
35472         CHECK_ACCESS(_res_ptr);
35473         LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
35474         FREE(untag_ptr(_res));
35475         CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
35476 }
35477
35478 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
35479         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
35480         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
35481         return tag_ptr(ret_conv, true);
35482 }
35483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35484         LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg);
35485         int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
35486         return ret_conv;
35487 }
35488
35489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35490         LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig);
35491         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
35492         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
35493         return tag_ptr(ret_conv, true);
35494 }
35495
35496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
35497         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
35498         *ret_conv = CResult_NoneBolt11SemanticErrorZ_ok();
35499         return tag_ptr(ret_conv, true);
35500 }
35501
35502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
35503         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_java(env, e);
35504         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
35505         *ret_conv = CResult_NoneBolt11SemanticErrorZ_err(e_conv);
35506         return tag_ptr(ret_conv, true);
35507 }
35508
35509 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35510         LDKCResult_NoneBolt11SemanticErrorZ* o_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(o);
35511         jboolean ret_conv = CResult_NoneBolt11SemanticErrorZ_is_ok(o_conv);
35512         return ret_conv;
35513 }
35514
35515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35516         if (!ptr_is_owned(_res)) return;
35517         void* _res_ptr = untag_ptr(_res);
35518         CHECK_ACCESS(_res_ptr);
35519         LDKCResult_NoneBolt11SemanticErrorZ _res_conv = *(LDKCResult_NoneBolt11SemanticErrorZ*)(_res_ptr);
35520         FREE(untag_ptr(_res));
35521         CResult_NoneBolt11SemanticErrorZ_free(_res_conv);
35522 }
35523
35524 static inline uint64_t CResult_NoneBolt11SemanticErrorZ_clone_ptr(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR arg) {
35525         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
35526         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(arg);
35527         return tag_ptr(ret_conv, true);
35528 }
35529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35530         LDKCResult_NoneBolt11SemanticErrorZ* arg_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(arg);
35531         int64_t ret_conv = CResult_NoneBolt11SemanticErrorZ_clone_ptr(arg_conv);
35532         return ret_conv;
35533 }
35534
35535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35536         LDKCResult_NoneBolt11SemanticErrorZ* orig_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(orig);
35537         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
35538         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(orig_conv);
35539         return tag_ptr(ret_conv, true);
35540 }
35541
35542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35543         LDKBolt11Invoice o_conv;
35544         o_conv.inner = untag_ptr(o);
35545         o_conv.is_owned = ptr_is_owned(o);
35546         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35547         o_conv = Bolt11Invoice_clone(&o_conv);
35548         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
35549         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(o_conv);
35550         return tag_ptr(ret_conv, true);
35551 }
35552
35553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
35554         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_java(env, e);
35555         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
35556         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(e_conv);
35557         return tag_ptr(ret_conv, true);
35558 }
35559
35560 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35561         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(o);
35562         jboolean ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(o_conv);
35563         return ret_conv;
35564 }
35565
35566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35567         if (!ptr_is_owned(_res)) return;
35568         void* _res_ptr = untag_ptr(_res);
35569         CHECK_ACCESS(_res_ptr);
35570         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)(_res_ptr);
35571         FREE(untag_ptr(_res));
35572         CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(_res_conv);
35573 }
35574
35575 static inline uint64_t CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR arg) {
35576         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
35577         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(arg);
35578         return tag_ptr(ret_conv, true);
35579 }
35580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35581         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(arg);
35582         int64_t ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(arg_conv);
35583         return ret_conv;
35584 }
35585
35586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35587         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(orig);
35588         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
35589         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(orig_conv);
35590         return tag_ptr(ret_conv, true);
35591 }
35592
35593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35594         LDKDescription o_conv;
35595         o_conv.inner = untag_ptr(o);
35596         o_conv.is_owned = ptr_is_owned(o);
35597         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35598         o_conv = Description_clone(&o_conv);
35599         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
35600         *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
35601         return tag_ptr(ret_conv, true);
35602 }
35603
35604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
35605         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
35606         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
35607         *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
35608         return tag_ptr(ret_conv, true);
35609 }
35610
35611 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35612         LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o);
35613         jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
35614         return ret_conv;
35615 }
35616
35617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35618         if (!ptr_is_owned(_res)) return;
35619         void* _res_ptr = untag_ptr(_res);
35620         CHECK_ACCESS(_res_ptr);
35621         LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
35622         FREE(untag_ptr(_res));
35623         CResult_DescriptionCreationErrorZ_free(_res_conv);
35624 }
35625
35626 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
35627         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
35628         *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
35629         return tag_ptr(ret_conv, true);
35630 }
35631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35632         LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg);
35633         int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
35634         return ret_conv;
35635 }
35636
35637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35638         LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig);
35639         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
35640         *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
35641         return tag_ptr(ret_conv, true);
35642 }
35643
35644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35645         LDKPrivateRoute o_conv;
35646         o_conv.inner = untag_ptr(o);
35647         o_conv.is_owned = ptr_is_owned(o);
35648         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35649         o_conv = PrivateRoute_clone(&o_conv);
35650         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
35651         *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
35652         return tag_ptr(ret_conv, true);
35653 }
35654
35655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
35656         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
35657         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
35658         *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
35659         return tag_ptr(ret_conv, true);
35660 }
35661
35662 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35663         LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o);
35664         jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
35665         return ret_conv;
35666 }
35667
35668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35669         if (!ptr_is_owned(_res)) return;
35670         void* _res_ptr = untag_ptr(_res);
35671         CHECK_ACCESS(_res_ptr);
35672         LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
35673         FREE(untag_ptr(_res));
35674         CResult_PrivateRouteCreationErrorZ_free(_res_conv);
35675 }
35676
35677 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
35678         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
35679         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
35680         return tag_ptr(ret_conv, true);
35681 }
35682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35683         LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg);
35684         int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
35685         return ret_conv;
35686 }
35687
35688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35689         LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig);
35690         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
35691         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
35692         return tag_ptr(ret_conv, true);
35693 }
35694
35695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35696         LDKOutPoint o_conv;
35697         o_conv.inner = untag_ptr(o);
35698         o_conv.is_owned = ptr_is_owned(o);
35699         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35700         o_conv = OutPoint_clone(&o_conv);
35701         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
35702         *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
35703         return tag_ptr(ret_conv, true);
35704 }
35705
35706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35707         void* e_ptr = untag_ptr(e);
35708         CHECK_ACCESS(e_ptr);
35709         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35710         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35711         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
35712         *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
35713         return tag_ptr(ret_conv, true);
35714 }
35715
35716 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35717         LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(o);
35718         jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
35719         return ret_conv;
35720 }
35721
35722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35723         if (!ptr_is_owned(_res)) return;
35724         void* _res_ptr = untag_ptr(_res);
35725         CHECK_ACCESS(_res_ptr);
35726         LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
35727         FREE(untag_ptr(_res));
35728         CResult_OutPointDecodeErrorZ_free(_res_conv);
35729 }
35730
35731 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
35732         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
35733         *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
35734         return tag_ptr(ret_conv, true);
35735 }
35736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35737         LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(arg);
35738         int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
35739         return ret_conv;
35740 }
35741
35742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35743         LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(orig);
35744         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
35745         *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
35746         return tag_ptr(ret_conv, true);
35747 }
35748
35749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35750         LDKBigSize o_conv;
35751         o_conv.inner = untag_ptr(o);
35752         o_conv.is_owned = ptr_is_owned(o);
35753         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35754         o_conv = BigSize_clone(&o_conv);
35755         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
35756         *ret_conv = CResult_BigSizeDecodeErrorZ_ok(o_conv);
35757         return tag_ptr(ret_conv, true);
35758 }
35759
35760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35761         void* e_ptr = untag_ptr(e);
35762         CHECK_ACCESS(e_ptr);
35763         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35764         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35765         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
35766         *ret_conv = CResult_BigSizeDecodeErrorZ_err(e_conv);
35767         return tag_ptr(ret_conv, true);
35768 }
35769
35770 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35771         LDKCResult_BigSizeDecodeErrorZ* o_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(o);
35772         jboolean ret_conv = CResult_BigSizeDecodeErrorZ_is_ok(o_conv);
35773         return ret_conv;
35774 }
35775
35776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35777         if (!ptr_is_owned(_res)) return;
35778         void* _res_ptr = untag_ptr(_res);
35779         CHECK_ACCESS(_res_ptr);
35780         LDKCResult_BigSizeDecodeErrorZ _res_conv = *(LDKCResult_BigSizeDecodeErrorZ*)(_res_ptr);
35781         FREE(untag_ptr(_res));
35782         CResult_BigSizeDecodeErrorZ_free(_res_conv);
35783 }
35784
35785 static inline uint64_t CResult_BigSizeDecodeErrorZ_clone_ptr(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR arg) {
35786         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
35787         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(arg);
35788         return tag_ptr(ret_conv, true);
35789 }
35790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35791         LDKCResult_BigSizeDecodeErrorZ* arg_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(arg);
35792         int64_t ret_conv = CResult_BigSizeDecodeErrorZ_clone_ptr(arg_conv);
35793         return ret_conv;
35794 }
35795
35796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35797         LDKCResult_BigSizeDecodeErrorZ* orig_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(orig);
35798         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
35799         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(orig_conv);
35800         return tag_ptr(ret_conv, true);
35801 }
35802
35803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35804         LDKHostname o_conv;
35805         o_conv.inner = untag_ptr(o);
35806         o_conv.is_owned = ptr_is_owned(o);
35807         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35808         o_conv = Hostname_clone(&o_conv);
35809         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
35810         *ret_conv = CResult_HostnameDecodeErrorZ_ok(o_conv);
35811         return tag_ptr(ret_conv, true);
35812 }
35813
35814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35815         void* e_ptr = untag_ptr(e);
35816         CHECK_ACCESS(e_ptr);
35817         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35818         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35819         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
35820         *ret_conv = CResult_HostnameDecodeErrorZ_err(e_conv);
35821         return tag_ptr(ret_conv, true);
35822 }
35823
35824 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35825         LDKCResult_HostnameDecodeErrorZ* o_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(o);
35826         jboolean ret_conv = CResult_HostnameDecodeErrorZ_is_ok(o_conv);
35827         return ret_conv;
35828 }
35829
35830 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35831         if (!ptr_is_owned(_res)) return;
35832         void* _res_ptr = untag_ptr(_res);
35833         CHECK_ACCESS(_res_ptr);
35834         LDKCResult_HostnameDecodeErrorZ _res_conv = *(LDKCResult_HostnameDecodeErrorZ*)(_res_ptr);
35835         FREE(untag_ptr(_res));
35836         CResult_HostnameDecodeErrorZ_free(_res_conv);
35837 }
35838
35839 static inline uint64_t CResult_HostnameDecodeErrorZ_clone_ptr(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR arg) {
35840         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
35841         *ret_conv = CResult_HostnameDecodeErrorZ_clone(arg);
35842         return tag_ptr(ret_conv, true);
35843 }
35844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35845         LDKCResult_HostnameDecodeErrorZ* arg_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(arg);
35846         int64_t ret_conv = CResult_HostnameDecodeErrorZ_clone_ptr(arg_conv);
35847         return ret_conv;
35848 }
35849
35850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35851         LDKCResult_HostnameDecodeErrorZ* orig_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(orig);
35852         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
35853         *ret_conv = CResult_HostnameDecodeErrorZ_clone(orig_conv);
35854         return tag_ptr(ret_conv, true);
35855 }
35856
35857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35858         LDKTransactionU16LenLimited o_conv;
35859         o_conv.inner = untag_ptr(o);
35860         o_conv.is_owned = ptr_is_owned(o);
35861         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35862         o_conv = TransactionU16LenLimited_clone(&o_conv);
35863         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
35864         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_ok(o_conv);
35865         return tag_ptr(ret_conv, true);
35866 }
35867
35868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1err(JNIEnv *env, jclass clz) {
35869         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
35870         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_err();
35871         return tag_ptr(ret_conv, true);
35872 }
35873
35874 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35875         LDKCResult_TransactionU16LenLimitedNoneZ* o_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(o);
35876         jboolean ret_conv = CResult_TransactionU16LenLimitedNoneZ_is_ok(o_conv);
35877         return ret_conv;
35878 }
35879
35880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35881         if (!ptr_is_owned(_res)) return;
35882         void* _res_ptr = untag_ptr(_res);
35883         CHECK_ACCESS(_res_ptr);
35884         LDKCResult_TransactionU16LenLimitedNoneZ _res_conv = *(LDKCResult_TransactionU16LenLimitedNoneZ*)(_res_ptr);
35885         FREE(untag_ptr(_res));
35886         CResult_TransactionU16LenLimitedNoneZ_free(_res_conv);
35887 }
35888
35889 static inline uint64_t CResult_TransactionU16LenLimitedNoneZ_clone_ptr(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR arg) {
35890         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
35891         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(arg);
35892         return tag_ptr(ret_conv, true);
35893 }
35894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35895         LDKCResult_TransactionU16LenLimitedNoneZ* arg_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(arg);
35896         int64_t ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone_ptr(arg_conv);
35897         return ret_conv;
35898 }
35899
35900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35901         LDKCResult_TransactionU16LenLimitedNoneZ* orig_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(orig);
35902         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
35903         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(orig_conv);
35904         return tag_ptr(ret_conv, true);
35905 }
35906
35907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35908         LDKTransactionU16LenLimited o_conv;
35909         o_conv.inner = untag_ptr(o);
35910         o_conv.is_owned = ptr_is_owned(o);
35911         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35912         o_conv = TransactionU16LenLimited_clone(&o_conv);
35913         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
35914         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_ok(o_conv);
35915         return tag_ptr(ret_conv, true);
35916 }
35917
35918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35919         void* e_ptr = untag_ptr(e);
35920         CHECK_ACCESS(e_ptr);
35921         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35922         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35923         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
35924         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_err(e_conv);
35925         return tag_ptr(ret_conv, true);
35926 }
35927
35928 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35929         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* o_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(o);
35930         jboolean ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(o_conv);
35931         return ret_conv;
35932 }
35933
35934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35935         if (!ptr_is_owned(_res)) return;
35936         void* _res_ptr = untag_ptr(_res);
35937         CHECK_ACCESS(_res_ptr);
35938         LDKCResult_TransactionU16LenLimitedDecodeErrorZ _res_conv = *(LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)(_res_ptr);
35939         FREE(untag_ptr(_res));
35940         CResult_TransactionU16LenLimitedDecodeErrorZ_free(_res_conv);
35941 }
35942
35943 static inline uint64_t CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR arg) {
35944         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
35945         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(arg);
35946         return tag_ptr(ret_conv, true);
35947 }
35948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35949         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* arg_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(arg);
35950         int64_t ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(arg_conv);
35951         return ret_conv;
35952 }
35953
35954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35955         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* orig_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(orig);
35956         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
35957         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(orig_conv);
35958         return tag_ptr(ret_conv, true);
35959 }
35960
35961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35962         LDKUntrustedString o_conv;
35963         o_conv.inner = untag_ptr(o);
35964         o_conv.is_owned = ptr_is_owned(o);
35965         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35966         o_conv = UntrustedString_clone(&o_conv);
35967         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
35968         *ret_conv = CResult_UntrustedStringDecodeErrorZ_ok(o_conv);
35969         return tag_ptr(ret_conv, true);
35970 }
35971
35972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35973         void* e_ptr = untag_ptr(e);
35974         CHECK_ACCESS(e_ptr);
35975         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35976         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35977         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
35978         *ret_conv = CResult_UntrustedStringDecodeErrorZ_err(e_conv);
35979         return tag_ptr(ret_conv, true);
35980 }
35981
35982 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35983         LDKCResult_UntrustedStringDecodeErrorZ* o_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(o);
35984         jboolean ret_conv = CResult_UntrustedStringDecodeErrorZ_is_ok(o_conv);
35985         return ret_conv;
35986 }
35987
35988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35989         if (!ptr_is_owned(_res)) return;
35990         void* _res_ptr = untag_ptr(_res);
35991         CHECK_ACCESS(_res_ptr);
35992         LDKCResult_UntrustedStringDecodeErrorZ _res_conv = *(LDKCResult_UntrustedStringDecodeErrorZ*)(_res_ptr);
35993         FREE(untag_ptr(_res));
35994         CResult_UntrustedStringDecodeErrorZ_free(_res_conv);
35995 }
35996
35997 static inline uint64_t CResult_UntrustedStringDecodeErrorZ_clone_ptr(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR arg) {
35998         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
35999         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(arg);
36000         return tag_ptr(ret_conv, true);
36001 }
36002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36003         LDKCResult_UntrustedStringDecodeErrorZ* arg_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(arg);
36004         int64_t ret_conv = CResult_UntrustedStringDecodeErrorZ_clone_ptr(arg_conv);
36005         return ret_conv;
36006 }
36007
36008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36009         LDKCResult_UntrustedStringDecodeErrorZ* orig_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(orig);
36010         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
36011         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(orig_conv);
36012         return tag_ptr(ret_conv, true);
36013 }
36014
36015 static inline uint64_t C2Tuple__u832u16Z_clone_ptr(LDKC2Tuple__u832u16Z *NONNULL_PTR arg) {
36016         LDKC2Tuple__u832u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u832u16Z), "LDKC2Tuple__u832u16Z");
36017         *ret_conv = C2Tuple__u832u16Z_clone(arg);
36018         return tag_ptr(ret_conv, true);
36019 }
36020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u832u16Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36021         LDKC2Tuple__u832u16Z* arg_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(arg);
36022         int64_t ret_conv = C2Tuple__u832u16Z_clone_ptr(arg_conv);
36023         return ret_conv;
36024 }
36025
36026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u832u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36027         LDKC2Tuple__u832u16Z* orig_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(orig);
36028         LDKC2Tuple__u832u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u832u16Z), "LDKC2Tuple__u832u16Z");
36029         *ret_conv = C2Tuple__u832u16Z_clone(orig_conv);
36030         return tag_ptr(ret_conv, true);
36031 }
36032
36033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u832u16Z_1new(JNIEnv *env, jclass clz, int8_tArray a, int16_t b) {
36034         LDKThirtyTwoBytes a_ref;
36035         CHECK((*env)->GetArrayLength(env, a) == 32);
36036         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
36037         LDKC2Tuple__u832u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u832u16Z), "LDKC2Tuple__u832u16Z");
36038         *ret_conv = C2Tuple__u832u16Z_new(a_ref, b);
36039         return tag_ptr(ret_conv, true);
36040 }
36041
36042 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u832u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
36043         if (!ptr_is_owned(_res)) return;
36044         void* _res_ptr = untag_ptr(_res);
36045         CHECK_ACCESS(_res_ptr);
36046         LDKC2Tuple__u832u16Z _res_conv = *(LDKC2Tuple__u832u16Z*)(_res_ptr);
36047         FREE(untag_ptr(_res));
36048         C2Tuple__u832u16Z_free(_res_conv);
36049 }
36050
36051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36052         LDKPaymentRelay o_conv;
36053         o_conv.inner = untag_ptr(o);
36054         o_conv.is_owned = ptr_is_owned(o);
36055         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36056         o_conv = PaymentRelay_clone(&o_conv);
36057         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
36058         *ret_conv = CResult_PaymentRelayDecodeErrorZ_ok(o_conv);
36059         return tag_ptr(ret_conv, true);
36060 }
36061
36062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36063         void* e_ptr = untag_ptr(e);
36064         CHECK_ACCESS(e_ptr);
36065         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36066         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36067         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
36068         *ret_conv = CResult_PaymentRelayDecodeErrorZ_err(e_conv);
36069         return tag_ptr(ret_conv, true);
36070 }
36071
36072 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36073         LDKCResult_PaymentRelayDecodeErrorZ* o_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(o);
36074         jboolean ret_conv = CResult_PaymentRelayDecodeErrorZ_is_ok(o_conv);
36075         return ret_conv;
36076 }
36077
36078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36079         if (!ptr_is_owned(_res)) return;
36080         void* _res_ptr = untag_ptr(_res);
36081         CHECK_ACCESS(_res_ptr);
36082         LDKCResult_PaymentRelayDecodeErrorZ _res_conv = *(LDKCResult_PaymentRelayDecodeErrorZ*)(_res_ptr);
36083         FREE(untag_ptr(_res));
36084         CResult_PaymentRelayDecodeErrorZ_free(_res_conv);
36085 }
36086
36087 static inline uint64_t CResult_PaymentRelayDecodeErrorZ_clone_ptr(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR arg) {
36088         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
36089         *ret_conv = CResult_PaymentRelayDecodeErrorZ_clone(arg);
36090         return tag_ptr(ret_conv, true);
36091 }
36092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36093         LDKCResult_PaymentRelayDecodeErrorZ* arg_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(arg);
36094         int64_t ret_conv = CResult_PaymentRelayDecodeErrorZ_clone_ptr(arg_conv);
36095         return ret_conv;
36096 }
36097
36098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36099         LDKCResult_PaymentRelayDecodeErrorZ* orig_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(orig);
36100         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
36101         *ret_conv = CResult_PaymentRelayDecodeErrorZ_clone(orig_conv);
36102         return tag_ptr(ret_conv, true);
36103 }
36104
36105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36106         LDKPaymentConstraints o_conv;
36107         o_conv.inner = untag_ptr(o);
36108         o_conv.is_owned = ptr_is_owned(o);
36109         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36110         o_conv = PaymentConstraints_clone(&o_conv);
36111         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
36112         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_ok(o_conv);
36113         return tag_ptr(ret_conv, true);
36114 }
36115
36116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36117         void* e_ptr = untag_ptr(e);
36118         CHECK_ACCESS(e_ptr);
36119         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36120         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36121         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
36122         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_err(e_conv);
36123         return tag_ptr(ret_conv, true);
36124 }
36125
36126 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36127         LDKCResult_PaymentConstraintsDecodeErrorZ* o_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(o);
36128         jboolean ret_conv = CResult_PaymentConstraintsDecodeErrorZ_is_ok(o_conv);
36129         return ret_conv;
36130 }
36131
36132 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36133         if (!ptr_is_owned(_res)) return;
36134         void* _res_ptr = untag_ptr(_res);
36135         CHECK_ACCESS(_res_ptr);
36136         LDKCResult_PaymentConstraintsDecodeErrorZ _res_conv = *(LDKCResult_PaymentConstraintsDecodeErrorZ*)(_res_ptr);
36137         FREE(untag_ptr(_res));
36138         CResult_PaymentConstraintsDecodeErrorZ_free(_res_conv);
36139 }
36140
36141 static inline uint64_t CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR arg) {
36142         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
36143         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone(arg);
36144         return tag_ptr(ret_conv, true);
36145 }
36146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36147         LDKCResult_PaymentConstraintsDecodeErrorZ* arg_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(arg);
36148         int64_t ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(arg_conv);
36149         return ret_conv;
36150 }
36151
36152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36153         LDKCResult_PaymentConstraintsDecodeErrorZ* orig_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(orig);
36154         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
36155         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone(orig_conv);
36156         return tag_ptr(ret_conv, true);
36157 }
36158
36159 static inline uint64_t C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone_ptr(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR arg) {
36160         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
36161         *ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(arg);
36162         return tag_ptr(ret_conv, true);
36163 }
36164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36165         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* arg_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(arg);
36166         int64_t ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone_ptr(arg_conv);
36167         return ret_conv;
36168 }
36169
36170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36171         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* orig_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(orig);
36172         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
36173         *ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(orig_conv);
36174         return tag_ptr(ret_conv, true);
36175 }
36176
36177 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) {
36178         LDKThirtyTwoBytes a_ref;
36179         CHECK((*env)->GetArrayLength(env, a) == 32);
36180         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
36181         LDKRecipientOnionFields b_conv;
36182         b_conv.inner = untag_ptr(b);
36183         b_conv.is_owned = ptr_is_owned(b);
36184         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36185         b_conv = RecipientOnionFields_clone(&b_conv);
36186         LDKRouteParameters c_conv;
36187         c_conv.inner = untag_ptr(c);
36188         c_conv.is_owned = ptr_is_owned(c);
36189         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
36190         c_conv = RouteParameters_clone(&c_conv);
36191         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
36192         *ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_new(a_ref, b_conv, c_conv);
36193         return tag_ptr(ret_conv, true);
36194 }
36195
36196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36197         if (!ptr_is_owned(_res)) return;
36198         void* _res_ptr = untag_ptr(_res);
36199         CHECK_ACCESS(_res_ptr);
36200         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ _res_conv = *(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)(_res_ptr);
36201         FREE(untag_ptr(_res));
36202         C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_free(_res_conv);
36203 }
36204
36205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36206         void* o_ptr = untag_ptr(o);
36207         CHECK_ACCESS(o_ptr);
36208         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ o_conv = *(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)(o_ptr);
36209         o_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone((LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(o));
36210         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
36211         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_ok(o_conv);
36212         return tag_ptr(ret_conv, true);
36213 }
36214
36215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_1err(JNIEnv *env, jclass clz) {
36216         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
36217         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_err();
36218         return tag_ptr(ret_conv, true);
36219 }
36220
36221 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36222         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* o_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(o);
36223         jboolean ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_is_ok(o_conv);
36224         return ret_conv;
36225 }
36226
36227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36228         if (!ptr_is_owned(_res)) return;
36229         void* _res_ptr = untag_ptr(_res);
36230         CHECK_ACCESS(_res_ptr);
36231         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ _res_conv = *(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)(_res_ptr);
36232         FREE(untag_ptr(_res));
36233         CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_free(_res_conv);
36234 }
36235
36236 static inline uint64_t CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone_ptr(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR arg) {
36237         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
36238         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(arg);
36239         return tag_ptr(ret_conv, true);
36240 }
36241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36242         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* arg_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(arg);
36243         int64_t ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone_ptr(arg_conv);
36244         return ret_conv;
36245 }
36246
36247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36248         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* orig_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(orig);
36249         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
36250         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(orig_conv);
36251         return tag_ptr(ret_conv, true);
36252 }
36253
36254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1ok(JNIEnv *env, jclass clz, jstring o) {
36255         LDKStr o_conv = java_to_owned_str(env, o);
36256         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
36257         *ret_conv = CResult_StrSecp256k1ErrorZ_ok(o_conv);
36258         return tag_ptr(ret_conv, true);
36259 }
36260
36261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
36262         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
36263         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
36264         *ret_conv = CResult_StrSecp256k1ErrorZ_err(e_conv);
36265         return tag_ptr(ret_conv, true);
36266 }
36267
36268 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36269         LDKCResult_StrSecp256k1ErrorZ* o_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(o);
36270         jboolean ret_conv = CResult_StrSecp256k1ErrorZ_is_ok(o_conv);
36271         return ret_conv;
36272 }
36273
36274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36275         if (!ptr_is_owned(_res)) return;
36276         void* _res_ptr = untag_ptr(_res);
36277         CHECK_ACCESS(_res_ptr);
36278         LDKCResult_StrSecp256k1ErrorZ _res_conv = *(LDKCResult_StrSecp256k1ErrorZ*)(_res_ptr);
36279         FREE(untag_ptr(_res));
36280         CResult_StrSecp256k1ErrorZ_free(_res_conv);
36281 }
36282
36283 static inline uint64_t CResult_StrSecp256k1ErrorZ_clone_ptr(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR arg) {
36284         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
36285         *ret_conv = CResult_StrSecp256k1ErrorZ_clone(arg);
36286         return tag_ptr(ret_conv, true);
36287 }
36288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36289         LDKCResult_StrSecp256k1ErrorZ* arg_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(arg);
36290         int64_t ret_conv = CResult_StrSecp256k1ErrorZ_clone_ptr(arg_conv);
36291         return ret_conv;
36292 }
36293
36294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36295         LDKCResult_StrSecp256k1ErrorZ* orig_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(orig);
36296         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
36297         *ret_conv = CResult_StrSecp256k1ErrorZ_clone(orig_conv);
36298         return tag_ptr(ret_conv, true);
36299 }
36300
36301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36302         void* o_ptr = untag_ptr(o);
36303         CHECK_ACCESS(o_ptr);
36304         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
36305         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
36306         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
36307         *ret_conv = CResult_TxOutUtxoLookupErrorZ_ok(o_conv);
36308         return tag_ptr(ret_conv, true);
36309 }
36310
36311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
36312         LDKUtxoLookupError e_conv = LDKUtxoLookupError_from_java(env, e);
36313         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
36314         *ret_conv = CResult_TxOutUtxoLookupErrorZ_err(e_conv);
36315         return tag_ptr(ret_conv, true);
36316 }
36317
36318 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36319         LDKCResult_TxOutUtxoLookupErrorZ* o_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(o);
36320         jboolean ret_conv = CResult_TxOutUtxoLookupErrorZ_is_ok(o_conv);
36321         return ret_conv;
36322 }
36323
36324 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36325         if (!ptr_is_owned(_res)) return;
36326         void* _res_ptr = untag_ptr(_res);
36327         CHECK_ACCESS(_res_ptr);
36328         LDKCResult_TxOutUtxoLookupErrorZ _res_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(_res_ptr);
36329         FREE(untag_ptr(_res));
36330         CResult_TxOutUtxoLookupErrorZ_free(_res_conv);
36331 }
36332
36333 static inline uint64_t CResult_TxOutUtxoLookupErrorZ_clone_ptr(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR arg) {
36334         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
36335         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(arg);
36336         return tag_ptr(ret_conv, true);
36337 }
36338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36339         LDKCResult_TxOutUtxoLookupErrorZ* arg_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(arg);
36340         int64_t ret_conv = CResult_TxOutUtxoLookupErrorZ_clone_ptr(arg_conv);
36341         return ret_conv;
36342 }
36343
36344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36345         LDKCResult_TxOutUtxoLookupErrorZ* orig_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(orig);
36346         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
36347         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(orig_conv);
36348         return tag_ptr(ret_conv, true);
36349 }
36350
36351 static inline uint64_t C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone_ptr(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR arg) {
36352         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
36353         *ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(arg);
36354         return tag_ptr(ret_conv, true);
36355 }
36356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36357         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* arg_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(arg);
36358         int64_t ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone_ptr(arg_conv);
36359         return ret_conv;
36360 }
36361
36362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36363         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* orig_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(orig);
36364         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
36365         *ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(orig_conv);
36366         return tag_ptr(ret_conv, true);
36367 }
36368
36369 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) {
36370         LDKPublicKey a_ref;
36371         CHECK((*env)->GetArrayLength(env, a) == 33);
36372         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
36373         LDKOnionMessage b_conv;
36374         b_conv.inner = untag_ptr(b);
36375         b_conv.is_owned = ptr_is_owned(b);
36376         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36377         b_conv = OnionMessage_clone(&b_conv);
36378         void* c_ptr = untag_ptr(c);
36379         CHECK_ACCESS(c_ptr);
36380         LDKCOption_CVec_SocketAddressZZ c_conv = *(LDKCOption_CVec_SocketAddressZZ*)(c_ptr);
36381         c_conv = COption_CVec_SocketAddressZZ_clone((LDKCOption_CVec_SocketAddressZZ*)untag_ptr(c));
36382         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
36383         *ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_new(a_ref, b_conv, c_conv);
36384         return tag_ptr(ret_conv, true);
36385 }
36386
36387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36388         if (!ptr_is_owned(_res)) return;
36389         void* _res_ptr = untag_ptr(_res);
36390         CHECK_ACCESS(_res_ptr);
36391         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ _res_conv = *(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)(_res_ptr);
36392         FREE(untag_ptr(_res));
36393         C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_free(_res_conv);
36394 }
36395
36396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZSendErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36397         void* o_ptr = untag_ptr(o);
36398         CHECK_ACCESS(o_ptr);
36399         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ o_conv = *(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)(o_ptr);
36400         o_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone((LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(o));
36401         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
36402         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_ok(o_conv);
36403         return tag_ptr(ret_conv, true);
36404 }
36405
36406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZSendErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36407         void* e_ptr = untag_ptr(e);
36408         CHECK_ACCESS(e_ptr);
36409         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
36410         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
36411         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
36412         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_err(e_conv);
36413         return tag_ptr(ret_conv, true);
36414 }
36415
36416 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZSendErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36417         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* o_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(o);
36418         jboolean ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_is_ok(o_conv);
36419         return ret_conv;
36420 }
36421
36422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZSendErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36423         if (!ptr_is_owned(_res)) return;
36424         void* _res_ptr = untag_ptr(_res);
36425         CHECK_ACCESS(_res_ptr);
36426         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ _res_conv = *(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)(_res_ptr);
36427         FREE(untag_ptr(_res));
36428         CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_free(_res_conv);
36429 }
36430
36431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36432         void* o_ptr = untag_ptr(o);
36433         CHECK_ACCESS(o_ptr);
36434         LDKPeeledOnion o_conv = *(LDKPeeledOnion*)(o_ptr);
36435         o_conv = PeeledOnion_clone((LDKPeeledOnion*)untag_ptr(o));
36436         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
36437         *ret_conv = CResult_PeeledOnionNoneZ_ok(o_conv);
36438         return tag_ptr(ret_conv, true);
36439 }
36440
36441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1err(JNIEnv *env, jclass clz) {
36442         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
36443         *ret_conv = CResult_PeeledOnionNoneZ_err();
36444         return tag_ptr(ret_conv, true);
36445 }
36446
36447 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36448         LDKCResult_PeeledOnionNoneZ* o_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(o);
36449         jboolean ret_conv = CResult_PeeledOnionNoneZ_is_ok(o_conv);
36450         return ret_conv;
36451 }
36452
36453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36454         if (!ptr_is_owned(_res)) return;
36455         void* _res_ptr = untag_ptr(_res);
36456         CHECK_ACCESS(_res_ptr);
36457         LDKCResult_PeeledOnionNoneZ _res_conv = *(LDKCResult_PeeledOnionNoneZ*)(_res_ptr);
36458         FREE(untag_ptr(_res));
36459         CResult_PeeledOnionNoneZ_free(_res_conv);
36460 }
36461
36462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SendSuccessSendErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36463         void* o_ptr = untag_ptr(o);
36464         CHECK_ACCESS(o_ptr);
36465         LDKSendSuccess o_conv = *(LDKSendSuccess*)(o_ptr);
36466         o_conv = SendSuccess_clone((LDKSendSuccess*)untag_ptr(o));
36467         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
36468         *ret_conv = CResult_SendSuccessSendErrorZ_ok(o_conv);
36469         return tag_ptr(ret_conv, true);
36470 }
36471
36472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SendSuccessSendErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36473         void* e_ptr = untag_ptr(e);
36474         CHECK_ACCESS(e_ptr);
36475         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
36476         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
36477         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
36478         *ret_conv = CResult_SendSuccessSendErrorZ_err(e_conv);
36479         return tag_ptr(ret_conv, true);
36480 }
36481
36482 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SendSuccessSendErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36483         LDKCResult_SendSuccessSendErrorZ* o_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(o);
36484         jboolean ret_conv = CResult_SendSuccessSendErrorZ_is_ok(o_conv);
36485         return ret_conv;
36486 }
36487
36488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SendSuccessSendErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36489         if (!ptr_is_owned(_res)) return;
36490         void* _res_ptr = untag_ptr(_res);
36491         CHECK_ACCESS(_res_ptr);
36492         LDKCResult_SendSuccessSendErrorZ _res_conv = *(LDKCResult_SendSuccessSendErrorZ*)(_res_ptr);
36493         FREE(untag_ptr(_res));
36494         CResult_SendSuccessSendErrorZ_free(_res_conv);
36495 }
36496
36497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36498         LDKBlindedPath o_conv;
36499         o_conv.inner = untag_ptr(o);
36500         o_conv.is_owned = ptr_is_owned(o);
36501         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36502         o_conv = BlindedPath_clone(&o_conv);
36503         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
36504         *ret_conv = CResult_BlindedPathNoneZ_ok(o_conv);
36505         return tag_ptr(ret_conv, true);
36506 }
36507
36508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1err(JNIEnv *env, jclass clz) {
36509         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
36510         *ret_conv = CResult_BlindedPathNoneZ_err();
36511         return tag_ptr(ret_conv, true);
36512 }
36513
36514 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36515         LDKCResult_BlindedPathNoneZ* o_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(o);
36516         jboolean ret_conv = CResult_BlindedPathNoneZ_is_ok(o_conv);
36517         return ret_conv;
36518 }
36519
36520 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36521         if (!ptr_is_owned(_res)) return;
36522         void* _res_ptr = untag_ptr(_res);
36523         CHECK_ACCESS(_res_ptr);
36524         LDKCResult_BlindedPathNoneZ _res_conv = *(LDKCResult_BlindedPathNoneZ*)(_res_ptr);
36525         FREE(untag_ptr(_res));
36526         CResult_BlindedPathNoneZ_free(_res_conv);
36527 }
36528
36529 static inline uint64_t CResult_BlindedPathNoneZ_clone_ptr(LDKCResult_BlindedPathNoneZ *NONNULL_PTR arg) {
36530         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
36531         *ret_conv = CResult_BlindedPathNoneZ_clone(arg);
36532         return tag_ptr(ret_conv, true);
36533 }
36534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36535         LDKCResult_BlindedPathNoneZ* arg_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(arg);
36536         int64_t ret_conv = CResult_BlindedPathNoneZ_clone_ptr(arg_conv);
36537         return ret_conv;
36538 }
36539
36540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36541         LDKCResult_BlindedPathNoneZ* orig_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(orig);
36542         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
36543         *ret_conv = CResult_BlindedPathNoneZ_clone(orig_conv);
36544         return tag_ptr(ret_conv, true);
36545 }
36546
36547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36548         void* o_ptr = untag_ptr(o);
36549         CHECK_ACCESS(o_ptr);
36550         LDKC2Tuple_BlindedPayInfoBlindedPathZ o_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(o_ptr);
36551         o_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(o));
36552         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
36553         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(o_conv);
36554         return tag_ptr(ret_conv, true);
36555 }
36556
36557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1err(JNIEnv *env, jclass clz) {
36558         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
36559         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err();
36560         return tag_ptr(ret_conv, true);
36561 }
36562
36563 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36564         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* o_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(o);
36565         jboolean ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(o_conv);
36566         return ret_conv;
36567 }
36568
36569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36570         if (!ptr_is_owned(_res)) return;
36571         void* _res_ptr = untag_ptr(_res);
36572         CHECK_ACCESS(_res_ptr);
36573         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ _res_conv = *(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)(_res_ptr);
36574         FREE(untag_ptr(_res));
36575         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(_res_conv);
36576 }
36577
36578 static inline uint64_t CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR arg) {
36579         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
36580         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(arg);
36581         return tag_ptr(ret_conv, true);
36582 }
36583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36584         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* arg_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(arg);
36585         int64_t ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(arg_conv);
36586         return ret_conv;
36587 }
36588
36589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36590         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* orig_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(orig);
36591         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
36592         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(orig_conv);
36593         return tag_ptr(ret_conv, true);
36594 }
36595
36596 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ForwardNodeZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
36597         LDKCVec_ForwardNodeZ _res_constr;
36598         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
36599         if (_res_constr.datalen > 0)
36600                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKForwardNode), "LDKCVec_ForwardNodeZ Elements");
36601         else
36602                 _res_constr.data = NULL;
36603         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
36604         for (size_t n = 0; n < _res_constr.datalen; n++) {
36605                 int64_t _res_conv_13 = _res_vals[n];
36606                 LDKForwardNode _res_conv_13_conv;
36607                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
36608                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
36609                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
36610                 _res_constr.data[n] = _res_conv_13_conv;
36611         }
36612         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
36613         CVec_ForwardNodeZ_free(_res_constr);
36614 }
36615
36616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36617         LDKBlindedPath o_conv;
36618         o_conv.inner = untag_ptr(o);
36619         o_conv.is_owned = ptr_is_owned(o);
36620         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36621         o_conv = BlindedPath_clone(&o_conv);
36622         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
36623         *ret_conv = CResult_BlindedPathDecodeErrorZ_ok(o_conv);
36624         return tag_ptr(ret_conv, true);
36625 }
36626
36627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36628         void* e_ptr = untag_ptr(e);
36629         CHECK_ACCESS(e_ptr);
36630         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36631         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36632         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
36633         *ret_conv = CResult_BlindedPathDecodeErrorZ_err(e_conv);
36634         return tag_ptr(ret_conv, true);
36635 }
36636
36637 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36638         LDKCResult_BlindedPathDecodeErrorZ* o_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(o);
36639         jboolean ret_conv = CResult_BlindedPathDecodeErrorZ_is_ok(o_conv);
36640         return ret_conv;
36641 }
36642
36643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36644         if (!ptr_is_owned(_res)) return;
36645         void* _res_ptr = untag_ptr(_res);
36646         CHECK_ACCESS(_res_ptr);
36647         LDKCResult_BlindedPathDecodeErrorZ _res_conv = *(LDKCResult_BlindedPathDecodeErrorZ*)(_res_ptr);
36648         FREE(untag_ptr(_res));
36649         CResult_BlindedPathDecodeErrorZ_free(_res_conv);
36650 }
36651
36652 static inline uint64_t CResult_BlindedPathDecodeErrorZ_clone_ptr(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR arg) {
36653         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
36654         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(arg);
36655         return tag_ptr(ret_conv, true);
36656 }
36657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36658         LDKCResult_BlindedPathDecodeErrorZ* arg_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(arg);
36659         int64_t ret_conv = CResult_BlindedPathDecodeErrorZ_clone_ptr(arg_conv);
36660         return ret_conv;
36661 }
36662
36663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36664         LDKCResult_BlindedPathDecodeErrorZ* orig_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(orig);
36665         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
36666         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(orig_conv);
36667         return tag_ptr(ret_conv, true);
36668 }
36669
36670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36671         LDKBlindedHop o_conv;
36672         o_conv.inner = untag_ptr(o);
36673         o_conv.is_owned = ptr_is_owned(o);
36674         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36675         o_conv = BlindedHop_clone(&o_conv);
36676         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
36677         *ret_conv = CResult_BlindedHopDecodeErrorZ_ok(o_conv);
36678         return tag_ptr(ret_conv, true);
36679 }
36680
36681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36682         void* e_ptr = untag_ptr(e);
36683         CHECK_ACCESS(e_ptr);
36684         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36685         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36686         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
36687         *ret_conv = CResult_BlindedHopDecodeErrorZ_err(e_conv);
36688         return tag_ptr(ret_conv, true);
36689 }
36690
36691 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36692         LDKCResult_BlindedHopDecodeErrorZ* o_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(o);
36693         jboolean ret_conv = CResult_BlindedHopDecodeErrorZ_is_ok(o_conv);
36694         return ret_conv;
36695 }
36696
36697 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36698         if (!ptr_is_owned(_res)) return;
36699         void* _res_ptr = untag_ptr(_res);
36700         CHECK_ACCESS(_res_ptr);
36701         LDKCResult_BlindedHopDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopDecodeErrorZ*)(_res_ptr);
36702         FREE(untag_ptr(_res));
36703         CResult_BlindedHopDecodeErrorZ_free(_res_conv);
36704 }
36705
36706 static inline uint64_t CResult_BlindedHopDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR arg) {
36707         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
36708         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(arg);
36709         return tag_ptr(ret_conv, true);
36710 }
36711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36712         LDKCResult_BlindedHopDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(arg);
36713         int64_t ret_conv = CResult_BlindedHopDecodeErrorZ_clone_ptr(arg_conv);
36714         return ret_conv;
36715 }
36716
36717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36718         LDKCResult_BlindedHopDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(orig);
36719         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
36720         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(orig_conv);
36721         return tag_ptr(ret_conv, true);
36722 }
36723
36724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36725         LDKInvoiceError o_conv;
36726         o_conv.inner = untag_ptr(o);
36727         o_conv.is_owned = ptr_is_owned(o);
36728         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36729         o_conv = InvoiceError_clone(&o_conv);
36730         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
36731         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_ok(o_conv);
36732         return tag_ptr(ret_conv, true);
36733 }
36734
36735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36736         void* e_ptr = untag_ptr(e);
36737         CHECK_ACCESS(e_ptr);
36738         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36739         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36740         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
36741         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_err(e_conv);
36742         return tag_ptr(ret_conv, true);
36743 }
36744
36745 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36746         LDKCResult_InvoiceErrorDecodeErrorZ* o_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(o);
36747         jboolean ret_conv = CResult_InvoiceErrorDecodeErrorZ_is_ok(o_conv);
36748         return ret_conv;
36749 }
36750
36751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36752         if (!ptr_is_owned(_res)) return;
36753         void* _res_ptr = untag_ptr(_res);
36754         CHECK_ACCESS(_res_ptr);
36755         LDKCResult_InvoiceErrorDecodeErrorZ _res_conv = *(LDKCResult_InvoiceErrorDecodeErrorZ*)(_res_ptr);
36756         FREE(untag_ptr(_res));
36757         CResult_InvoiceErrorDecodeErrorZ_free(_res_conv);
36758 }
36759
36760 static inline uint64_t CResult_InvoiceErrorDecodeErrorZ_clone_ptr(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR arg) {
36761         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
36762         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(arg);
36763         return tag_ptr(ret_conv, true);
36764 }
36765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36766         LDKCResult_InvoiceErrorDecodeErrorZ* arg_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(arg);
36767         int64_t ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone_ptr(arg_conv);
36768         return ret_conv;
36769 }
36770
36771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36772         LDKCResult_InvoiceErrorDecodeErrorZ* orig_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(orig);
36773         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
36774         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(orig_conv);
36775         return tag_ptr(ret_conv, true);
36776 }
36777
36778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentBasepointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36779         LDKDelayedPaymentBasepoint o_conv;
36780         o_conv.inner = untag_ptr(o);
36781         o_conv.is_owned = ptr_is_owned(o);
36782         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36783         o_conv = DelayedPaymentBasepoint_clone(&o_conv);
36784         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
36785         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_ok(o_conv);
36786         return tag_ptr(ret_conv, true);
36787 }
36788
36789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentBasepointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36790         void* e_ptr = untag_ptr(e);
36791         CHECK_ACCESS(e_ptr);
36792         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36793         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36794         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
36795         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_err(e_conv);
36796         return tag_ptr(ret_conv, true);
36797 }
36798
36799 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentBasepointDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36800         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(o);
36801         jboolean ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_is_ok(o_conv);
36802         return ret_conv;
36803 }
36804
36805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentBasepointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36806         if (!ptr_is_owned(_res)) return;
36807         void* _res_ptr = untag_ptr(_res);
36808         CHECK_ACCESS(_res_ptr);
36809         LDKCResult_DelayedPaymentBasepointDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)(_res_ptr);
36810         FREE(untag_ptr(_res));
36811         CResult_DelayedPaymentBasepointDecodeErrorZ_free(_res_conv);
36812 }
36813
36814 static inline uint64_t CResult_DelayedPaymentBasepointDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR arg) {
36815         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
36816         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_clone(arg);
36817         return tag_ptr(ret_conv, true);
36818 }
36819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentBasepointDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36820         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(arg);
36821         int64_t ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_clone_ptr(arg_conv);
36822         return ret_conv;
36823 }
36824
36825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentBasepointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36826         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(orig);
36827         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
36828         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_clone(orig_conv);
36829         return tag_ptr(ret_conv, true);
36830 }
36831
36832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentKeyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36833         LDKDelayedPaymentKey o_conv;
36834         o_conv.inner = untag_ptr(o);
36835         o_conv.is_owned = ptr_is_owned(o);
36836         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36837         o_conv = DelayedPaymentKey_clone(&o_conv);
36838         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
36839         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_ok(o_conv);
36840         return tag_ptr(ret_conv, true);
36841 }
36842
36843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentKeyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36844         void* e_ptr = untag_ptr(e);
36845         CHECK_ACCESS(e_ptr);
36846         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36847         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36848         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
36849         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_err(e_conv);
36850         return tag_ptr(ret_conv, true);
36851 }
36852
36853 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentKeyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36854         LDKCResult_DelayedPaymentKeyDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(o);
36855         jboolean ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_is_ok(o_conv);
36856         return ret_conv;
36857 }
36858
36859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentKeyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36860         if (!ptr_is_owned(_res)) return;
36861         void* _res_ptr = untag_ptr(_res);
36862         CHECK_ACCESS(_res_ptr);
36863         LDKCResult_DelayedPaymentKeyDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentKeyDecodeErrorZ*)(_res_ptr);
36864         FREE(untag_ptr(_res));
36865         CResult_DelayedPaymentKeyDecodeErrorZ_free(_res_conv);
36866 }
36867
36868 static inline uint64_t CResult_DelayedPaymentKeyDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR arg) {
36869         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
36870         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_clone(arg);
36871         return tag_ptr(ret_conv, true);
36872 }
36873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentKeyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36874         LDKCResult_DelayedPaymentKeyDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(arg);
36875         int64_t ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_clone_ptr(arg_conv);
36876         return ret_conv;
36877 }
36878
36879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentKeyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36880         LDKCResult_DelayedPaymentKeyDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(orig);
36881         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
36882         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_clone(orig_conv);
36883         return tag_ptr(ret_conv, true);
36884 }
36885
36886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcBasepointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36887         LDKHtlcBasepoint o_conv;
36888         o_conv.inner = untag_ptr(o);
36889         o_conv.is_owned = ptr_is_owned(o);
36890         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36891         o_conv = HtlcBasepoint_clone(&o_conv);
36892         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
36893         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_ok(o_conv);
36894         return tag_ptr(ret_conv, true);
36895 }
36896
36897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcBasepointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36898         void* e_ptr = untag_ptr(e);
36899         CHECK_ACCESS(e_ptr);
36900         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36901         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36902         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
36903         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_err(e_conv);
36904         return tag_ptr(ret_conv, true);
36905 }
36906
36907 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcBasepointDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36908         LDKCResult_HtlcBasepointDecodeErrorZ* o_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(o);
36909         jboolean ret_conv = CResult_HtlcBasepointDecodeErrorZ_is_ok(o_conv);
36910         return ret_conv;
36911 }
36912
36913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcBasepointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36914         if (!ptr_is_owned(_res)) return;
36915         void* _res_ptr = untag_ptr(_res);
36916         CHECK_ACCESS(_res_ptr);
36917         LDKCResult_HtlcBasepointDecodeErrorZ _res_conv = *(LDKCResult_HtlcBasepointDecodeErrorZ*)(_res_ptr);
36918         FREE(untag_ptr(_res));
36919         CResult_HtlcBasepointDecodeErrorZ_free(_res_conv);
36920 }
36921
36922 static inline uint64_t CResult_HtlcBasepointDecodeErrorZ_clone_ptr(LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR arg) {
36923         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
36924         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_clone(arg);
36925         return tag_ptr(ret_conv, true);
36926 }
36927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcBasepointDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36928         LDKCResult_HtlcBasepointDecodeErrorZ* arg_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(arg);
36929         int64_t ret_conv = CResult_HtlcBasepointDecodeErrorZ_clone_ptr(arg_conv);
36930         return ret_conv;
36931 }
36932
36933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcBasepointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36934         LDKCResult_HtlcBasepointDecodeErrorZ* orig_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(orig);
36935         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
36936         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_clone(orig_conv);
36937         return tag_ptr(ret_conv, true);
36938 }
36939
36940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcKeyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36941         LDKHtlcKey o_conv;
36942         o_conv.inner = untag_ptr(o);
36943         o_conv.is_owned = ptr_is_owned(o);
36944         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36945         o_conv = HtlcKey_clone(&o_conv);
36946         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
36947         *ret_conv = CResult_HtlcKeyDecodeErrorZ_ok(o_conv);
36948         return tag_ptr(ret_conv, true);
36949 }
36950
36951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcKeyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36952         void* e_ptr = untag_ptr(e);
36953         CHECK_ACCESS(e_ptr);
36954         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36955         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36956         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
36957         *ret_conv = CResult_HtlcKeyDecodeErrorZ_err(e_conv);
36958         return tag_ptr(ret_conv, true);
36959 }
36960
36961 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcKeyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36962         LDKCResult_HtlcKeyDecodeErrorZ* o_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(o);
36963         jboolean ret_conv = CResult_HtlcKeyDecodeErrorZ_is_ok(o_conv);
36964         return ret_conv;
36965 }
36966
36967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcKeyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36968         if (!ptr_is_owned(_res)) return;
36969         void* _res_ptr = untag_ptr(_res);
36970         CHECK_ACCESS(_res_ptr);
36971         LDKCResult_HtlcKeyDecodeErrorZ _res_conv = *(LDKCResult_HtlcKeyDecodeErrorZ*)(_res_ptr);
36972         FREE(untag_ptr(_res));
36973         CResult_HtlcKeyDecodeErrorZ_free(_res_conv);
36974 }
36975
36976 static inline uint64_t CResult_HtlcKeyDecodeErrorZ_clone_ptr(LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR arg) {
36977         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
36978         *ret_conv = CResult_HtlcKeyDecodeErrorZ_clone(arg);
36979         return tag_ptr(ret_conv, true);
36980 }
36981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcKeyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36982         LDKCResult_HtlcKeyDecodeErrorZ* arg_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(arg);
36983         int64_t ret_conv = CResult_HtlcKeyDecodeErrorZ_clone_ptr(arg_conv);
36984         return ret_conv;
36985 }
36986
36987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcKeyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36988         LDKCResult_HtlcKeyDecodeErrorZ* orig_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(orig);
36989         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
36990         *ret_conv = CResult_HtlcKeyDecodeErrorZ_clone(orig_conv);
36991         return tag_ptr(ret_conv, true);
36992 }
36993
36994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationBasepointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36995         LDKRevocationBasepoint o_conv;
36996         o_conv.inner = untag_ptr(o);
36997         o_conv.is_owned = ptr_is_owned(o);
36998         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36999         o_conv = RevocationBasepoint_clone(&o_conv);
37000         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
37001         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_ok(o_conv);
37002         return tag_ptr(ret_conv, true);
37003 }
37004
37005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationBasepointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
37006         void* e_ptr = untag_ptr(e);
37007         CHECK_ACCESS(e_ptr);
37008         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
37009         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
37010         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
37011         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_err(e_conv);
37012         return tag_ptr(ret_conv, true);
37013 }
37014
37015 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationBasepointDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37016         LDKCResult_RevocationBasepointDecodeErrorZ* o_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(o);
37017         jboolean ret_conv = CResult_RevocationBasepointDecodeErrorZ_is_ok(o_conv);
37018         return ret_conv;
37019 }
37020
37021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationBasepointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37022         if (!ptr_is_owned(_res)) return;
37023         void* _res_ptr = untag_ptr(_res);
37024         CHECK_ACCESS(_res_ptr);
37025         LDKCResult_RevocationBasepointDecodeErrorZ _res_conv = *(LDKCResult_RevocationBasepointDecodeErrorZ*)(_res_ptr);
37026         FREE(untag_ptr(_res));
37027         CResult_RevocationBasepointDecodeErrorZ_free(_res_conv);
37028 }
37029
37030 static inline uint64_t CResult_RevocationBasepointDecodeErrorZ_clone_ptr(LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR arg) {
37031         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
37032         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_clone(arg);
37033         return tag_ptr(ret_conv, true);
37034 }
37035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationBasepointDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37036         LDKCResult_RevocationBasepointDecodeErrorZ* arg_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(arg);
37037         int64_t ret_conv = CResult_RevocationBasepointDecodeErrorZ_clone_ptr(arg_conv);
37038         return ret_conv;
37039 }
37040
37041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationBasepointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37042         LDKCResult_RevocationBasepointDecodeErrorZ* orig_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(orig);
37043         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
37044         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_clone(orig_conv);
37045         return tag_ptr(ret_conv, true);
37046 }
37047
37048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationKeyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
37049         LDKRevocationKey o_conv;
37050         o_conv.inner = untag_ptr(o);
37051         o_conv.is_owned = ptr_is_owned(o);
37052         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37053         o_conv = RevocationKey_clone(&o_conv);
37054         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
37055         *ret_conv = CResult_RevocationKeyDecodeErrorZ_ok(o_conv);
37056         return tag_ptr(ret_conv, true);
37057 }
37058
37059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationKeyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
37060         void* e_ptr = untag_ptr(e);
37061         CHECK_ACCESS(e_ptr);
37062         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
37063         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
37064         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
37065         *ret_conv = CResult_RevocationKeyDecodeErrorZ_err(e_conv);
37066         return tag_ptr(ret_conv, true);
37067 }
37068
37069 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationKeyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37070         LDKCResult_RevocationKeyDecodeErrorZ* o_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(o);
37071         jboolean ret_conv = CResult_RevocationKeyDecodeErrorZ_is_ok(o_conv);
37072         return ret_conv;
37073 }
37074
37075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationKeyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37076         if (!ptr_is_owned(_res)) return;
37077         void* _res_ptr = untag_ptr(_res);
37078         CHECK_ACCESS(_res_ptr);
37079         LDKCResult_RevocationKeyDecodeErrorZ _res_conv = *(LDKCResult_RevocationKeyDecodeErrorZ*)(_res_ptr);
37080         FREE(untag_ptr(_res));
37081         CResult_RevocationKeyDecodeErrorZ_free(_res_conv);
37082 }
37083
37084 static inline uint64_t CResult_RevocationKeyDecodeErrorZ_clone_ptr(LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR arg) {
37085         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
37086         *ret_conv = CResult_RevocationKeyDecodeErrorZ_clone(arg);
37087         return tag_ptr(ret_conv, true);
37088 }
37089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationKeyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37090         LDKCResult_RevocationKeyDecodeErrorZ* arg_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(arg);
37091         int64_t ret_conv = CResult_RevocationKeyDecodeErrorZ_clone_ptr(arg_conv);
37092         return ret_conv;
37093 }
37094
37095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationKeyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37096         LDKCResult_RevocationKeyDecodeErrorZ* orig_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(orig);
37097         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
37098         *ret_conv = CResult_RevocationKeyDecodeErrorZ_clone(orig_conv);
37099         return tag_ptr(ret_conv, true);
37100 }
37101
37102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1some(JNIEnv *env, jclass clz, int64_t o) {
37103         void* o_ptr = untag_ptr(o);
37104         CHECK_ACCESS(o_ptr);
37105         LDKFilter o_conv = *(LDKFilter*)(o_ptr);
37106         if (o_conv.free == LDKFilter_JCalls_free) {
37107                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37108                 LDKFilter_JCalls_cloned(&o_conv);
37109         }
37110         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
37111         *ret_copy = COption_FilterZ_some(o_conv);
37112         int64_t ret_ref = tag_ptr(ret_copy, true);
37113         return ret_ref;
37114 }
37115
37116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1none(JNIEnv *env, jclass clz) {
37117         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
37118         *ret_copy = COption_FilterZ_none();
37119         int64_t ret_ref = tag_ptr(ret_copy, true);
37120         return ret_ref;
37121 }
37122
37123 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37124         if (!ptr_is_owned(_res)) return;
37125         void* _res_ptr = untag_ptr(_res);
37126         CHECK_ACCESS(_res_ptr);
37127         LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
37128         FREE(untag_ptr(_res));
37129         COption_FilterZ_free(_res_conv);
37130 }
37131
37132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
37133         LDKLockedChannelMonitor o_conv;
37134         o_conv.inner = untag_ptr(o);
37135         o_conv.is_owned = ptr_is_owned(o);
37136         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37137         // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
37138         
37139         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
37140         *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
37141         return tag_ptr(ret_conv, true);
37142 }
37143
37144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1err(JNIEnv *env, jclass clz) {
37145         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
37146         *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
37147         return tag_ptr(ret_conv, true);
37148 }
37149
37150 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37151         LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(o);
37152         jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
37153         return ret_conv;
37154 }
37155
37156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37157         if (!ptr_is_owned(_res)) return;
37158         void* _res_ptr = untag_ptr(_res);
37159         CHECK_ACCESS(_res_ptr);
37160         LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
37161         FREE(untag_ptr(_res));
37162         CResult_LockedChannelMonitorNoneZ_free(_res_conv);
37163 }
37164
37165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1OutPointZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
37166         LDKCVec_OutPointZ _res_constr;
37167         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
37168         if (_res_constr.datalen > 0)
37169                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
37170         else
37171                 _res_constr.data = NULL;
37172         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
37173         for (size_t k = 0; k < _res_constr.datalen; k++) {
37174                 int64_t _res_conv_10 = _res_vals[k];
37175                 LDKOutPoint _res_conv_10_conv;
37176                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
37177                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
37178                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
37179                 _res_constr.data[k] = _res_conv_10_conv;
37180         }
37181         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
37182         CVec_OutPointZ_free(_res_constr);
37183 }
37184
37185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorUpdateIdZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
37186         LDKCVec_MonitorUpdateIdZ _res_constr;
37187         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
37188         if (_res_constr.datalen > 0)
37189                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
37190         else
37191                 _res_constr.data = NULL;
37192         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
37193         for (size_t r = 0; r < _res_constr.datalen; r++) {
37194                 int64_t _res_conv_17 = _res_vals[r];
37195                 LDKMonitorUpdateId _res_conv_17_conv;
37196                 _res_conv_17_conv.inner = untag_ptr(_res_conv_17);
37197                 _res_conv_17_conv.is_owned = ptr_is_owned(_res_conv_17);
37198                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_17_conv);
37199                 _res_constr.data[r] = _res_conv_17_conv;
37200         }
37201         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
37202         CVec_MonitorUpdateIdZ_free(_res_constr);
37203 }
37204
37205 static inline uint64_t C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR arg) {
37206         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
37207         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(arg);
37208         return tag_ptr(ret_conv, true);
37209 }
37210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37211         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* arg_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(arg);
37212         int64_t ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(arg_conv);
37213         return ret_conv;
37214 }
37215
37216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37217         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* orig_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(orig);
37218         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
37219         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig_conv);
37220         return tag_ptr(ret_conv, true);
37221 }
37222
37223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_tArray b) {
37224         LDKOutPoint a_conv;
37225         a_conv.inner = untag_ptr(a);
37226         a_conv.is_owned = ptr_is_owned(a);
37227         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37228         a_conv = OutPoint_clone(&a_conv);
37229         LDKCVec_MonitorUpdateIdZ b_constr;
37230         b_constr.datalen = (*env)->GetArrayLength(env, b);
37231         if (b_constr.datalen > 0)
37232                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
37233         else
37234                 b_constr.data = NULL;
37235         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
37236         for (size_t r = 0; r < b_constr.datalen; r++) {
37237                 int64_t b_conv_17 = b_vals[r];
37238                 LDKMonitorUpdateId b_conv_17_conv;
37239                 b_conv_17_conv.inner = untag_ptr(b_conv_17);
37240                 b_conv_17_conv.is_owned = ptr_is_owned(b_conv_17);
37241                 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv_17_conv);
37242                 b_conv_17_conv = MonitorUpdateId_clone(&b_conv_17_conv);
37243                 b_constr.data[r] = b_conv_17_conv;
37244         }
37245         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
37246         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
37247         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a_conv, b_constr);
37248         return tag_ptr(ret_conv, true);
37249 }
37250
37251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37252         if (!ptr_is_owned(_res)) return;
37253         void* _res_ptr = untag_ptr(_res);
37254         CHECK_ACCESS(_res_ptr);
37255         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_ptr);
37256         FREE(untag_ptr(_res));
37257         C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res_conv);
37258 }
37259
37260 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1OutPointCVec_1MonitorUpdateIdZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
37261         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res_constr;
37262         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
37263         if (_res_constr.datalen > 0)
37264                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ Elements");
37265         else
37266                 _res_constr.data = NULL;
37267         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
37268         for (size_t p = 0; p < _res_constr.datalen; p++) {
37269                 int64_t _res_conv_41 = _res_vals[p];
37270                 void* _res_conv_41_ptr = untag_ptr(_res_conv_41);
37271                 CHECK_ACCESS(_res_conv_41_ptr);
37272                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv_41_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_conv_41_ptr);
37273                 FREE(untag_ptr(_res_conv_41));
37274                 _res_constr.data[p] = _res_conv_41_conv;
37275         }
37276         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
37277         CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res_constr);
37278 }
37279
37280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37281         if (!ptr_is_owned(this_ptr)) return;
37282         void* this_ptr_ptr = untag_ptr(this_ptr);
37283         CHECK_ACCESS(this_ptr_ptr);
37284         LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
37285         FREE(untag_ptr(this_ptr));
37286         APIError_free(this_ptr_conv);
37287 }
37288
37289 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
37290         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
37291         *ret_copy = APIError_clone(arg);
37292         int64_t ret_ref = tag_ptr(ret_copy, true);
37293         return ret_ref;
37294 }
37295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37296         LDKAPIError* arg_conv = (LDKAPIError*)untag_ptr(arg);
37297         int64_t ret_conv = APIError_clone_ptr(arg_conv);
37298         return ret_conv;
37299 }
37300
37301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37302         LDKAPIError* orig_conv = (LDKAPIError*)untag_ptr(orig);
37303         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
37304         *ret_copy = APIError_clone(orig_conv);
37305         int64_t ret_ref = tag_ptr(ret_copy, true);
37306         return ret_ref;
37307 }
37308
37309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1apimisuse_1error(JNIEnv *env, jclass clz, jstring err) {
37310         LDKStr err_conv = java_to_owned_str(env, err);
37311         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
37312         *ret_copy = APIError_apimisuse_error(err_conv);
37313         int64_t ret_ref = tag_ptr(ret_copy, true);
37314         return ret_ref;
37315 }
37316
37317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1fee_1rate_1too_1high(JNIEnv *env, jclass clz, jstring err, int32_t feerate) {
37318         LDKStr err_conv = java_to_owned_str(env, err);
37319         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
37320         *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
37321         int64_t ret_ref = tag_ptr(ret_copy, true);
37322         return ret_ref;
37323 }
37324
37325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1invalid_1route(JNIEnv *env, jclass clz, jstring err) {
37326         LDKStr err_conv = java_to_owned_str(env, err);
37327         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
37328         *ret_copy = APIError_invalid_route(err_conv);
37329         int64_t ret_ref = tag_ptr(ret_copy, true);
37330         return ret_ref;
37331 }
37332
37333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1channel_1unavailable(JNIEnv *env, jclass clz, jstring err) {
37334         LDKStr err_conv = java_to_owned_str(env, err);
37335         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
37336         *ret_copy = APIError_channel_unavailable(err_conv);
37337         int64_t ret_ref = tag_ptr(ret_copy, true);
37338         return ret_ref;
37339 }
37340
37341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1monitor_1update_1in_1progress(JNIEnv *env, jclass clz) {
37342         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
37343         *ret_copy = APIError_monitor_update_in_progress();
37344         int64_t ret_ref = tag_ptr(ret_copy, true);
37345         return ret_ref;
37346 }
37347
37348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1incompatible_1shutdown_1script(JNIEnv *env, jclass clz, int64_t script) {
37349         LDKShutdownScript script_conv;
37350         script_conv.inner = untag_ptr(script);
37351         script_conv.is_owned = ptr_is_owned(script);
37352         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
37353         script_conv = ShutdownScript_clone(&script_conv);
37354         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
37355         *ret_copy = APIError_incompatible_shutdown_script(script_conv);
37356         int64_t ret_ref = tag_ptr(ret_copy, true);
37357         return ret_ref;
37358 }
37359
37360 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_APIError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
37361         LDKAPIError* a_conv = (LDKAPIError*)untag_ptr(a);
37362         LDKAPIError* b_conv = (LDKAPIError*)untag_ptr(b);
37363         jboolean ret_conv = APIError_eq(a_conv, b_conv);
37364         return ret_conv;
37365 }
37366
37367 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_APIError_1write(JNIEnv *env, jclass clz, int64_t obj) {
37368         LDKAPIError* obj_conv = (LDKAPIError*)untag_ptr(obj);
37369         LDKCVec_u8Z ret_var = APIError_write(obj_conv);
37370         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37371         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37372         CVec_u8Z_free(ret_var);
37373         return ret_arr;
37374 }
37375
37376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37377         LDKu8slice ser_ref;
37378         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37379         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37380         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
37381         *ret_conv = APIError_read(ser_ref);
37382         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37383         return tag_ptr(ret_conv, true);
37384 }
37385
37386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigSize_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37387         LDKBigSize this_obj_conv;
37388         this_obj_conv.inner = untag_ptr(this_obj);
37389         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37391         BigSize_free(this_obj_conv);
37392 }
37393
37394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
37395         LDKBigSize this_ptr_conv;
37396         this_ptr_conv.inner = untag_ptr(this_ptr);
37397         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37399         this_ptr_conv.is_owned = false;
37400         int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
37401         return ret_conv;
37402 }
37403
37404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigSize_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37405         LDKBigSize this_ptr_conv;
37406         this_ptr_conv.inner = untag_ptr(this_ptr);
37407         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37409         this_ptr_conv.is_owned = false;
37410         BigSize_set_a(&this_ptr_conv, val);
37411 }
37412
37413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
37414         LDKBigSize ret_var = BigSize_new(a_arg);
37415         int64_t ret_ref = 0;
37416         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37417         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37418         return ret_ref;
37419 }
37420
37421 static inline uint64_t BigSize_clone_ptr(LDKBigSize *NONNULL_PTR arg) {
37422         LDKBigSize ret_var = BigSize_clone(arg);
37423         int64_t ret_ref = 0;
37424         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37425         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37426         return ret_ref;
37427 }
37428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37429         LDKBigSize arg_conv;
37430         arg_conv.inner = untag_ptr(arg);
37431         arg_conv.is_owned = ptr_is_owned(arg);
37432         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37433         arg_conv.is_owned = false;
37434         int64_t ret_conv = BigSize_clone_ptr(&arg_conv);
37435         return ret_conv;
37436 }
37437
37438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37439         LDKBigSize orig_conv;
37440         orig_conv.inner = untag_ptr(orig);
37441         orig_conv.is_owned = ptr_is_owned(orig);
37442         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37443         orig_conv.is_owned = false;
37444         LDKBigSize ret_var = BigSize_clone(&orig_conv);
37445         int64_t ret_ref = 0;
37446         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37447         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37448         return ret_ref;
37449 }
37450
37451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1hash(JNIEnv *env, jclass clz, int64_t o) {
37452         LDKBigSize o_conv;
37453         o_conv.inner = untag_ptr(o);
37454         o_conv.is_owned = ptr_is_owned(o);
37455         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37456         o_conv.is_owned = false;
37457         int64_t ret_conv = BigSize_hash(&o_conv);
37458         return ret_conv;
37459 }
37460
37461 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BigSize_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
37462         LDKBigSize a_conv;
37463         a_conv.inner = untag_ptr(a);
37464         a_conv.is_owned = ptr_is_owned(a);
37465         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37466         a_conv.is_owned = false;
37467         LDKBigSize b_conv;
37468         b_conv.inner = untag_ptr(b);
37469         b_conv.is_owned = ptr_is_owned(b);
37470         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37471         b_conv.is_owned = false;
37472         jboolean ret_conv = BigSize_eq(&a_conv, &b_conv);
37473         return ret_conv;
37474 }
37475
37476 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BigSize_1write(JNIEnv *env, jclass clz, int64_t obj) {
37477         LDKBigSize obj_conv;
37478         obj_conv.inner = untag_ptr(obj);
37479         obj_conv.is_owned = ptr_is_owned(obj);
37480         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37481         obj_conv.is_owned = false;
37482         LDKCVec_u8Z ret_var = BigSize_write(&obj_conv);
37483         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37484         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37485         CVec_u8Z_free(ret_var);
37486         return ret_arr;
37487 }
37488
37489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37490         LDKu8slice ser_ref;
37491         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37492         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37493         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
37494         *ret_conv = BigSize_read(ser_ref);
37495         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37496         return tag_ptr(ret_conv, true);
37497 }
37498
37499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Hostname_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37500         LDKHostname this_obj_conv;
37501         this_obj_conv.inner = untag_ptr(this_obj);
37502         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37504         Hostname_free(this_obj_conv);
37505 }
37506
37507 static inline uint64_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
37508         LDKHostname ret_var = Hostname_clone(arg);
37509         int64_t ret_ref = 0;
37510         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37511         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37512         return ret_ref;
37513 }
37514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37515         LDKHostname arg_conv;
37516         arg_conv.inner = untag_ptr(arg);
37517         arg_conv.is_owned = ptr_is_owned(arg);
37518         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37519         arg_conv.is_owned = false;
37520         int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
37521         return ret_conv;
37522 }
37523
37524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37525         LDKHostname orig_conv;
37526         orig_conv.inner = untag_ptr(orig);
37527         orig_conv.is_owned = ptr_is_owned(orig);
37528         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37529         orig_conv.is_owned = false;
37530         LDKHostname ret_var = Hostname_clone(&orig_conv);
37531         int64_t ret_ref = 0;
37532         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37533         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37534         return ret_ref;
37535 }
37536
37537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1hash(JNIEnv *env, jclass clz, int64_t o) {
37538         LDKHostname o_conv;
37539         o_conv.inner = untag_ptr(o);
37540         o_conv.is_owned = ptr_is_owned(o);
37541         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37542         o_conv.is_owned = false;
37543         int64_t ret_conv = Hostname_hash(&o_conv);
37544         return ret_conv;
37545 }
37546
37547 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Hostname_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
37548         LDKHostname a_conv;
37549         a_conv.inner = untag_ptr(a);
37550         a_conv.is_owned = ptr_is_owned(a);
37551         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37552         a_conv.is_owned = false;
37553         LDKHostname b_conv;
37554         b_conv.inner = untag_ptr(b);
37555         b_conv.is_owned = ptr_is_owned(b);
37556         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37557         b_conv.is_owned = false;
37558         jboolean ret_conv = Hostname_eq(&a_conv, &b_conv);
37559         return ret_conv;
37560 }
37561
37562 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_Hostname_1len(JNIEnv *env, jclass clz, int64_t this_arg) {
37563         LDKHostname this_arg_conv;
37564         this_arg_conv.inner = untag_ptr(this_arg);
37565         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37567         this_arg_conv.is_owned = false;
37568         int8_t ret_conv = Hostname_len(&this_arg_conv);
37569         return ret_conv;
37570 }
37571
37572 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Hostname_1write(JNIEnv *env, jclass clz, int64_t obj) {
37573         LDKHostname obj_conv;
37574         obj_conv.inner = untag_ptr(obj);
37575         obj_conv.is_owned = ptr_is_owned(obj);
37576         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37577         obj_conv.is_owned = false;
37578         LDKCVec_u8Z ret_var = Hostname_write(&obj_conv);
37579         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37580         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37581         CVec_u8Z_free(ret_var);
37582         return ret_arr;
37583 }
37584
37585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37586         LDKu8slice ser_ref;
37587         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37588         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37589         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
37590         *ret_conv = Hostname_read(ser_ref);
37591         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37592         return tag_ptr(ret_conv, true);
37593 }
37594
37595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37596         LDKTransactionU16LenLimited this_obj_conv;
37597         this_obj_conv.inner = untag_ptr(this_obj);
37598         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37600         TransactionU16LenLimited_free(this_obj_conv);
37601 }
37602
37603 static inline uint64_t TransactionU16LenLimited_clone_ptr(LDKTransactionU16LenLimited *NONNULL_PTR arg) {
37604         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(arg);
37605         int64_t ret_ref = 0;
37606         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37607         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37608         return ret_ref;
37609 }
37610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37611         LDKTransactionU16LenLimited arg_conv;
37612         arg_conv.inner = untag_ptr(arg);
37613         arg_conv.is_owned = ptr_is_owned(arg);
37614         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37615         arg_conv.is_owned = false;
37616         int64_t ret_conv = TransactionU16LenLimited_clone_ptr(&arg_conv);
37617         return ret_conv;
37618 }
37619
37620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37621         LDKTransactionU16LenLimited orig_conv;
37622         orig_conv.inner = untag_ptr(orig);
37623         orig_conv.is_owned = ptr_is_owned(orig);
37624         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37625         orig_conv.is_owned = false;
37626         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(&orig_conv);
37627         int64_t ret_ref = 0;
37628         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37629         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37630         return ret_ref;
37631 }
37632
37633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1hash(JNIEnv *env, jclass clz, int64_t o) {
37634         LDKTransactionU16LenLimited o_conv;
37635         o_conv.inner = untag_ptr(o);
37636         o_conv.is_owned = ptr_is_owned(o);
37637         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37638         o_conv.is_owned = false;
37639         int64_t ret_conv = TransactionU16LenLimited_hash(&o_conv);
37640         return ret_conv;
37641 }
37642
37643 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
37644         LDKTransactionU16LenLimited a_conv;
37645         a_conv.inner = untag_ptr(a);
37646         a_conv.is_owned = ptr_is_owned(a);
37647         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37648         a_conv.is_owned = false;
37649         LDKTransactionU16LenLimited b_conv;
37650         b_conv.inner = untag_ptr(b);
37651         b_conv.is_owned = ptr_is_owned(b);
37652         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37653         b_conv.is_owned = false;
37654         jboolean ret_conv = TransactionU16LenLimited_eq(&a_conv, &b_conv);
37655         return ret_conv;
37656 }
37657
37658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1new(JNIEnv *env, jclass clz, int8_tArray transaction) {
37659         LDKTransaction transaction_ref;
37660         transaction_ref.datalen = (*env)->GetArrayLength(env, transaction);
37661         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
37662         (*env)->GetByteArrayRegion(env, transaction, 0, transaction_ref.datalen, transaction_ref.data);
37663         transaction_ref.data_is_owned = true;
37664         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
37665         *ret_conv = TransactionU16LenLimited_new(transaction_ref);
37666         return tag_ptr(ret_conv, true);
37667 }
37668
37669 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1into_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
37670         LDKTransactionU16LenLimited this_arg_conv;
37671         this_arg_conv.inner = untag_ptr(this_arg);
37672         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37674         this_arg_conv = TransactionU16LenLimited_clone(&this_arg_conv);
37675         LDKTransaction ret_var = TransactionU16LenLimited_into_transaction(this_arg_conv);
37676         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37677         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37678         Transaction_free(ret_var);
37679         return ret_arr;
37680 }
37681
37682 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1write(JNIEnv *env, jclass clz, int64_t obj) {
37683         LDKTransactionU16LenLimited obj_conv;
37684         obj_conv.inner = untag_ptr(obj);
37685         obj_conv.is_owned = ptr_is_owned(obj);
37686         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37687         obj_conv.is_owned = false;
37688         LDKCVec_u8Z ret_var = TransactionU16LenLimited_write(&obj_conv);
37689         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37690         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37691         CVec_u8Z_free(ret_var);
37692         return ret_arr;
37693 }
37694
37695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37696         LDKu8slice ser_ref;
37697         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37698         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37699         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
37700         *ret_conv = TransactionU16LenLimited_read(ser_ref);
37701         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37702         return tag_ptr(ret_conv, true);
37703 }
37704
37705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass clz, int8_tArray msg, int8_tArray sk) {
37706         LDKu8slice msg_ref;
37707         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
37708         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
37709         uint8_t sk_arr[32];
37710         CHECK((*env)->GetArrayLength(env, sk) == 32);
37711         (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr);
37712         uint8_t (*sk_ref)[32] = &sk_arr;
37713         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
37714         *ret_conv = sign(msg_ref, sk_ref);
37715         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
37716         return tag_ptr(ret_conv, true);
37717 }
37718
37719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_recover_1pk(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig) {
37720         LDKu8slice msg_ref;
37721         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
37722         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
37723         LDKStr sig_conv = java_to_owned_str(env, sig);
37724         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
37725         *ret_conv = recover_pk(msg_ref, sig_conv);
37726         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
37727         return tag_ptr(ret_conv, true);
37728 }
37729
37730 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_verify(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig, int8_tArray pk) {
37731         LDKu8slice msg_ref;
37732         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
37733         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
37734         LDKStr sig_conv = java_to_owned_str(env, sig);
37735         LDKPublicKey pk_ref;
37736         CHECK((*env)->GetArrayLength(env, pk) == 33);
37737         (*env)->GetByteArrayRegion(env, pk, 0, 33, pk_ref.compressed_form);
37738         jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
37739         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
37740         return ret_conv;
37741 }
37742
37743 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_construct_1invoice_1preimage(JNIEnv *env, jclass clz, int8_tArray hrp_bytes, jobjectArray data_without_signature) {
37744         LDKu8slice hrp_bytes_ref;
37745         hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
37746         hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
37747         LDKCVec_U5Z data_without_signature_constr;
37748         data_without_signature_constr.datalen = (*env)->GetArrayLength(env, data_without_signature);
37749         if (data_without_signature_constr.datalen > 0)
37750                 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
37751         else
37752                 data_without_signature_constr.data = NULL;
37753         int8_t* data_without_signature_vals = (*env)->GetByteArrayElements (env, data_without_signature, NULL);
37754         for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
37755                 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
37756                 
37757                 data_without_signature_constr.data[h] = (LDKU5){ ._0 = data_without_signature_conv_7 };
37758         }
37759         (*env)->ReleaseByteArrayElements(env, data_without_signature, data_without_signature_vals, 0);
37760         LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
37761         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37762         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37763         CVec_u8Z_free(ret_var);
37764         (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
37765         return ret_arr;
37766 }
37767
37768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KVStore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37769         if (!ptr_is_owned(this_ptr)) return;
37770         void* this_ptr_ptr = untag_ptr(this_ptr);
37771         CHECK_ACCESS(this_ptr_ptr);
37772         LDKKVStore this_ptr_conv = *(LDKKVStore*)(this_ptr_ptr);
37773         FREE(untag_ptr(this_ptr));
37774         KVStore_free(this_ptr_conv);
37775 }
37776
37777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persister_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37778         if (!ptr_is_owned(this_ptr)) return;
37779         void* this_ptr_ptr = untag_ptr(this_ptr);
37780         CHECK_ACCESS(this_ptr_ptr);
37781         LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
37782         FREE(untag_ptr(this_ptr));
37783         Persister_free(this_ptr_conv);
37784 }
37785
37786 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) {
37787         void* kv_store_ptr = untag_ptr(kv_store);
37788         CHECK_ACCESS(kv_store_ptr);
37789         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
37790         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
37791                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37792                 LDKKVStore_JCalls_cloned(&kv_store_conv);
37793         }
37794         void* entropy_source_ptr = untag_ptr(entropy_source);
37795         CHECK_ACCESS(entropy_source_ptr);
37796         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
37797         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
37798                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37799                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
37800         }
37801         void* signer_provider_ptr = untag_ptr(signer_provider);
37802         CHECK_ACCESS(signer_provider_ptr);
37803         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
37804         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
37805                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37806                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
37807         }
37808         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
37809         *ret_conv = read_channel_monitors(kv_store_conv, entropy_source_conv, signer_provider_conv);
37810         return tag_ptr(ret_conv, true);
37811 }
37812
37813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdatingPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37814         LDKMonitorUpdatingPersister this_obj_conv;
37815         this_obj_conv.inner = untag_ptr(this_obj);
37816         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37818         MonitorUpdatingPersister_free(this_obj_conv);
37819 }
37820
37821 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) {
37822         void* kv_store_ptr = untag_ptr(kv_store);
37823         CHECK_ACCESS(kv_store_ptr);
37824         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
37825         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
37826                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37827                 LDKKVStore_JCalls_cloned(&kv_store_conv);
37828         }
37829         void* logger_ptr = untag_ptr(logger);
37830         CHECK_ACCESS(logger_ptr);
37831         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
37832         if (logger_conv.free == LDKLogger_JCalls_free) {
37833                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37834                 LDKLogger_JCalls_cloned(&logger_conv);
37835         }
37836         void* entropy_source_ptr = untag_ptr(entropy_source);
37837         CHECK_ACCESS(entropy_source_ptr);
37838         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
37839         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
37840                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37841                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
37842         }
37843         void* signer_provider_ptr = untag_ptr(signer_provider);
37844         CHECK_ACCESS(signer_provider_ptr);
37845         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
37846         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
37847                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37848                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
37849         }
37850         LDKMonitorUpdatingPersister ret_var = MonitorUpdatingPersister_new(kv_store_conv, logger_conv, maximum_pending_updates, entropy_source_conv, signer_provider_conv);
37851         int64_t ret_ref = 0;
37852         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37853         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37854         return ret_ref;
37855 }
37856
37857 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) {
37858         LDKMonitorUpdatingPersister this_arg_conv;
37859         this_arg_conv.inner = untag_ptr(this_arg);
37860         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37862         this_arg_conv.is_owned = false;
37863         void* broadcaster_ptr = untag_ptr(broadcaster);
37864         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
37865         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
37866         void* fee_estimator_ptr = untag_ptr(fee_estimator);
37867         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
37868         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
37869         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
37870         *ret_conv = MonitorUpdatingPersister_read_all_channel_monitors_with_updates(&this_arg_conv, broadcaster_conv, fee_estimator_conv);
37871         return tag_ptr(ret_conv, true);
37872 }
37873
37874 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) {
37875         LDKMonitorUpdatingPersister this_arg_conv;
37876         this_arg_conv.inner = untag_ptr(this_arg);
37877         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37879         this_arg_conv.is_owned = false;
37880         void* broadcaster_ptr = untag_ptr(broadcaster);
37881         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
37882         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
37883         void* fee_estimator_ptr = untag_ptr(fee_estimator);
37884         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
37885         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
37886         LDKStr monitor_key_conv = java_to_owned_str(env, monitor_key);
37887         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
37888         *ret_conv = MonitorUpdatingPersister_read_channel_monitor_with_updates(&this_arg_conv, broadcaster_conv, fee_estimator_conv, monitor_key_conv);
37889         return tag_ptr(ret_conv, true);
37890 }
37891
37892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdatingPersister_1cleanup_1stale_1updates(JNIEnv *env, jclass clz, int64_t this_arg, jboolean lazy) {
37893         LDKMonitorUpdatingPersister this_arg_conv;
37894         this_arg_conv.inner = untag_ptr(this_arg);
37895         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37897         this_arg_conv.is_owned = false;
37898         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
37899         *ret_conv = MonitorUpdatingPersister_cleanup_stale_updates(&this_arg_conv, lazy);
37900         return tag_ptr(ret_conv, true);
37901 }
37902
37903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdatingPersister_1as_1Persist(JNIEnv *env, jclass clz, int64_t this_arg) {
37904         LDKMonitorUpdatingPersister this_arg_conv;
37905         this_arg_conv.inner = untag_ptr(this_arg);
37906         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37908         this_arg_conv.is_owned = false;
37909         LDKPersist* ret_ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
37910         *ret_ret = MonitorUpdatingPersister_as_Persist(&this_arg_conv);
37911         return tag_ptr(ret_ret, true);
37912 }
37913
37914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UntrustedString_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37915         LDKUntrustedString this_obj_conv;
37916         this_obj_conv.inner = untag_ptr(this_obj);
37917         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37919         UntrustedString_free(this_obj_conv);
37920 }
37921
37922 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_UntrustedString_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
37923         LDKUntrustedString this_ptr_conv;
37924         this_ptr_conv.inner = untag_ptr(this_ptr);
37925         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37927         this_ptr_conv.is_owned = false;
37928         LDKStr ret_str = UntrustedString_get_a(&this_ptr_conv);
37929         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
37930         Str_free(ret_str);
37931         return ret_conv;
37932 }
37933
37934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UntrustedString_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
37935         LDKUntrustedString this_ptr_conv;
37936         this_ptr_conv.inner = untag_ptr(this_ptr);
37937         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37939         this_ptr_conv.is_owned = false;
37940         LDKStr val_conv = java_to_owned_str(env, val);
37941         UntrustedString_set_a(&this_ptr_conv, val_conv);
37942 }
37943
37944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1new(JNIEnv *env, jclass clz, jstring a_arg) {
37945         LDKStr a_arg_conv = java_to_owned_str(env, a_arg);
37946         LDKUntrustedString ret_var = UntrustedString_new(a_arg_conv);
37947         int64_t ret_ref = 0;
37948         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37949         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37950         return ret_ref;
37951 }
37952
37953 static inline uint64_t UntrustedString_clone_ptr(LDKUntrustedString *NONNULL_PTR arg) {
37954         LDKUntrustedString ret_var = UntrustedString_clone(arg);
37955         int64_t ret_ref = 0;
37956         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37957         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37958         return ret_ref;
37959 }
37960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37961         LDKUntrustedString arg_conv;
37962         arg_conv.inner = untag_ptr(arg);
37963         arg_conv.is_owned = ptr_is_owned(arg);
37964         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37965         arg_conv.is_owned = false;
37966         int64_t ret_conv = UntrustedString_clone_ptr(&arg_conv);
37967         return ret_conv;
37968 }
37969
37970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37971         LDKUntrustedString orig_conv;
37972         orig_conv.inner = untag_ptr(orig);
37973         orig_conv.is_owned = ptr_is_owned(orig);
37974         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37975         orig_conv.is_owned = false;
37976         LDKUntrustedString ret_var = UntrustedString_clone(&orig_conv);
37977         int64_t ret_ref = 0;
37978         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37979         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37980         return ret_ref;
37981 }
37982
37983 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UntrustedString_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
37984         LDKUntrustedString a_conv;
37985         a_conv.inner = untag_ptr(a);
37986         a_conv.is_owned = ptr_is_owned(a);
37987         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37988         a_conv.is_owned = false;
37989         LDKUntrustedString b_conv;
37990         b_conv.inner = untag_ptr(b);
37991         b_conv.is_owned = ptr_is_owned(b);
37992         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37993         b_conv.is_owned = false;
37994         jboolean ret_conv = UntrustedString_eq(&a_conv, &b_conv);
37995         return ret_conv;
37996 }
37997
37998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1hash(JNIEnv *env, jclass clz, int64_t o) {
37999         LDKUntrustedString o_conv;
38000         o_conv.inner = untag_ptr(o);
38001         o_conv.is_owned = ptr_is_owned(o);
38002         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38003         o_conv.is_owned = false;
38004         int64_t ret_conv = UntrustedString_hash(&o_conv);
38005         return ret_conv;
38006 }
38007
38008 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UntrustedString_1write(JNIEnv *env, jclass clz, int64_t obj) {
38009         LDKUntrustedString obj_conv;
38010         obj_conv.inner = untag_ptr(obj);
38011         obj_conv.is_owned = ptr_is_owned(obj);
38012         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38013         obj_conv.is_owned = false;
38014         LDKCVec_u8Z ret_var = UntrustedString_write(&obj_conv);
38015         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38016         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38017         CVec_u8Z_free(ret_var);
38018         return ret_arr;
38019 }
38020
38021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38022         LDKu8slice ser_ref;
38023         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38024         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38025         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
38026         *ret_conv = UntrustedString_read(ser_ref);
38027         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38028         return tag_ptr(ret_conv, true);
38029 }
38030
38031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrintableString_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38032         LDKPrintableString this_obj_conv;
38033         this_obj_conv.inner = untag_ptr(this_obj);
38034         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38036         PrintableString_free(this_obj_conv);
38037 }
38038
38039 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_PrintableString_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
38040         LDKPrintableString this_ptr_conv;
38041         this_ptr_conv.inner = untag_ptr(this_ptr);
38042         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38044         this_ptr_conv.is_owned = false;
38045         LDKStr ret_str = PrintableString_get_a(&this_ptr_conv);
38046         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
38047         Str_free(ret_str);
38048         return ret_conv;
38049 }
38050
38051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrintableString_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
38052         LDKPrintableString this_ptr_conv;
38053         this_ptr_conv.inner = untag_ptr(this_ptr);
38054         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38056         this_ptr_conv.is_owned = false;
38057         LDKStr val_conv = java_to_owned_str(env, val);
38058         PrintableString_set_a(&this_ptr_conv, val_conv);
38059 }
38060
38061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrintableString_1new(JNIEnv *env, jclass clz, jstring a_arg) {
38062         LDKStr a_arg_conv = java_to_owned_str(env, a_arg);
38063         LDKPrintableString ret_var = PrintableString_new(a_arg_conv);
38064         int64_t ret_ref = 0;
38065         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38066         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38067         return ret_ref;
38068 }
38069
38070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FutureCallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
38071         if (!ptr_is_owned(this_ptr)) return;
38072         void* this_ptr_ptr = untag_ptr(this_ptr);
38073         CHECK_ACCESS(this_ptr_ptr);
38074         LDKFutureCallback this_ptr_conv = *(LDKFutureCallback*)(this_ptr_ptr);
38075         FREE(untag_ptr(this_ptr));
38076         FutureCallback_free(this_ptr_conv);
38077 }
38078
38079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Future_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38080         LDKFuture this_obj_conv;
38081         this_obj_conv.inner = untag_ptr(this_obj);
38082         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38084         Future_free(this_obj_conv);
38085 }
38086
38087 static inline uint64_t Future_clone_ptr(LDKFuture *NONNULL_PTR arg) {
38088         LDKFuture ret_var = Future_clone(arg);
38089         int64_t ret_ref = 0;
38090         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38091         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38092         return ret_ref;
38093 }
38094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Future_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38095         LDKFuture arg_conv;
38096         arg_conv.inner = untag_ptr(arg);
38097         arg_conv.is_owned = ptr_is_owned(arg);
38098         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38099         arg_conv.is_owned = false;
38100         int64_t ret_conv = Future_clone_ptr(&arg_conv);
38101         return ret_conv;
38102 }
38103
38104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Future_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38105         LDKFuture orig_conv;
38106         orig_conv.inner = untag_ptr(orig);
38107         orig_conv.is_owned = ptr_is_owned(orig);
38108         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38109         orig_conv.is_owned = false;
38110         LDKFuture ret_var = Future_clone(&orig_conv);
38111         int64_t ret_ref = 0;
38112         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38113         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38114         return ret_ref;
38115 }
38116
38117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Future_1register_1callback_1fn(JNIEnv *env, jclass clz, int64_t this_arg, int64_t callback) {
38118         LDKFuture this_arg_conv;
38119         this_arg_conv.inner = untag_ptr(this_arg);
38120         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38122         this_arg_conv.is_owned = false;
38123         void* callback_ptr = untag_ptr(callback);
38124         CHECK_ACCESS(callback_ptr);
38125         LDKFutureCallback callback_conv = *(LDKFutureCallback*)(callback_ptr);
38126         if (callback_conv.free == LDKFutureCallback_JCalls_free) {
38127                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38128                 LDKFutureCallback_JCalls_cloned(&callback_conv);
38129         }
38130         Future_register_callback_fn(&this_arg_conv, callback_conv);
38131 }
38132
38133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Future_1wait(JNIEnv *env, jclass clz, int64_t this_arg) {
38134         LDKFuture this_arg_conv;
38135         this_arg_conv.inner = untag_ptr(this_arg);
38136         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38138         this_arg_conv = Future_clone(&this_arg_conv);
38139         Future_wait(this_arg_conv);
38140 }
38141
38142 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Future_1wait_1timeout(JNIEnv *env, jclass clz, int64_t this_arg, int64_t max_wait) {
38143         LDKFuture this_arg_conv;
38144         this_arg_conv.inner = untag_ptr(this_arg);
38145         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38147         this_arg_conv = Future_clone(&this_arg_conv);
38148         jboolean ret_conv = Future_wait_timeout(this_arg_conv, max_wait);
38149         return ret_conv;
38150 }
38151
38152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sleeper_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38153         LDKSleeper this_obj_conv;
38154         this_obj_conv.inner = untag_ptr(this_obj);
38155         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38157         Sleeper_free(this_obj_conv);
38158 }
38159
38160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sleeper_1from_1single_1future(JNIEnv *env, jclass clz, int64_t future) {
38161         LDKFuture future_conv;
38162         future_conv.inner = untag_ptr(future);
38163         future_conv.is_owned = ptr_is_owned(future);
38164         CHECK_INNER_FIELD_ACCESS_OR_NULL(future_conv);
38165         future_conv = Future_clone(&future_conv);
38166         LDKSleeper ret_var = Sleeper_from_single_future(future_conv);
38167         int64_t ret_ref = 0;
38168         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38169         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38170         return ret_ref;
38171 }
38172
38173 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) {
38174         LDKFuture fut_a_conv;
38175         fut_a_conv.inner = untag_ptr(fut_a);
38176         fut_a_conv.is_owned = ptr_is_owned(fut_a);
38177         CHECK_INNER_FIELD_ACCESS_OR_NULL(fut_a_conv);
38178         fut_a_conv = Future_clone(&fut_a_conv);
38179         LDKFuture fut_b_conv;
38180         fut_b_conv.inner = untag_ptr(fut_b);
38181         fut_b_conv.is_owned = ptr_is_owned(fut_b);
38182         CHECK_INNER_FIELD_ACCESS_OR_NULL(fut_b_conv);
38183         fut_b_conv = Future_clone(&fut_b_conv);
38184         LDKSleeper ret_var = Sleeper_from_two_futures(fut_a_conv, fut_b_conv);
38185         int64_t ret_ref = 0;
38186         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38187         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38188         return ret_ref;
38189 }
38190
38191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sleeper_1new(JNIEnv *env, jclass clz, int64_tArray futures) {
38192         LDKCVec_FutureZ futures_constr;
38193         futures_constr.datalen = (*env)->GetArrayLength(env, futures);
38194         if (futures_constr.datalen > 0)
38195                 futures_constr.data = MALLOC(futures_constr.datalen * sizeof(LDKFuture), "LDKCVec_FutureZ Elements");
38196         else
38197                 futures_constr.data = NULL;
38198         int64_t* futures_vals = (*env)->GetLongArrayElements (env, futures, NULL);
38199         for (size_t i = 0; i < futures_constr.datalen; i++) {
38200                 int64_t futures_conv_8 = futures_vals[i];
38201                 LDKFuture futures_conv_8_conv;
38202                 futures_conv_8_conv.inner = untag_ptr(futures_conv_8);
38203                 futures_conv_8_conv.is_owned = ptr_is_owned(futures_conv_8);
38204                 CHECK_INNER_FIELD_ACCESS_OR_NULL(futures_conv_8_conv);
38205                 futures_conv_8_conv = Future_clone(&futures_conv_8_conv);
38206                 futures_constr.data[i] = futures_conv_8_conv;
38207         }
38208         (*env)->ReleaseLongArrayElements(env, futures, futures_vals, 0);
38209         LDKSleeper ret_var = Sleeper_new(futures_constr);
38210         int64_t ret_ref = 0;
38211         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38212         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38213         return ret_ref;
38214 }
38215
38216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sleeper_1wait(JNIEnv *env, jclass clz, int64_t this_arg) {
38217         LDKSleeper this_arg_conv;
38218         this_arg_conv.inner = untag_ptr(this_arg);
38219         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38221         this_arg_conv.is_owned = false;
38222         Sleeper_wait(&this_arg_conv);
38223 }
38224
38225 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sleeper_1wait_1timeout(JNIEnv *env, jclass clz, int64_t this_arg, int64_t max_wait) {
38226         LDKSleeper this_arg_conv;
38227         this_arg_conv.inner = untag_ptr(this_arg);
38228         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38230         this_arg_conv.is_owned = false;
38231         jboolean ret_conv = Sleeper_wait_timeout(&this_arg_conv, max_wait);
38232         return ret_conv;
38233 }
38234
38235 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38236         LDKLevel* orig_conv = (LDKLevel*)untag_ptr(orig);
38237         jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
38238         return ret_conv;
38239 }
38240
38241 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1gossip(JNIEnv *env, jclass clz) {
38242         jclass ret_conv = LDKLevel_to_java(env, Level_gossip());
38243         return ret_conv;
38244 }
38245
38246 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1trace(JNIEnv *env, jclass clz) {
38247         jclass ret_conv = LDKLevel_to_java(env, Level_trace());
38248         return ret_conv;
38249 }
38250
38251 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1debug(JNIEnv *env, jclass clz) {
38252         jclass ret_conv = LDKLevel_to_java(env, Level_debug());
38253         return ret_conv;
38254 }
38255
38256 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1info(JNIEnv *env, jclass clz) {
38257         jclass ret_conv = LDKLevel_to_java(env, Level_info());
38258         return ret_conv;
38259 }
38260
38261 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1warn(JNIEnv *env, jclass clz) {
38262         jclass ret_conv = LDKLevel_to_java(env, Level_warn());
38263         return ret_conv;
38264 }
38265
38266 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1error(JNIEnv *env, jclass clz) {
38267         jclass ret_conv = LDKLevel_to_java(env, Level_error());
38268         return ret_conv;
38269 }
38270
38271 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Level_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
38272         LDKLevel* a_conv = (LDKLevel*)untag_ptr(a);
38273         LDKLevel* b_conv = (LDKLevel*)untag_ptr(b);
38274         jboolean ret_conv = Level_eq(a_conv, b_conv);
38275         return ret_conv;
38276 }
38277
38278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Level_1hash(JNIEnv *env, jclass clz, int64_t o) {
38279         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
38280         int64_t ret_conv = Level_hash(o_conv);
38281         return ret_conv;
38282 }
38283
38284 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
38285         jclass ret_conv = LDKLevel_to_java(env, Level_max());
38286         return ret_conv;
38287 }
38288
38289 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38290         LDKRecord this_obj_conv;
38291         this_obj_conv.inner = untag_ptr(this_obj);
38292         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38294         Record_free(this_obj_conv);
38295 }
38296
38297 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Record_1get_1level(JNIEnv *env, jclass clz, int64_t this_ptr) {
38298         LDKRecord this_ptr_conv;
38299         this_ptr_conv.inner = untag_ptr(this_ptr);
38300         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38302         this_ptr_conv.is_owned = false;
38303         jclass ret_conv = LDKLevel_to_java(env, Record_get_level(&this_ptr_conv));
38304         return ret_conv;
38305 }
38306
38307 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1level(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
38308         LDKRecord this_ptr_conv;
38309         this_ptr_conv.inner = untag_ptr(this_ptr);
38310         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38312         this_ptr_conv.is_owned = false;
38313         LDKLevel val_conv = LDKLevel_from_java(env, val);
38314         Record_set_level(&this_ptr_conv, val_conv);
38315 }
38316
38317 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Record_1get_1peer_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
38318         LDKRecord this_ptr_conv;
38319         this_ptr_conv.inner = untag_ptr(this_ptr);
38320         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38322         this_ptr_conv.is_owned = false;
38323         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
38324         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Record_get_peer_id(&this_ptr_conv).compressed_form);
38325         return ret_arr;
38326 }
38327
38328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1peer_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38329         LDKRecord this_ptr_conv;
38330         this_ptr_conv.inner = untag_ptr(this_ptr);
38331         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38333         this_ptr_conv.is_owned = false;
38334         LDKPublicKey val_ref;
38335         CHECK((*env)->GetArrayLength(env, val) == 33);
38336         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
38337         Record_set_peer_id(&this_ptr_conv, val_ref);
38338 }
38339
38340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
38341         LDKRecord this_ptr_conv;
38342         this_ptr_conv.inner = untag_ptr(this_ptr);
38343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38345         this_ptr_conv.is_owned = false;
38346         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
38347         *ret_copy = Record_get_channel_id(&this_ptr_conv);
38348         int64_t ret_ref = tag_ptr(ret_copy, true);
38349         return ret_ref;
38350 }
38351
38352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38353         LDKRecord this_ptr_conv;
38354         this_ptr_conv.inner = untag_ptr(this_ptr);
38355         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38357         this_ptr_conv.is_owned = false;
38358         void* val_ptr = untag_ptr(val);
38359         CHECK_ACCESS(val_ptr);
38360         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
38361         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
38362         Record_set_channel_id(&this_ptr_conv, val_conv);
38363 }
38364
38365 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1args(JNIEnv *env, jclass clz, int64_t this_ptr) {
38366         LDKRecord this_ptr_conv;
38367         this_ptr_conv.inner = untag_ptr(this_ptr);
38368         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38370         this_ptr_conv.is_owned = false;
38371         LDKStr ret_str = Record_get_args(&this_ptr_conv);
38372         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
38373         Str_free(ret_str);
38374         return ret_conv;
38375 }
38376
38377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1args(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
38378         LDKRecord this_ptr_conv;
38379         this_ptr_conv.inner = untag_ptr(this_ptr);
38380         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38382         this_ptr_conv.is_owned = false;
38383         LDKStr val_conv = java_to_owned_str(env, val);
38384         Record_set_args(&this_ptr_conv, val_conv);
38385 }
38386
38387 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr) {
38388         LDKRecord this_ptr_conv;
38389         this_ptr_conv.inner = untag_ptr(this_ptr);
38390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38392         this_ptr_conv.is_owned = false;
38393         LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
38394         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
38395         Str_free(ret_str);
38396         return ret_conv;
38397 }
38398
38399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
38400         LDKRecord this_ptr_conv;
38401         this_ptr_conv.inner = untag_ptr(this_ptr);
38402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38404         this_ptr_conv.is_owned = false;
38405         LDKStr val_conv = java_to_owned_str(env, val);
38406         Record_set_module_path(&this_ptr_conv, val_conv);
38407 }
38408
38409 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1file(JNIEnv *env, jclass clz, int64_t this_ptr) {
38410         LDKRecord this_ptr_conv;
38411         this_ptr_conv.inner = untag_ptr(this_ptr);
38412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38414         this_ptr_conv.is_owned = false;
38415         LDKStr ret_str = Record_get_file(&this_ptr_conv);
38416         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
38417         Str_free(ret_str);
38418         return ret_conv;
38419 }
38420
38421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1file(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
38422         LDKRecord this_ptr_conv;
38423         this_ptr_conv.inner = untag_ptr(this_ptr);
38424         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38426         this_ptr_conv.is_owned = false;
38427         LDKStr val_conv = java_to_owned_str(env, val);
38428         Record_set_file(&this_ptr_conv, val_conv);
38429 }
38430
38431 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_Record_1get_1line(JNIEnv *env, jclass clz, int64_t this_ptr) {
38432         LDKRecord this_ptr_conv;
38433         this_ptr_conv.inner = untag_ptr(this_ptr);
38434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38436         this_ptr_conv.is_owned = false;
38437         int32_t ret_conv = Record_get_line(&this_ptr_conv);
38438         return ret_conv;
38439 }
38440
38441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1line(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
38442         LDKRecord this_ptr_conv;
38443         this_ptr_conv.inner = untag_ptr(this_ptr);
38444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38446         this_ptr_conv.is_owned = false;
38447         Record_set_line(&this_ptr_conv, val);
38448 }
38449
38450 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) {
38451         LDKLevel level_arg_conv = LDKLevel_from_java(env, level_arg);
38452         LDKPublicKey peer_id_arg_ref;
38453         CHECK((*env)->GetArrayLength(env, peer_id_arg) == 33);
38454         (*env)->GetByteArrayRegion(env, peer_id_arg, 0, 33, peer_id_arg_ref.compressed_form);
38455         void* channel_id_arg_ptr = untag_ptr(channel_id_arg);
38456         CHECK_ACCESS(channel_id_arg_ptr);
38457         LDKCOption_ThirtyTwoBytesZ channel_id_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(channel_id_arg_ptr);
38458         channel_id_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(channel_id_arg));
38459         LDKStr args_arg_conv = java_to_owned_str(env, args_arg);
38460         LDKStr module_path_arg_conv = java_to_owned_str(env, module_path_arg);
38461         LDKStr file_arg_conv = java_to_owned_str(env, file_arg);
38462         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);
38463         int64_t ret_ref = 0;
38464         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38465         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38466         return ret_ref;
38467 }
38468
38469 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
38470         LDKRecord ret_var = Record_clone(arg);
38471         int64_t ret_ref = 0;
38472         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38473         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38474         return ret_ref;
38475 }
38476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38477         LDKRecord arg_conv;
38478         arg_conv.inner = untag_ptr(arg);
38479         arg_conv.is_owned = ptr_is_owned(arg);
38480         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38481         arg_conv.is_owned = false;
38482         int64_t ret_conv = Record_clone_ptr(&arg_conv);
38483         return ret_conv;
38484 }
38485
38486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38487         LDKRecord orig_conv;
38488         orig_conv.inner = untag_ptr(orig);
38489         orig_conv.is_owned = ptr_is_owned(orig);
38490         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38491         orig_conv.is_owned = false;
38492         LDKRecord ret_var = Record_clone(&orig_conv);
38493         int64_t ret_ref = 0;
38494         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38495         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38496         return ret_ref;
38497 }
38498
38499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
38500         if (!ptr_is_owned(this_ptr)) return;
38501         void* this_ptr_ptr = untag_ptr(this_ptr);
38502         CHECK_ACCESS(this_ptr_ptr);
38503         LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
38504         FREE(untag_ptr(this_ptr));
38505         Logger_free(this_ptr_conv);
38506 }
38507
38508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38509         LDKChannelHandshakeConfig this_obj_conv;
38510         this_obj_conv.inner = untag_ptr(this_obj);
38511         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38513         ChannelHandshakeConfig_free(this_obj_conv);
38514 }
38515
38516 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
38517         LDKChannelHandshakeConfig this_ptr_conv;
38518         this_ptr_conv.inner = untag_ptr(this_ptr);
38519         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38521         this_ptr_conv.is_owned = false;
38522         int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
38523         return ret_conv;
38524 }
38525
38526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
38527         LDKChannelHandshakeConfig this_ptr_conv;
38528         this_ptr_conv.inner = untag_ptr(this_ptr);
38529         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38531         this_ptr_conv.is_owned = false;
38532         ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
38533 }
38534
38535 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
38536         LDKChannelHandshakeConfig this_ptr_conv;
38537         this_ptr_conv.inner = untag_ptr(this_ptr);
38538         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38540         this_ptr_conv.is_owned = false;
38541         int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
38542         return ret_conv;
38543 }
38544
38545 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) {
38546         LDKChannelHandshakeConfig this_ptr_conv;
38547         this_ptr_conv.inner = untag_ptr(this_ptr);
38548         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38550         this_ptr_conv.is_owned = false;
38551         ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
38552 }
38553
38554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
38555         LDKChannelHandshakeConfig this_ptr_conv;
38556         this_ptr_conv.inner = untag_ptr(this_ptr);
38557         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38559         this_ptr_conv.is_owned = false;
38560         int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
38561         return ret_conv;
38562 }
38563
38564 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) {
38565         LDKChannelHandshakeConfig this_ptr_conv;
38566         this_ptr_conv.inner = untag_ptr(this_ptr);
38567         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38569         this_ptr_conv.is_owned = false;
38570         ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
38571 }
38572
38573 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) {
38574         LDKChannelHandshakeConfig this_ptr_conv;
38575         this_ptr_conv.inner = untag_ptr(this_ptr);
38576         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38578         this_ptr_conv.is_owned = false;
38579         int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
38580         return ret_conv;
38581 }
38582
38583 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) {
38584         LDKChannelHandshakeConfig this_ptr_conv;
38585         this_ptr_conv.inner = untag_ptr(this_ptr);
38586         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38588         this_ptr_conv.is_owned = false;
38589         ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
38590 }
38591
38592 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr) {
38593         LDKChannelHandshakeConfig this_ptr_conv;
38594         this_ptr_conv.inner = untag_ptr(this_ptr);
38595         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38597         this_ptr_conv.is_owned = false;
38598         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
38599         return ret_conv;
38600 }
38601
38602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
38603         LDKChannelHandshakeConfig this_ptr_conv;
38604         this_ptr_conv.inner = untag_ptr(this_ptr);
38605         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38607         this_ptr_conv.is_owned = false;
38608         ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
38609 }
38610
38611 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
38612         LDKChannelHandshakeConfig this_ptr_conv;
38613         this_ptr_conv.inner = untag_ptr(this_ptr);
38614         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38616         this_ptr_conv.is_owned = false;
38617         jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
38618         return ret_conv;
38619 }
38620
38621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
38622         LDKChannelHandshakeConfig this_ptr_conv;
38623         this_ptr_conv.inner = untag_ptr(this_ptr);
38624         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38626         this_ptr_conv.is_owned = false;
38627         ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
38628 }
38629
38630 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
38631         LDKChannelHandshakeConfig this_ptr_conv;
38632         this_ptr_conv.inner = untag_ptr(this_ptr);
38633         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38635         this_ptr_conv.is_owned = false;
38636         jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
38637         return ret_conv;
38638 }
38639
38640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
38641         LDKChannelHandshakeConfig this_ptr_conv;
38642         this_ptr_conv.inner = untag_ptr(this_ptr);
38643         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38645         this_ptr_conv.is_owned = false;
38646         ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
38647 }
38648
38649 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1their_1channel_1reserve_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
38650         LDKChannelHandshakeConfig this_ptr_conv;
38651         this_ptr_conv.inner = untag_ptr(this_ptr);
38652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38654         this_ptr_conv.is_owned = false;
38655         int32_t ret_conv = ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(&this_ptr_conv);
38656         return ret_conv;
38657 }
38658
38659 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) {
38660         LDKChannelHandshakeConfig this_ptr_conv;
38661         this_ptr_conv.inner = untag_ptr(this_ptr);
38662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38664         this_ptr_conv.is_owned = false;
38665         ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(&this_ptr_conv, val);
38666 }
38667
38668 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1negotiate_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_ptr) {
38669         LDKChannelHandshakeConfig this_ptr_conv;
38670         this_ptr_conv.inner = untag_ptr(this_ptr);
38671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38673         this_ptr_conv.is_owned = false;
38674         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv);
38675         return ret_conv;
38676 }
38677
38678 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) {
38679         LDKChannelHandshakeConfig this_ptr_conv;
38680         this_ptr_conv.inner = untag_ptr(this_ptr);
38681         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38683         this_ptr_conv.is_owned = false;
38684         ChannelHandshakeConfig_set_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv, val);
38685 }
38686
38687 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
38688         LDKChannelHandshakeConfig this_ptr_conv;
38689         this_ptr_conv.inner = untag_ptr(this_ptr);
38690         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38692         this_ptr_conv.is_owned = false;
38693         int16_t ret_conv = ChannelHandshakeConfig_get_our_max_accepted_htlcs(&this_ptr_conv);
38694         return ret_conv;
38695 }
38696
38697 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) {
38698         LDKChannelHandshakeConfig this_ptr_conv;
38699         this_ptr_conv.inner = untag_ptr(this_ptr);
38700         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38702         this_ptr_conv.is_owned = false;
38703         ChannelHandshakeConfig_set_our_max_accepted_htlcs(&this_ptr_conv, val);
38704 }
38705
38706 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) {
38707         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);
38708         int64_t ret_ref = 0;
38709         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38710         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38711         return ret_ref;
38712 }
38713
38714 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
38715         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
38716         int64_t ret_ref = 0;
38717         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38718         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38719         return ret_ref;
38720 }
38721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38722         LDKChannelHandshakeConfig arg_conv;
38723         arg_conv.inner = untag_ptr(arg);
38724         arg_conv.is_owned = ptr_is_owned(arg);
38725         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38726         arg_conv.is_owned = false;
38727         int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
38728         return ret_conv;
38729 }
38730
38731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38732         LDKChannelHandshakeConfig orig_conv;
38733         orig_conv.inner = untag_ptr(orig);
38734         orig_conv.is_owned = ptr_is_owned(orig);
38735         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38736         orig_conv.is_owned = false;
38737         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
38738         int64_t ret_ref = 0;
38739         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38740         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38741         return ret_ref;
38742 }
38743
38744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
38745         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
38746         int64_t ret_ref = 0;
38747         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38748         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38749         return ret_ref;
38750 }
38751
38752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38753         LDKChannelHandshakeLimits this_obj_conv;
38754         this_obj_conv.inner = untag_ptr(this_obj);
38755         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38757         ChannelHandshakeLimits_free(this_obj_conv);
38758 }
38759
38760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
38761         LDKChannelHandshakeLimits this_ptr_conv;
38762         this_ptr_conv.inner = untag_ptr(this_ptr);
38763         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38765         this_ptr_conv.is_owned = false;
38766         int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
38767         return ret_conv;
38768 }
38769
38770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38771         LDKChannelHandshakeLimits this_ptr_conv;
38772         this_ptr_conv.inner = untag_ptr(this_ptr);
38773         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38775         this_ptr_conv.is_owned = false;
38776         ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
38777 }
38778
38779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
38780         LDKChannelHandshakeLimits this_ptr_conv;
38781         this_ptr_conv.inner = untag_ptr(this_ptr);
38782         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38784         this_ptr_conv.is_owned = false;
38785         int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
38786         return ret_conv;
38787 }
38788
38789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38790         LDKChannelHandshakeLimits this_ptr_conv;
38791         this_ptr_conv.inner = untag_ptr(this_ptr);
38792         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38794         this_ptr_conv.is_owned = false;
38795         ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
38796 }
38797
38798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
38799         LDKChannelHandshakeLimits this_ptr_conv;
38800         this_ptr_conv.inner = untag_ptr(this_ptr);
38801         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38803         this_ptr_conv.is_owned = false;
38804         int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
38805         return ret_conv;
38806 }
38807
38808 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) {
38809         LDKChannelHandshakeLimits this_ptr_conv;
38810         this_ptr_conv.inner = untag_ptr(this_ptr);
38811         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38813         this_ptr_conv.is_owned = false;
38814         ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
38815 }
38816
38817 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) {
38818         LDKChannelHandshakeLimits this_ptr_conv;
38819         this_ptr_conv.inner = untag_ptr(this_ptr);
38820         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38822         this_ptr_conv.is_owned = false;
38823         int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
38824         return ret_conv;
38825 }
38826
38827 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) {
38828         LDKChannelHandshakeLimits this_ptr_conv;
38829         this_ptr_conv.inner = untag_ptr(this_ptr);
38830         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38832         this_ptr_conv.is_owned = false;
38833         ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
38834 }
38835
38836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
38837         LDKChannelHandshakeLimits this_ptr_conv;
38838         this_ptr_conv.inner = untag_ptr(this_ptr);
38839         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38841         this_ptr_conv.is_owned = false;
38842         int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
38843         return ret_conv;
38844 }
38845
38846 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) {
38847         LDKChannelHandshakeLimits this_ptr_conv;
38848         this_ptr_conv.inner = untag_ptr(this_ptr);
38849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38851         this_ptr_conv.is_owned = false;
38852         ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
38853 }
38854
38855 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
38856         LDKChannelHandshakeLimits this_ptr_conv;
38857         this_ptr_conv.inner = untag_ptr(this_ptr);
38858         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38860         this_ptr_conv.is_owned = false;
38861         int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
38862         return ret_conv;
38863 }
38864
38865 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) {
38866         LDKChannelHandshakeLimits this_ptr_conv;
38867         this_ptr_conv.inner = untag_ptr(this_ptr);
38868         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38870         this_ptr_conv.is_owned = false;
38871         ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
38872 }
38873
38874 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
38875         LDKChannelHandshakeLimits this_ptr_conv;
38876         this_ptr_conv.inner = untag_ptr(this_ptr);
38877         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38879         this_ptr_conv.is_owned = false;
38880         int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
38881         return ret_conv;
38882 }
38883
38884 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
38885         LDKChannelHandshakeLimits this_ptr_conv;
38886         this_ptr_conv.inner = untag_ptr(this_ptr);
38887         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38889         this_ptr_conv.is_owned = false;
38890         ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
38891 }
38892
38893 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1trust_1own_1funding_10conf(JNIEnv *env, jclass clz, int64_t this_ptr) {
38894         LDKChannelHandshakeLimits this_ptr_conv;
38895         this_ptr_conv.inner = untag_ptr(this_ptr);
38896         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38898         this_ptr_conv.is_owned = false;
38899         jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
38900         return ret_conv;
38901 }
38902
38903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1trust_1own_1funding_10conf(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
38904         LDKChannelHandshakeLimits this_ptr_conv;
38905         this_ptr_conv.inner = untag_ptr(this_ptr);
38906         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38908         this_ptr_conv.is_owned = false;
38909         ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
38910 }
38911
38912 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
38913         LDKChannelHandshakeLimits this_ptr_conv;
38914         this_ptr_conv.inner = untag_ptr(this_ptr);
38915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38917         this_ptr_conv.is_owned = false;
38918         jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
38919         return ret_conv;
38920 }
38921
38922 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
38923         LDKChannelHandshakeLimits this_ptr_conv;
38924         this_ptr_conv.inner = untag_ptr(this_ptr);
38925         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38927         this_ptr_conv.is_owned = false;
38928         ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
38929 }
38930
38931 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
38932         LDKChannelHandshakeLimits this_ptr_conv;
38933         this_ptr_conv.inner = untag_ptr(this_ptr);
38934         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38936         this_ptr_conv.is_owned = false;
38937         int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
38938         return ret_conv;
38939 }
38940
38941 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) {
38942         LDKChannelHandshakeLimits this_ptr_conv;
38943         this_ptr_conv.inner = untag_ptr(this_ptr);
38944         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38946         this_ptr_conv.is_owned = false;
38947         ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
38948 }
38949
38950 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) {
38951         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);
38952         int64_t ret_ref = 0;
38953         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38954         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38955         return ret_ref;
38956 }
38957
38958 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
38959         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
38960         int64_t ret_ref = 0;
38961         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38962         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38963         return ret_ref;
38964 }
38965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38966         LDKChannelHandshakeLimits arg_conv;
38967         arg_conv.inner = untag_ptr(arg);
38968         arg_conv.is_owned = ptr_is_owned(arg);
38969         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38970         arg_conv.is_owned = false;
38971         int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
38972         return ret_conv;
38973 }
38974
38975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38976         LDKChannelHandshakeLimits orig_conv;
38977         orig_conv.inner = untag_ptr(orig);
38978         orig_conv.is_owned = ptr_is_owned(orig);
38979         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38980         orig_conv.is_owned = false;
38981         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
38982         int64_t ret_ref = 0;
38983         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38984         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38985         return ret_ref;
38986 }
38987
38988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
38989         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
38990         int64_t ret_ref = 0;
38991         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38992         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38993         return ret_ref;
38994 }
38995
38996 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
38997         if (!ptr_is_owned(this_ptr)) return;
38998         void* this_ptr_ptr = untag_ptr(this_ptr);
38999         CHECK_ACCESS(this_ptr_ptr);
39000         LDKMaxDustHTLCExposure this_ptr_conv = *(LDKMaxDustHTLCExposure*)(this_ptr_ptr);
39001         FREE(untag_ptr(this_ptr));
39002         MaxDustHTLCExposure_free(this_ptr_conv);
39003 }
39004
39005 static inline uint64_t MaxDustHTLCExposure_clone_ptr(LDKMaxDustHTLCExposure *NONNULL_PTR arg) {
39006         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
39007         *ret_copy = MaxDustHTLCExposure_clone(arg);
39008         int64_t ret_ref = tag_ptr(ret_copy, true);
39009         return ret_ref;
39010 }
39011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39012         LDKMaxDustHTLCExposure* arg_conv = (LDKMaxDustHTLCExposure*)untag_ptr(arg);
39013         int64_t ret_conv = MaxDustHTLCExposure_clone_ptr(arg_conv);
39014         return ret_conv;
39015 }
39016
39017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39018         LDKMaxDustHTLCExposure* orig_conv = (LDKMaxDustHTLCExposure*)untag_ptr(orig);
39019         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
39020         *ret_copy = MaxDustHTLCExposure_clone(orig_conv);
39021         int64_t ret_ref = tag_ptr(ret_copy, true);
39022         return ret_ref;
39023 }
39024
39025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1fixed_1limit_1msat(JNIEnv *env, jclass clz, int64_t a) {
39026         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
39027         *ret_copy = MaxDustHTLCExposure_fixed_limit_msat(a);
39028         int64_t ret_ref = tag_ptr(ret_copy, true);
39029         return ret_ref;
39030 }
39031
39032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1fee_1rate_1multiplier(JNIEnv *env, jclass clz, int64_t a) {
39033         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
39034         *ret_copy = MaxDustHTLCExposure_fee_rate_multiplier(a);
39035         int64_t ret_ref = tag_ptr(ret_copy, true);
39036         return ret_ref;
39037 }
39038
39039 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39040         LDKMaxDustHTLCExposure* a_conv = (LDKMaxDustHTLCExposure*)untag_ptr(a);
39041         LDKMaxDustHTLCExposure* b_conv = (LDKMaxDustHTLCExposure*)untag_ptr(b);
39042         jboolean ret_conv = MaxDustHTLCExposure_eq(a_conv, b_conv);
39043         return ret_conv;
39044 }
39045
39046 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1write(JNIEnv *env, jclass clz, int64_t obj) {
39047         LDKMaxDustHTLCExposure* obj_conv = (LDKMaxDustHTLCExposure*)untag_ptr(obj);
39048         LDKCVec_u8Z ret_var = MaxDustHTLCExposure_write(obj_conv);
39049         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39050         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39051         CVec_u8Z_free(ret_var);
39052         return ret_arr;
39053 }
39054
39055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39056         LDKu8slice ser_ref;
39057         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39058         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39059         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
39060         *ret_conv = MaxDustHTLCExposure_read(ser_ref);
39061         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39062         return tag_ptr(ret_conv, true);
39063 }
39064
39065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39066         LDKChannelConfig this_obj_conv;
39067         this_obj_conv.inner = untag_ptr(this_obj);
39068         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39070         ChannelConfig_free(this_obj_conv);
39071 }
39072
39073 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
39074         LDKChannelConfig this_ptr_conv;
39075         this_ptr_conv.inner = untag_ptr(this_ptr);
39076         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39078         this_ptr_conv.is_owned = false;
39079         int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
39080         return ret_conv;
39081 }
39082
39083 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) {
39084         LDKChannelConfig this_ptr_conv;
39085         this_ptr_conv.inner = untag_ptr(this_ptr);
39086         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39088         this_ptr_conv.is_owned = false;
39089         ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
39090 }
39091
39092 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39093         LDKChannelConfig this_ptr_conv;
39094         this_ptr_conv.inner = untag_ptr(this_ptr);
39095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39097         this_ptr_conv.is_owned = false;
39098         int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
39099         return ret_conv;
39100 }
39101
39102 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) {
39103         LDKChannelConfig this_ptr_conv;
39104         this_ptr_conv.inner = untag_ptr(this_ptr);
39105         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39107         this_ptr_conv.is_owned = false;
39108         ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
39109 }
39110
39111 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
39112         LDKChannelConfig this_ptr_conv;
39113         this_ptr_conv.inner = untag_ptr(this_ptr);
39114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39116         this_ptr_conv.is_owned = false;
39117         int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
39118         return ret_conv;
39119 }
39120
39121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
39122         LDKChannelConfig this_ptr_conv;
39123         this_ptr_conv.inner = untag_ptr(this_ptr);
39124         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39126         this_ptr_conv.is_owned = false;
39127         ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
39128 }
39129
39130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1max_1dust_1htlc_1exposure(JNIEnv *env, jclass clz, int64_t this_ptr) {
39131         LDKChannelConfig this_ptr_conv;
39132         this_ptr_conv.inner = untag_ptr(this_ptr);
39133         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39135         this_ptr_conv.is_owned = false;
39136         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
39137         *ret_copy = ChannelConfig_get_max_dust_htlc_exposure(&this_ptr_conv);
39138         int64_t ret_ref = tag_ptr(ret_copy, true);
39139         return ret_ref;
39140 }
39141
39142 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) {
39143         LDKChannelConfig this_ptr_conv;
39144         this_ptr_conv.inner = untag_ptr(this_ptr);
39145         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39147         this_ptr_conv.is_owned = false;
39148         void* val_ptr = untag_ptr(val);
39149         CHECK_ACCESS(val_ptr);
39150         LDKMaxDustHTLCExposure val_conv = *(LDKMaxDustHTLCExposure*)(val_ptr);
39151         val_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(val));
39152         ChannelConfig_set_max_dust_htlc_exposure(&this_ptr_conv, val_conv);
39153 }
39154
39155 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) {
39156         LDKChannelConfig this_ptr_conv;
39157         this_ptr_conv.inner = untag_ptr(this_ptr);
39158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39160         this_ptr_conv.is_owned = false;
39161         int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
39162         return ret_conv;
39163 }
39164
39165 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) {
39166         LDKChannelConfig this_ptr_conv;
39167         this_ptr_conv.inner = untag_ptr(this_ptr);
39168         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39170         this_ptr_conv.is_owned = false;
39171         ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
39172 }
39173
39174 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1accept_1underpaying_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
39175         LDKChannelConfig this_ptr_conv;
39176         this_ptr_conv.inner = untag_ptr(this_ptr);
39177         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39179         this_ptr_conv.is_owned = false;
39180         jboolean ret_conv = ChannelConfig_get_accept_underpaying_htlcs(&this_ptr_conv);
39181         return ret_conv;
39182 }
39183
39184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1accept_1underpaying_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
39185         LDKChannelConfig this_ptr_conv;
39186         this_ptr_conv.inner = untag_ptr(this_ptr);
39187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39189         this_ptr_conv.is_owned = false;
39190         ChannelConfig_set_accept_underpaying_htlcs(&this_ptr_conv, val);
39191 }
39192
39193 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) {
39194         void* max_dust_htlc_exposure_arg_ptr = untag_ptr(max_dust_htlc_exposure_arg);
39195         CHECK_ACCESS(max_dust_htlc_exposure_arg_ptr);
39196         LDKMaxDustHTLCExposure max_dust_htlc_exposure_arg_conv = *(LDKMaxDustHTLCExposure*)(max_dust_htlc_exposure_arg_ptr);
39197         max_dust_htlc_exposure_arg_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(max_dust_htlc_exposure_arg));
39198         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);
39199         int64_t ret_ref = 0;
39200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39202         return ret_ref;
39203 }
39204
39205 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
39206         LDKChannelConfig ret_var = ChannelConfig_clone(arg);
39207         int64_t ret_ref = 0;
39208         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39209         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39210         return ret_ref;
39211 }
39212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39213         LDKChannelConfig arg_conv;
39214         arg_conv.inner = untag_ptr(arg);
39215         arg_conv.is_owned = ptr_is_owned(arg);
39216         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39217         arg_conv.is_owned = false;
39218         int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
39219         return ret_conv;
39220 }
39221
39222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39223         LDKChannelConfig orig_conv;
39224         orig_conv.inner = untag_ptr(orig);
39225         orig_conv.is_owned = ptr_is_owned(orig);
39226         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39227         orig_conv.is_owned = false;
39228         LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
39229         int64_t ret_ref = 0;
39230         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39231         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39232         return ret_ref;
39233 }
39234
39235 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39236         LDKChannelConfig a_conv;
39237         a_conv.inner = untag_ptr(a);
39238         a_conv.is_owned = ptr_is_owned(a);
39239         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39240         a_conv.is_owned = false;
39241         LDKChannelConfig b_conv;
39242         b_conv.inner = untag_ptr(b);
39243         b_conv.is_owned = ptr_is_owned(b);
39244         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39245         b_conv.is_owned = false;
39246         jboolean ret_conv = ChannelConfig_eq(&a_conv, &b_conv);
39247         return ret_conv;
39248 }
39249
39250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1apply(JNIEnv *env, jclass clz, int64_t this_arg, int64_t update) {
39251         LDKChannelConfig this_arg_conv;
39252         this_arg_conv.inner = untag_ptr(this_arg);
39253         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39255         this_arg_conv.is_owned = false;
39256         LDKChannelConfigUpdate update_conv;
39257         update_conv.inner = untag_ptr(update);
39258         update_conv.is_owned = ptr_is_owned(update);
39259         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
39260         update_conv.is_owned = false;
39261         ChannelConfig_apply(&this_arg_conv, &update_conv);
39262 }
39263
39264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
39265         LDKChannelConfig ret_var = ChannelConfig_default();
39266         int64_t ret_ref = 0;
39267         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39268         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39269         return ret_ref;
39270 }
39271
39272 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
39273         LDKChannelConfig obj_conv;
39274         obj_conv.inner = untag_ptr(obj);
39275         obj_conv.is_owned = ptr_is_owned(obj);
39276         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39277         obj_conv.is_owned = false;
39278         LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
39279         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39280         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39281         CVec_u8Z_free(ret_var);
39282         return ret_arr;
39283 }
39284
39285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39286         LDKu8slice ser_ref;
39287         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39288         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39289         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
39290         *ret_conv = ChannelConfig_read(ser_ref);
39291         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39292         return tag_ptr(ret_conv, true);
39293 }
39294
39295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39296         LDKChannelConfigUpdate this_obj_conv;
39297         this_obj_conv.inner = untag_ptr(this_obj);
39298         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39300         ChannelConfigUpdate_free(this_obj_conv);
39301 }
39302
39303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
39304         LDKChannelConfigUpdate this_ptr_conv;
39305         this_ptr_conv.inner = untag_ptr(this_ptr);
39306         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39308         this_ptr_conv.is_owned = false;
39309         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
39310         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
39311         int64_t ret_ref = tag_ptr(ret_copy, true);
39312         return ret_ref;
39313 }
39314
39315 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) {
39316         LDKChannelConfigUpdate this_ptr_conv;
39317         this_ptr_conv.inner = untag_ptr(this_ptr);
39318         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39320         this_ptr_conv.is_owned = false;
39321         void* val_ptr = untag_ptr(val);
39322         CHECK_ACCESS(val_ptr);
39323         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
39324         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
39325         ChannelConfigUpdate_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val_conv);
39326 }
39327
39328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39329         LDKChannelConfigUpdate this_ptr_conv;
39330         this_ptr_conv.inner = untag_ptr(this_ptr);
39331         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39333         this_ptr_conv.is_owned = false;
39334         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
39335         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_base_msat(&this_ptr_conv);
39336         int64_t ret_ref = tag_ptr(ret_copy, true);
39337         return ret_ref;
39338 }
39339
39340 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) {
39341         LDKChannelConfigUpdate this_ptr_conv;
39342         this_ptr_conv.inner = untag_ptr(this_ptr);
39343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39345         this_ptr_conv.is_owned = false;
39346         void* val_ptr = untag_ptr(val);
39347         CHECK_ACCESS(val_ptr);
39348         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
39349         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
39350         ChannelConfigUpdate_set_forwarding_fee_base_msat(&this_ptr_conv, val_conv);
39351 }
39352
39353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
39354         LDKChannelConfigUpdate this_ptr_conv;
39355         this_ptr_conv.inner = untag_ptr(this_ptr);
39356         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39358         this_ptr_conv.is_owned = false;
39359         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
39360         *ret_copy = ChannelConfigUpdate_get_cltv_expiry_delta(&this_ptr_conv);
39361         int64_t ret_ref = tag_ptr(ret_copy, true);
39362         return ret_ref;
39363 }
39364
39365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39366         LDKChannelConfigUpdate this_ptr_conv;
39367         this_ptr_conv.inner = untag_ptr(this_ptr);
39368         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39370         this_ptr_conv.is_owned = false;
39371         void* val_ptr = untag_ptr(val);
39372         CHECK_ACCESS(val_ptr);
39373         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
39374         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
39375         ChannelConfigUpdate_set_cltv_expiry_delta(&this_ptr_conv, val_conv);
39376 }
39377
39378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39379         LDKChannelConfigUpdate this_ptr_conv;
39380         this_ptr_conv.inner = untag_ptr(this_ptr);
39381         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39383         this_ptr_conv.is_owned = false;
39384         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
39385         *ret_copy = ChannelConfigUpdate_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
39386         int64_t ret_ref = tag_ptr(ret_copy, true);
39387         return ret_ref;
39388 }
39389
39390 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) {
39391         LDKChannelConfigUpdate this_ptr_conv;
39392         this_ptr_conv.inner = untag_ptr(this_ptr);
39393         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39395         this_ptr_conv.is_owned = false;
39396         void* val_ptr = untag_ptr(val);
39397         CHECK_ACCESS(val_ptr);
39398         LDKCOption_MaxDustHTLCExposureZ val_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(val_ptr);
39399         val_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(val));
39400         ChannelConfigUpdate_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val_conv);
39401 }
39402
39403 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) {
39404         LDKChannelConfigUpdate this_ptr_conv;
39405         this_ptr_conv.inner = untag_ptr(this_ptr);
39406         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39408         this_ptr_conv.is_owned = false;
39409         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
39410         *ret_copy = ChannelConfigUpdate_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
39411         int64_t ret_ref = tag_ptr(ret_copy, true);
39412         return ret_ref;
39413 }
39414
39415 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) {
39416         LDKChannelConfigUpdate this_ptr_conv;
39417         this_ptr_conv.inner = untag_ptr(this_ptr);
39418         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39420         this_ptr_conv.is_owned = false;
39421         void* val_ptr = untag_ptr(val);
39422         CHECK_ACCESS(val_ptr);
39423         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
39424         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
39425         ChannelConfigUpdate_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val_conv);
39426 }
39427
39428 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) {
39429         void* forwarding_fee_proportional_millionths_arg_ptr = untag_ptr(forwarding_fee_proportional_millionths_arg);
39430         CHECK_ACCESS(forwarding_fee_proportional_millionths_arg_ptr);
39431         LDKCOption_u32Z forwarding_fee_proportional_millionths_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_proportional_millionths_arg_ptr);
39432         forwarding_fee_proportional_millionths_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_proportional_millionths_arg));
39433         void* forwarding_fee_base_msat_arg_ptr = untag_ptr(forwarding_fee_base_msat_arg);
39434         CHECK_ACCESS(forwarding_fee_base_msat_arg_ptr);
39435         LDKCOption_u32Z forwarding_fee_base_msat_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_base_msat_arg_ptr);
39436         forwarding_fee_base_msat_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_base_msat_arg));
39437         void* cltv_expiry_delta_arg_ptr = untag_ptr(cltv_expiry_delta_arg);
39438         CHECK_ACCESS(cltv_expiry_delta_arg_ptr);
39439         LDKCOption_u16Z cltv_expiry_delta_arg_conv = *(LDKCOption_u16Z*)(cltv_expiry_delta_arg_ptr);
39440         cltv_expiry_delta_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(cltv_expiry_delta_arg));
39441         void* max_dust_htlc_exposure_msat_arg_ptr = untag_ptr(max_dust_htlc_exposure_msat_arg);
39442         CHECK_ACCESS(max_dust_htlc_exposure_msat_arg_ptr);
39443         LDKCOption_MaxDustHTLCExposureZ max_dust_htlc_exposure_msat_arg_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(max_dust_htlc_exposure_msat_arg_ptr);
39444         max_dust_htlc_exposure_msat_arg_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(max_dust_htlc_exposure_msat_arg));
39445         void* force_close_avoidance_max_fee_satoshis_arg_ptr = untag_ptr(force_close_avoidance_max_fee_satoshis_arg);
39446         CHECK_ACCESS(force_close_avoidance_max_fee_satoshis_arg_ptr);
39447         LDKCOption_u64Z force_close_avoidance_max_fee_satoshis_arg_conv = *(LDKCOption_u64Z*)(force_close_avoidance_max_fee_satoshis_arg_ptr);
39448         force_close_avoidance_max_fee_satoshis_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(force_close_avoidance_max_fee_satoshis_arg));
39449         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);
39450         int64_t ret_ref = 0;
39451         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39452         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39453         return ret_ref;
39454 }
39455
39456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1default(JNIEnv *env, jclass clz) {
39457         LDKChannelConfigUpdate ret_var = ChannelConfigUpdate_default();
39458         int64_t ret_ref = 0;
39459         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39460         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39461         return ret_ref;
39462 }
39463
39464 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39465         LDKUserConfig this_obj_conv;
39466         this_obj_conv.inner = untag_ptr(this_obj);
39467         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39469         UserConfig_free(this_obj_conv);
39470 }
39471
39472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1handshake_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
39473         LDKUserConfig this_ptr_conv;
39474         this_ptr_conv.inner = untag_ptr(this_ptr);
39475         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39477         this_ptr_conv.is_owned = false;
39478         LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
39479         int64_t ret_ref = 0;
39480         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39481         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39482         return ret_ref;
39483 }
39484
39485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1handshake_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39486         LDKUserConfig this_ptr_conv;
39487         this_ptr_conv.inner = untag_ptr(this_ptr);
39488         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39490         this_ptr_conv.is_owned = false;
39491         LDKChannelHandshakeConfig val_conv;
39492         val_conv.inner = untag_ptr(val);
39493         val_conv.is_owned = ptr_is_owned(val);
39494         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39495         val_conv = ChannelHandshakeConfig_clone(&val_conv);
39496         UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
39497 }
39498
39499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1handshake_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
39500         LDKUserConfig this_ptr_conv;
39501         this_ptr_conv.inner = untag_ptr(this_ptr);
39502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39504         this_ptr_conv.is_owned = false;
39505         LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
39506         int64_t ret_ref = 0;
39507         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39508         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39509         return ret_ref;
39510 }
39511
39512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1handshake_1limits(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39513         LDKUserConfig this_ptr_conv;
39514         this_ptr_conv.inner = untag_ptr(this_ptr);
39515         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39517         this_ptr_conv.is_owned = false;
39518         LDKChannelHandshakeLimits val_conv;
39519         val_conv.inner = untag_ptr(val);
39520         val_conv.is_owned = ptr_is_owned(val);
39521         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39522         val_conv = ChannelHandshakeLimits_clone(&val_conv);
39523         UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
39524 }
39525
39526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
39527         LDKUserConfig this_ptr_conv;
39528         this_ptr_conv.inner = untag_ptr(this_ptr);
39529         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39531         this_ptr_conv.is_owned = false;
39532         LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
39533         int64_t ret_ref = 0;
39534         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39535         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39536         return ret_ref;
39537 }
39538
39539 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39540         LDKUserConfig this_ptr_conv;
39541         this_ptr_conv.inner = untag_ptr(this_ptr);
39542         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39544         this_ptr_conv.is_owned = false;
39545         LDKChannelConfig val_conv;
39546         val_conv.inner = untag_ptr(val);
39547         val_conv.is_owned = ptr_is_owned(val);
39548         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39549         val_conv = ChannelConfig_clone(&val_conv);
39550         UserConfig_set_channel_config(&this_ptr_conv, val_conv);
39551 }
39552
39553 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1forwards_1to_1priv_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
39554         LDKUserConfig this_ptr_conv;
39555         this_ptr_conv.inner = untag_ptr(this_ptr);
39556         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39558         this_ptr_conv.is_owned = false;
39559         jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
39560         return ret_conv;
39561 }
39562
39563 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) {
39564         LDKUserConfig this_ptr_conv;
39565         this_ptr_conv.inner = untag_ptr(this_ptr);
39566         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39568         this_ptr_conv.is_owned = false;
39569         UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
39570 }
39571
39572 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
39573         LDKUserConfig this_ptr_conv;
39574         this_ptr_conv.inner = untag_ptr(this_ptr);
39575         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39577         this_ptr_conv.is_owned = false;
39578         jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
39579         return ret_conv;
39580 }
39581
39582 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
39583         LDKUserConfig this_ptr_conv;
39584         this_ptr_conv.inner = untag_ptr(this_ptr);
39585         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39587         this_ptr_conv.is_owned = false;
39588         UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
39589 }
39590
39591 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
39592         LDKUserConfig this_ptr_conv;
39593         this_ptr_conv.inner = untag_ptr(this_ptr);
39594         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39596         this_ptr_conv.is_owned = false;
39597         jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
39598         return ret_conv;
39599 }
39600
39601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
39602         LDKUserConfig this_ptr_conv;
39603         this_ptr_conv.inner = untag_ptr(this_ptr);
39604         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39606         this_ptr_conv.is_owned = false;
39607         UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
39608 }
39609
39610 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1intercept_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
39611         LDKUserConfig this_ptr_conv;
39612         this_ptr_conv.inner = untag_ptr(this_ptr);
39613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39615         this_ptr_conv.is_owned = false;
39616         jboolean ret_conv = UserConfig_get_accept_intercept_htlcs(&this_ptr_conv);
39617         return ret_conv;
39618 }
39619
39620 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1intercept_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
39621         LDKUserConfig this_ptr_conv;
39622         this_ptr_conv.inner = untag_ptr(this_ptr);
39623         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39625         this_ptr_conv.is_owned = false;
39626         UserConfig_set_accept_intercept_htlcs(&this_ptr_conv, val);
39627 }
39628
39629 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1mpp_1keysend(JNIEnv *env, jclass clz, int64_t this_ptr) {
39630         LDKUserConfig this_ptr_conv;
39631         this_ptr_conv.inner = untag_ptr(this_ptr);
39632         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39634         this_ptr_conv.is_owned = false;
39635         jboolean ret_conv = UserConfig_get_accept_mpp_keysend(&this_ptr_conv);
39636         return ret_conv;
39637 }
39638
39639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1mpp_1keysend(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
39640         LDKUserConfig this_ptr_conv;
39641         this_ptr_conv.inner = untag_ptr(this_ptr);
39642         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39644         this_ptr_conv.is_owned = false;
39645         UserConfig_set_accept_mpp_keysend(&this_ptr_conv, val);
39646 }
39647
39648 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) {
39649         LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
39650         channel_handshake_config_arg_conv.inner = untag_ptr(channel_handshake_config_arg);
39651         channel_handshake_config_arg_conv.is_owned = ptr_is_owned(channel_handshake_config_arg);
39652         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
39653         channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
39654         LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
39655         channel_handshake_limits_arg_conv.inner = untag_ptr(channel_handshake_limits_arg);
39656         channel_handshake_limits_arg_conv.is_owned = ptr_is_owned(channel_handshake_limits_arg);
39657         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
39658         channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
39659         LDKChannelConfig channel_config_arg_conv;
39660         channel_config_arg_conv.inner = untag_ptr(channel_config_arg);
39661         channel_config_arg_conv.is_owned = ptr_is_owned(channel_config_arg);
39662         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
39663         channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
39664         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);
39665         int64_t ret_ref = 0;
39666         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39667         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39668         return ret_ref;
39669 }
39670
39671 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
39672         LDKUserConfig ret_var = UserConfig_clone(arg);
39673         int64_t ret_ref = 0;
39674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39676         return ret_ref;
39677 }
39678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39679         LDKUserConfig arg_conv;
39680         arg_conv.inner = untag_ptr(arg);
39681         arg_conv.is_owned = ptr_is_owned(arg);
39682         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39683         arg_conv.is_owned = false;
39684         int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
39685         return ret_conv;
39686 }
39687
39688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39689         LDKUserConfig orig_conv;
39690         orig_conv.inner = untag_ptr(orig);
39691         orig_conv.is_owned = ptr_is_owned(orig);
39692         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39693         orig_conv.is_owned = false;
39694         LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
39695         int64_t ret_ref = 0;
39696         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39697         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39698         return ret_ref;
39699 }
39700
39701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
39702         LDKUserConfig ret_var = UserConfig_default();
39703         int64_t ret_ref = 0;
39704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39706         return ret_ref;
39707 }
39708
39709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39710         LDKBestBlock this_obj_conv;
39711         this_obj_conv.inner = untag_ptr(this_obj);
39712         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39714         BestBlock_free(this_obj_conv);
39715 }
39716
39717 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
39718         LDKBestBlock ret_var = BestBlock_clone(arg);
39719         int64_t ret_ref = 0;
39720         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39721         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39722         return ret_ref;
39723 }
39724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39725         LDKBestBlock arg_conv;
39726         arg_conv.inner = untag_ptr(arg);
39727         arg_conv.is_owned = ptr_is_owned(arg);
39728         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39729         arg_conv.is_owned = false;
39730         int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
39731         return ret_conv;
39732 }
39733
39734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39735         LDKBestBlock orig_conv;
39736         orig_conv.inner = untag_ptr(orig);
39737         orig_conv.is_owned = ptr_is_owned(orig);
39738         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39739         orig_conv.is_owned = false;
39740         LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
39741         int64_t ret_ref = 0;
39742         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39743         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39744         return ret_ref;
39745 }
39746
39747 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BestBlock_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39748         LDKBestBlock a_conv;
39749         a_conv.inner = untag_ptr(a);
39750         a_conv.is_owned = ptr_is_owned(a);
39751         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39752         a_conv.is_owned = false;
39753         LDKBestBlock b_conv;
39754         b_conv.inner = untag_ptr(b);
39755         b_conv.is_owned = ptr_is_owned(b);
39756         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39757         b_conv.is_owned = false;
39758         jboolean ret_conv = BestBlock_eq(&a_conv, &b_conv);
39759         return ret_conv;
39760 }
39761
39762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1network(JNIEnv *env, jclass clz, jclass network) {
39763         LDKNetwork network_conv = LDKNetwork_from_java(env, network);
39764         LDKBestBlock ret_var = BestBlock_from_network(network_conv);
39765         int64_t ret_ref = 0;
39766         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39767         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39768         return ret_ref;
39769 }
39770
39771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1new(JNIEnv *env, jclass clz, int8_tArray block_hash, int32_t height) {
39772         LDKThirtyTwoBytes block_hash_ref;
39773         CHECK((*env)->GetArrayLength(env, block_hash) == 32);
39774         (*env)->GetByteArrayRegion(env, block_hash, 0, 32, block_hash_ref.data);
39775         LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
39776         int64_t ret_ref = 0;
39777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39779         return ret_ref;
39780 }
39781
39782 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1block_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
39783         LDKBestBlock this_arg_conv;
39784         this_arg_conv.inner = untag_ptr(this_arg);
39785         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39787         this_arg_conv.is_owned = false;
39788         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
39789         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BestBlock_block_hash(&this_arg_conv).data);
39790         return ret_arr;
39791 }
39792
39793 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1height(JNIEnv *env, jclass clz, int64_t this_arg) {
39794         LDKBestBlock this_arg_conv;
39795         this_arg_conv.inner = untag_ptr(this_arg);
39796         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39798         this_arg_conv.is_owned = false;
39799         int32_t ret_conv = BestBlock_height(&this_arg_conv);
39800         return ret_conv;
39801 }
39802
39803 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
39804         if (!ptr_is_owned(this_ptr)) return;
39805         void* this_ptr_ptr = untag_ptr(this_ptr);
39806         CHECK_ACCESS(this_ptr_ptr);
39807         LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
39808         FREE(untag_ptr(this_ptr));
39809         Listen_free(this_ptr_conv);
39810 }
39811
39812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
39813         if (!ptr_is_owned(this_ptr)) return;
39814         void* this_ptr_ptr = untag_ptr(this_ptr);
39815         CHECK_ACCESS(this_ptr_ptr);
39816         LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
39817         FREE(untag_ptr(this_ptr));
39818         Confirm_free(this_ptr_conv);
39819 }
39820
39821 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39822         LDKChannelMonitorUpdateStatus* orig_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(orig);
39823         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_clone(orig_conv));
39824         return ret_conv;
39825 }
39826
39827 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1completed(JNIEnv *env, jclass clz) {
39828         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_completed());
39829         return ret_conv;
39830 }
39831
39832 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1in_1progress(JNIEnv *env, jclass clz) {
39833         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_in_progress());
39834         return ret_conv;
39835 }
39836
39837 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1unrecoverable_1error(JNIEnv *env, jclass clz) {
39838         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_unrecoverable_error());
39839         return ret_conv;
39840 }
39841
39842 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39843         LDKChannelMonitorUpdateStatus* a_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(a);
39844         LDKChannelMonitorUpdateStatus* b_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(b);
39845         jboolean ret_conv = ChannelMonitorUpdateStatus_eq(a_conv, b_conv);
39846         return ret_conv;
39847 }
39848
39849 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
39850         if (!ptr_is_owned(this_ptr)) return;
39851         void* this_ptr_ptr = untag_ptr(this_ptr);
39852         CHECK_ACCESS(this_ptr_ptr);
39853         LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
39854         FREE(untag_ptr(this_ptr));
39855         Watch_free(this_ptr_conv);
39856 }
39857
39858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
39859         if (!ptr_is_owned(this_ptr)) return;
39860         void* this_ptr_ptr = untag_ptr(this_ptr);
39861         CHECK_ACCESS(this_ptr_ptr);
39862         LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
39863         FREE(untag_ptr(this_ptr));
39864         Filter_free(this_ptr_conv);
39865 }
39866
39867 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39868         LDKWatchedOutput this_obj_conv;
39869         this_obj_conv.inner = untag_ptr(this_obj);
39870         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39872         WatchedOutput_free(this_obj_conv);
39873 }
39874
39875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
39876         LDKWatchedOutput this_ptr_conv;
39877         this_ptr_conv.inner = untag_ptr(this_ptr);
39878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39880         this_ptr_conv.is_owned = false;
39881         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
39882         *ret_copy = WatchedOutput_get_block_hash(&this_ptr_conv);
39883         int64_t ret_ref = tag_ptr(ret_copy, true);
39884         return ret_ref;
39885 }
39886
39887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39888         LDKWatchedOutput this_ptr_conv;
39889         this_ptr_conv.inner = untag_ptr(this_ptr);
39890         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39892         this_ptr_conv.is_owned = false;
39893         void* val_ptr = untag_ptr(val);
39894         CHECK_ACCESS(val_ptr);
39895         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
39896         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
39897         WatchedOutput_set_block_hash(&this_ptr_conv, val_conv);
39898 }
39899
39900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
39901         LDKWatchedOutput this_ptr_conv;
39902         this_ptr_conv.inner = untag_ptr(this_ptr);
39903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39905         this_ptr_conv.is_owned = false;
39906         LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
39907         int64_t ret_ref = 0;
39908         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39909         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39910         return ret_ref;
39911 }
39912
39913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39914         LDKWatchedOutput this_ptr_conv;
39915         this_ptr_conv.inner = untag_ptr(this_ptr);
39916         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39918         this_ptr_conv.is_owned = false;
39919         LDKOutPoint val_conv;
39920         val_conv.inner = untag_ptr(val);
39921         val_conv.is_owned = ptr_is_owned(val);
39922         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39923         val_conv = OutPoint_clone(&val_conv);
39924         WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
39925 }
39926
39927 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
39928         LDKWatchedOutput this_ptr_conv;
39929         this_ptr_conv.inner = untag_ptr(this_ptr);
39930         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39932         this_ptr_conv.is_owned = false;
39933         LDKCVec_u8Z ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
39934         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39935         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39936         CVec_u8Z_free(ret_var);
39937         return ret_arr;
39938 }
39939
39940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39941         LDKWatchedOutput this_ptr_conv;
39942         this_ptr_conv.inner = untag_ptr(this_ptr);
39943         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39945         this_ptr_conv.is_owned = false;
39946         LDKCVec_u8Z val_ref;
39947         val_ref.datalen = (*env)->GetArrayLength(env, val);
39948         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
39949         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
39950         WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
39951 }
39952
39953 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) {
39954         void* block_hash_arg_ptr = untag_ptr(block_hash_arg);
39955         CHECK_ACCESS(block_hash_arg_ptr);
39956         LDKCOption_ThirtyTwoBytesZ block_hash_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(block_hash_arg_ptr);
39957         block_hash_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(block_hash_arg));
39958         LDKOutPoint outpoint_arg_conv;
39959         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
39960         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
39961         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
39962         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
39963         LDKCVec_u8Z script_pubkey_arg_ref;
39964         script_pubkey_arg_ref.datalen = (*env)->GetArrayLength(env, script_pubkey_arg);
39965         script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
39966         (*env)->GetByteArrayRegion(env, script_pubkey_arg, 0, script_pubkey_arg_ref.datalen, script_pubkey_arg_ref.data);
39967         LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_conv, outpoint_arg_conv, script_pubkey_arg_ref);
39968         int64_t ret_ref = 0;
39969         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39970         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39971         return ret_ref;
39972 }
39973
39974 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
39975         LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
39976         int64_t ret_ref = 0;
39977         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39978         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39979         return ret_ref;
39980 }
39981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39982         LDKWatchedOutput arg_conv;
39983         arg_conv.inner = untag_ptr(arg);
39984         arg_conv.is_owned = ptr_is_owned(arg);
39985         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39986         arg_conv.is_owned = false;
39987         int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
39988         return ret_conv;
39989 }
39990
39991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39992         LDKWatchedOutput orig_conv;
39993         orig_conv.inner = untag_ptr(orig);
39994         orig_conv.is_owned = ptr_is_owned(orig);
39995         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39996         orig_conv.is_owned = false;
39997         LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
39998         int64_t ret_ref = 0;
39999         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40000         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40001         return ret_ref;
40002 }
40003
40004 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40005         LDKWatchedOutput a_conv;
40006         a_conv.inner = untag_ptr(a);
40007         a_conv.is_owned = ptr_is_owned(a);
40008         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40009         a_conv.is_owned = false;
40010         LDKWatchedOutput b_conv;
40011         b_conv.inner = untag_ptr(b);
40012         b_conv.is_owned = ptr_is_owned(b);
40013         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40014         b_conv.is_owned = false;
40015         jboolean ret_conv = WatchedOutput_eq(&a_conv, &b_conv);
40016         return ret_conv;
40017 }
40018
40019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
40020         LDKWatchedOutput o_conv;
40021         o_conv.inner = untag_ptr(o);
40022         o_conv.is_owned = ptr_is_owned(o);
40023         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40024         o_conv.is_owned = false;
40025         int64_t ret_conv = WatchedOutput_hash(&o_conv);
40026         return ret_conv;
40027 }
40028
40029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
40030         if (!ptr_is_owned(this_ptr)) return;
40031         void* this_ptr_ptr = untag_ptr(this_ptr);
40032         CHECK_ACCESS(this_ptr_ptr);
40033         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
40034         FREE(untag_ptr(this_ptr));
40035         BroadcasterInterface_free(this_ptr_conv);
40036 }
40037
40038 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40039         LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)untag_ptr(orig);
40040         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
40041         return ret_conv;
40042 }
40043
40044 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1on_1chain_1sweep(JNIEnv *env, jclass clz) {
40045         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_on_chain_sweep());
40046         return ret_conv;
40047 }
40048
40049 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1min_1allowed_1anchor_1channel_1remote_1fee(JNIEnv *env, jclass clz) {
40050         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_min_allowed_anchor_channel_remote_fee());
40051         return ret_conv;
40052 }
40053
40054 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1min_1allowed_1non_1anchor_1channel_1remote_1fee(JNIEnv *env, jclass clz) {
40055         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_min_allowed_non_anchor_channel_remote_fee());
40056         return ret_conv;
40057 }
40058
40059 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1anchor_1channel_1fee(JNIEnv *env, jclass clz) {
40060         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_anchor_channel_fee());
40061         return ret_conv;
40062 }
40063
40064 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1non_1anchor_1channel_1fee(JNIEnv *env, jclass clz) {
40065         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_non_anchor_channel_fee());
40066         return ret_conv;
40067 }
40068
40069 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1channel_1close_1minimum(JNIEnv *env, jclass clz) {
40070         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_channel_close_minimum());
40071         return ret_conv;
40072 }
40073
40074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1hash(JNIEnv *env, jclass clz, int64_t o) {
40075         LDKConfirmationTarget* o_conv = (LDKConfirmationTarget*)untag_ptr(o);
40076         int64_t ret_conv = ConfirmationTarget_hash(o_conv);
40077         return ret_conv;
40078 }
40079
40080 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40081         LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)untag_ptr(a);
40082         LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)untag_ptr(b);
40083         jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
40084         return ret_conv;
40085 }
40086
40087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
40088         if (!ptr_is_owned(this_ptr)) return;
40089         void* this_ptr_ptr = untag_ptr(this_ptr);
40090         CHECK_ACCESS(this_ptr_ptr);
40091         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
40092         FREE(untag_ptr(this_ptr));
40093         FeeEstimator_free(this_ptr_conv);
40094 }
40095
40096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40097         LDKMonitorUpdateId this_obj_conv;
40098         this_obj_conv.inner = untag_ptr(this_obj);
40099         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40101         MonitorUpdateId_free(this_obj_conv);
40102 }
40103
40104 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
40105         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
40106         int64_t ret_ref = 0;
40107         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40108         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40109         return ret_ref;
40110 }
40111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40112         LDKMonitorUpdateId arg_conv;
40113         arg_conv.inner = untag_ptr(arg);
40114         arg_conv.is_owned = ptr_is_owned(arg);
40115         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40116         arg_conv.is_owned = false;
40117         int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
40118         return ret_conv;
40119 }
40120
40121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40122         LDKMonitorUpdateId orig_conv;
40123         orig_conv.inner = untag_ptr(orig);
40124         orig_conv.is_owned = ptr_is_owned(orig);
40125         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40126         orig_conv.is_owned = false;
40127         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
40128         int64_t ret_ref = 0;
40129         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40130         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40131         return ret_ref;
40132 }
40133
40134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1hash(JNIEnv *env, jclass clz, int64_t o) {
40135         LDKMonitorUpdateId o_conv;
40136         o_conv.inner = untag_ptr(o);
40137         o_conv.is_owned = ptr_is_owned(o);
40138         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40139         o_conv.is_owned = false;
40140         int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
40141         return ret_conv;
40142 }
40143
40144 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40145         LDKMonitorUpdateId a_conv;
40146         a_conv.inner = untag_ptr(a);
40147         a_conv.is_owned = ptr_is_owned(a);
40148         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40149         a_conv.is_owned = false;
40150         LDKMonitorUpdateId b_conv;
40151         b_conv.inner = untag_ptr(b);
40152         b_conv.is_owned = ptr_is_owned(b);
40153         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40154         b_conv.is_owned = false;
40155         jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
40156         return ret_conv;
40157 }
40158
40159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
40160         if (!ptr_is_owned(this_ptr)) return;
40161         void* this_ptr_ptr = untag_ptr(this_ptr);
40162         CHECK_ACCESS(this_ptr_ptr);
40163         LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
40164         FREE(untag_ptr(this_ptr));
40165         Persist_free(this_ptr_conv);
40166 }
40167
40168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40169         LDKLockedChannelMonitor this_obj_conv;
40170         this_obj_conv.inner = untag_ptr(this_obj);
40171         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40173         LockedChannelMonitor_free(this_obj_conv);
40174 }
40175
40176 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40177         LDKChainMonitor this_obj_conv;
40178         this_obj_conv.inner = untag_ptr(this_obj);
40179         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40181         ChainMonitor_free(this_obj_conv);
40182 }
40183
40184 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) {
40185         void* chain_source_ptr = untag_ptr(chain_source);
40186         CHECK_ACCESS(chain_source_ptr);
40187         LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
40188         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
40189         if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
40190                 // Manually implement clone for Java trait instances
40191                 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
40192                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40193                         LDKFilter_JCalls_cloned(&chain_source_conv.some);
40194                 }
40195         }
40196         void* broadcaster_ptr = untag_ptr(broadcaster);
40197         CHECK_ACCESS(broadcaster_ptr);
40198         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
40199         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
40200                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40201                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
40202         }
40203         void* logger_ptr = untag_ptr(logger);
40204         CHECK_ACCESS(logger_ptr);
40205         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
40206         if (logger_conv.free == LDKLogger_JCalls_free) {
40207                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40208                 LDKLogger_JCalls_cloned(&logger_conv);
40209         }
40210         void* feeest_ptr = untag_ptr(feeest);
40211         CHECK_ACCESS(feeest_ptr);
40212         LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
40213         if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
40214                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40215                 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
40216         }
40217         void* persister_ptr = untag_ptr(persister);
40218         CHECK_ACCESS(persister_ptr);
40219         LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
40220         if (persister_conv.free == LDKPersist_JCalls_free) {
40221                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40222                 LDKPersist_JCalls_cloned(&persister_conv);
40223         }
40224         LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
40225         int64_t ret_ref = 0;
40226         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40227         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40228         return ret_ref;
40229 }
40230
40231 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) {
40232         LDKChainMonitor this_arg_conv;
40233         this_arg_conv.inner = untag_ptr(this_arg);
40234         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40236         this_arg_conv.is_owned = false;
40237         LDKCVec_ChannelDetailsZ ignored_channels_constr;
40238         ignored_channels_constr.datalen = (*env)->GetArrayLength(env, ignored_channels);
40239         if (ignored_channels_constr.datalen > 0)
40240                 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
40241         else
40242                 ignored_channels_constr.data = NULL;
40243         int64_t* ignored_channels_vals = (*env)->GetLongArrayElements (env, ignored_channels, NULL);
40244         for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
40245                 int64_t ignored_channels_conv_16 = ignored_channels_vals[q];
40246                 LDKChannelDetails ignored_channels_conv_16_conv;
40247                 ignored_channels_conv_16_conv.inner = untag_ptr(ignored_channels_conv_16);
40248                 ignored_channels_conv_16_conv.is_owned = ptr_is_owned(ignored_channels_conv_16);
40249                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
40250                 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
40251                 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
40252         }
40253         (*env)->ReleaseLongArrayElements(env, ignored_channels, ignored_channels_vals, 0);
40254         LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
40255         int64_tArray ret_arr = NULL;
40256         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
40257         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
40258         for (size_t j = 0; j < ret_var.datalen; j++) {
40259                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
40260                 *ret_conv_9_copy = ret_var.data[j];
40261                 int64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
40262                 ret_arr_ptr[j] = ret_conv_9_ref;
40263         }
40264         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
40265         FREE(ret_var.data);
40266         return ret_arr;
40267 }
40268
40269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1monitor(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo) {
40270         LDKChainMonitor this_arg_conv;
40271         this_arg_conv.inner = untag_ptr(this_arg);
40272         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40274         this_arg_conv.is_owned = false;
40275         LDKOutPoint funding_txo_conv;
40276         funding_txo_conv.inner = untag_ptr(funding_txo);
40277         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
40278         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
40279         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
40280         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
40281         *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
40282         return tag_ptr(ret_conv, true);
40283 }
40284
40285 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1list_1monitors(JNIEnv *env, jclass clz, int64_t this_arg) {
40286         LDKChainMonitor this_arg_conv;
40287         this_arg_conv.inner = untag_ptr(this_arg);
40288         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40290         this_arg_conv.is_owned = false;
40291         LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
40292         int64_tArray ret_arr = NULL;
40293         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
40294         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
40295         for (size_t k = 0; k < ret_var.datalen; k++) {
40296                 LDKOutPoint ret_conv_10_var = ret_var.data[k];
40297                 int64_t ret_conv_10_ref = 0;
40298                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
40299                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
40300                 ret_arr_ptr[k] = ret_conv_10_ref;
40301         }
40302         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
40303         FREE(ret_var.data);
40304         return ret_arr;
40305 }
40306
40307 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1list_1pending_1monitor_1updates(JNIEnv *env, jclass clz, int64_t this_arg) {
40308         LDKChainMonitor this_arg_conv;
40309         this_arg_conv.inner = untag_ptr(this_arg);
40310         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40312         this_arg_conv.is_owned = false;
40313         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret_var = ChainMonitor_list_pending_monitor_updates(&this_arg_conv);
40314         int64_tArray ret_arr = NULL;
40315         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
40316         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
40317         for (size_t p = 0; p < ret_var.datalen; p++) {
40318                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv_41_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
40319                 *ret_conv_41_conv = ret_var.data[p];
40320                 ret_arr_ptr[p] = tag_ptr(ret_conv_41_conv, true);
40321         }
40322         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
40323         FREE(ret_var.data);
40324         return ret_arr;
40325 }
40326
40327 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) {
40328         LDKChainMonitor this_arg_conv;
40329         this_arg_conv.inner = untag_ptr(this_arg);
40330         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40332         this_arg_conv.is_owned = false;
40333         LDKOutPoint funding_txo_conv;
40334         funding_txo_conv.inner = untag_ptr(funding_txo);
40335         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
40336         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
40337         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
40338         LDKMonitorUpdateId completed_update_id_conv;
40339         completed_update_id_conv.inner = untag_ptr(completed_update_id);
40340         completed_update_id_conv.is_owned = ptr_is_owned(completed_update_id);
40341         CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
40342         completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
40343         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
40344         *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
40345         return tag_ptr(ret_conv, true);
40346 }
40347
40348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1update_1future(JNIEnv *env, jclass clz, int64_t this_arg) {
40349         LDKChainMonitor this_arg_conv;
40350         this_arg_conv.inner = untag_ptr(this_arg);
40351         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40353         this_arg_conv.is_owned = false;
40354         LDKFuture ret_var = ChainMonitor_get_update_future(&this_arg_conv);
40355         int64_t ret_ref = 0;
40356         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40357         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40358         return ret_ref;
40359 }
40360
40361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1rebroadcast_1pending_1claims(JNIEnv *env, jclass clz, int64_t this_arg) {
40362         LDKChainMonitor this_arg_conv;
40363         this_arg_conv.inner = untag_ptr(this_arg);
40364         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40366         this_arg_conv.is_owned = false;
40367         ChainMonitor_rebroadcast_pending_claims(&this_arg_conv);
40368 }
40369
40370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
40371         LDKChainMonitor this_arg_conv;
40372         this_arg_conv.inner = untag_ptr(this_arg);
40373         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40375         this_arg_conv.is_owned = false;
40376         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
40377         *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
40378         return tag_ptr(ret_ret, true);
40379 }
40380
40381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
40382         LDKChainMonitor this_arg_conv;
40383         this_arg_conv.inner = untag_ptr(this_arg);
40384         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40386         this_arg_conv.is_owned = false;
40387         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
40388         *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
40389         return tag_ptr(ret_ret, true);
40390 }
40391
40392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
40393         LDKChainMonitor this_arg_conv;
40394         this_arg_conv.inner = untag_ptr(this_arg);
40395         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40397         this_arg_conv.is_owned = false;
40398         LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
40399         *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
40400         return tag_ptr(ret_ret, true);
40401 }
40402
40403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
40404         LDKChainMonitor this_arg_conv;
40405         this_arg_conv.inner = untag_ptr(this_arg);
40406         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40408         this_arg_conv.is_owned = false;
40409         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
40410         *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
40411         return tag_ptr(ret_ret, true);
40412 }
40413
40414 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40415         LDKChannelMonitorUpdate this_obj_conv;
40416         this_obj_conv.inner = untag_ptr(this_obj);
40417         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40419         ChannelMonitorUpdate_free(this_obj_conv);
40420 }
40421
40422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
40423         LDKChannelMonitorUpdate this_ptr_conv;
40424         this_ptr_conv.inner = untag_ptr(this_ptr);
40425         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40427         this_ptr_conv.is_owned = false;
40428         int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
40429         return ret_conv;
40430 }
40431
40432 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40433         LDKChannelMonitorUpdate this_ptr_conv;
40434         this_ptr_conv.inner = untag_ptr(this_ptr);
40435         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40437         this_ptr_conv.is_owned = false;
40438         ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
40439 }
40440
40441 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
40442         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
40443         int64_t ret_ref = 0;
40444         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40445         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40446         return ret_ref;
40447 }
40448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40449         LDKChannelMonitorUpdate arg_conv;
40450         arg_conv.inner = untag_ptr(arg);
40451         arg_conv.is_owned = ptr_is_owned(arg);
40452         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40453         arg_conv.is_owned = false;
40454         int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
40455         return ret_conv;
40456 }
40457
40458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40459         LDKChannelMonitorUpdate orig_conv;
40460         orig_conv.inner = untag_ptr(orig);
40461         orig_conv.is_owned = ptr_is_owned(orig);
40462         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40463         orig_conv.is_owned = false;
40464         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
40465         int64_t ret_ref = 0;
40466         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40467         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40468         return ret_ref;
40469 }
40470
40471 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40472         LDKChannelMonitorUpdate a_conv;
40473         a_conv.inner = untag_ptr(a);
40474         a_conv.is_owned = ptr_is_owned(a);
40475         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40476         a_conv.is_owned = false;
40477         LDKChannelMonitorUpdate b_conv;
40478         b_conv.inner = untag_ptr(b);
40479         b_conv.is_owned = ptr_is_owned(b);
40480         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40481         b_conv.is_owned = false;
40482         jboolean ret_conv = ChannelMonitorUpdate_eq(&a_conv, &b_conv);
40483         return ret_conv;
40484 }
40485
40486 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
40487         LDKChannelMonitorUpdate obj_conv;
40488         obj_conv.inner = untag_ptr(obj);
40489         obj_conv.is_owned = ptr_is_owned(obj);
40490         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40491         obj_conv.is_owned = false;
40492         LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
40493         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40494         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40495         CVec_u8Z_free(ret_var);
40496         return ret_arr;
40497 }
40498
40499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40500         LDKu8slice ser_ref;
40501         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40502         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40503         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
40504         *ret_conv = ChannelMonitorUpdate_read(ser_ref);
40505         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40506         return tag_ptr(ret_conv, true);
40507 }
40508
40509 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
40510         if (!ptr_is_owned(this_ptr)) return;
40511         void* this_ptr_ptr = untag_ptr(this_ptr);
40512         CHECK_ACCESS(this_ptr_ptr);
40513         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
40514         FREE(untag_ptr(this_ptr));
40515         MonitorEvent_free(this_ptr_conv);
40516 }
40517
40518 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
40519         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
40520         *ret_copy = MonitorEvent_clone(arg);
40521         int64_t ret_ref = tag_ptr(ret_copy, true);
40522         return ret_ref;
40523 }
40524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40525         LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)untag_ptr(arg);
40526         int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
40527         return ret_conv;
40528 }
40529
40530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40531         LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)untag_ptr(orig);
40532         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
40533         *ret_copy = MonitorEvent_clone(orig_conv);
40534         int64_t ret_ref = tag_ptr(ret_copy, true);
40535         return ret_ref;
40536 }
40537
40538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1htlcevent(JNIEnv *env, jclass clz, int64_t a) {
40539         LDKHTLCUpdate a_conv;
40540         a_conv.inner = untag_ptr(a);
40541         a_conv.is_owned = ptr_is_owned(a);
40542         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40543         a_conv = HTLCUpdate_clone(&a_conv);
40544         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
40545         *ret_copy = MonitorEvent_htlcevent(a_conv);
40546         int64_t ret_ref = tag_ptr(ret_copy, true);
40547         return ret_ref;
40548 }
40549
40550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1holder_1force_1closed(JNIEnv *env, jclass clz, int64_t a) {
40551         LDKOutPoint a_conv;
40552         a_conv.inner = untag_ptr(a);
40553         a_conv.is_owned = ptr_is_owned(a);
40554         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40555         a_conv = OutPoint_clone(&a_conv);
40556         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
40557         *ret_copy = MonitorEvent_holder_force_closed(a_conv);
40558         int64_t ret_ref = tag_ptr(ret_copy, true);
40559         return ret_ref;
40560 }
40561
40562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1completed(JNIEnv *env, jclass clz, int64_t funding_txo, int64_t monitor_update_id) {
40563         LDKOutPoint funding_txo_conv;
40564         funding_txo_conv.inner = untag_ptr(funding_txo);
40565         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
40566         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
40567         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
40568         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
40569         *ret_copy = MonitorEvent_completed(funding_txo_conv, monitor_update_id);
40570         int64_t ret_ref = tag_ptr(ret_copy, true);
40571         return ret_ref;
40572 }
40573
40574 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40575         LDKMonitorEvent* a_conv = (LDKMonitorEvent*)untag_ptr(a);
40576         LDKMonitorEvent* b_conv = (LDKMonitorEvent*)untag_ptr(b);
40577         jboolean ret_conv = MonitorEvent_eq(a_conv, b_conv);
40578         return ret_conv;
40579 }
40580
40581 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1write(JNIEnv *env, jclass clz, int64_t obj) {
40582         LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)untag_ptr(obj);
40583         LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
40584         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40585         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40586         CVec_u8Z_free(ret_var);
40587         return ret_arr;
40588 }
40589
40590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40591         LDKu8slice ser_ref;
40592         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40593         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40594         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
40595         *ret_conv = MonitorEvent_read(ser_ref);
40596         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40597         return tag_ptr(ret_conv, true);
40598 }
40599
40600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40601         LDKHTLCUpdate this_obj_conv;
40602         this_obj_conv.inner = untag_ptr(this_obj);
40603         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40605         HTLCUpdate_free(this_obj_conv);
40606 }
40607
40608 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
40609         LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
40610         int64_t ret_ref = 0;
40611         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40612         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40613         return ret_ref;
40614 }
40615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40616         LDKHTLCUpdate arg_conv;
40617         arg_conv.inner = untag_ptr(arg);
40618         arg_conv.is_owned = ptr_is_owned(arg);
40619         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40620         arg_conv.is_owned = false;
40621         int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
40622         return ret_conv;
40623 }
40624
40625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40626         LDKHTLCUpdate orig_conv;
40627         orig_conv.inner = untag_ptr(orig);
40628         orig_conv.is_owned = ptr_is_owned(orig);
40629         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40630         orig_conv.is_owned = false;
40631         LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
40632         int64_t ret_ref = 0;
40633         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40634         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40635         return ret_ref;
40636 }
40637
40638 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40639         LDKHTLCUpdate a_conv;
40640         a_conv.inner = untag_ptr(a);
40641         a_conv.is_owned = ptr_is_owned(a);
40642         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40643         a_conv.is_owned = false;
40644         LDKHTLCUpdate b_conv;
40645         b_conv.inner = untag_ptr(b);
40646         b_conv.is_owned = ptr_is_owned(b);
40647         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40648         b_conv.is_owned = false;
40649         jboolean ret_conv = HTLCUpdate_eq(&a_conv, &b_conv);
40650         return ret_conv;
40651 }
40652
40653 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
40654         LDKHTLCUpdate obj_conv;
40655         obj_conv.inner = untag_ptr(obj);
40656         obj_conv.is_owned = ptr_is_owned(obj);
40657         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40658         obj_conv.is_owned = false;
40659         LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
40660         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40661         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40662         CVec_u8Z_free(ret_var);
40663         return ret_arr;
40664 }
40665
40666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40667         LDKu8slice ser_ref;
40668         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40669         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40670         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
40671         *ret_conv = HTLCUpdate_read(ser_ref);
40672         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40673         return tag_ptr(ret_conv, true);
40674 }
40675
40676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Balance_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
40677         if (!ptr_is_owned(this_ptr)) return;
40678         void* this_ptr_ptr = untag_ptr(this_ptr);
40679         CHECK_ACCESS(this_ptr_ptr);
40680         LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
40681         FREE(untag_ptr(this_ptr));
40682         Balance_free(this_ptr_conv);
40683 }
40684
40685 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
40686         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
40687         *ret_copy = Balance_clone(arg);
40688         int64_t ret_ref = tag_ptr(ret_copy, true);
40689         return ret_ref;
40690 }
40691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40692         LDKBalance* arg_conv = (LDKBalance*)untag_ptr(arg);
40693         int64_t ret_conv = Balance_clone_ptr(arg_conv);
40694         return ret_conv;
40695 }
40696
40697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40698         LDKBalance* orig_conv = (LDKBalance*)untag_ptr(orig);
40699         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
40700         *ret_copy = Balance_clone(orig_conv);
40701         int64_t ret_ref = tag_ptr(ret_copy, true);
40702         return ret_ref;
40703 }
40704
40705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1on_1channel_1close(JNIEnv *env, jclass clz, int64_t amount_satoshis) {
40706         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
40707         *ret_copy = Balance_claimable_on_channel_close(amount_satoshis);
40708         int64_t ret_ref = tag_ptr(ret_copy, true);
40709         return ret_ref;
40710 }
40711
40712 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) {
40713         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
40714         *ret_copy = Balance_claimable_awaiting_confirmations(amount_satoshis, confirmation_height);
40715         int64_t ret_ref = tag_ptr(ret_copy, true);
40716         return ret_ref;
40717 }
40718
40719 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) {
40720         LDKThirtyTwoBytes payment_hash_ref;
40721         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
40722         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
40723         LDKThirtyTwoBytes payment_preimage_ref;
40724         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
40725         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
40726         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
40727         *ret_copy = Balance_contentious_claimable(amount_satoshis, timeout_height, payment_hash_ref, payment_preimage_ref);
40728         int64_t ret_ref = tag_ptr(ret_copy, true);
40729         return ret_ref;
40730 }
40731
40732 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) {
40733         LDKThirtyTwoBytes payment_hash_ref;
40734         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
40735         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
40736         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
40737         *ret_copy = Balance_maybe_timeout_claimable_htlc(amount_satoshis, claimable_height, payment_hash_ref);
40738         int64_t ret_ref = tag_ptr(ret_copy, true);
40739         return ret_ref;
40740 }
40741
40742 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) {
40743         LDKThirtyTwoBytes payment_hash_ref;
40744         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
40745         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
40746         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
40747         *ret_copy = Balance_maybe_preimage_claimable_htlc(amount_satoshis, expiry_height, payment_hash_ref);
40748         int64_t ret_ref = tag_ptr(ret_copy, true);
40749         return ret_ref;
40750 }
40751
40752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1counterparty_1revoked_1output_1claimable(JNIEnv *env, jclass clz, int64_t amount_satoshis) {
40753         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
40754         *ret_copy = Balance_counterparty_revoked_output_claimable(amount_satoshis);
40755         int64_t ret_ref = tag_ptr(ret_copy, true);
40756         return ret_ref;
40757 }
40758
40759 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Balance_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40760         LDKBalance* a_conv = (LDKBalance*)untag_ptr(a);
40761         LDKBalance* b_conv = (LDKBalance*)untag_ptr(b);
40762         jboolean ret_conv = Balance_eq(a_conv, b_conv);
40763         return ret_conv;
40764 }
40765
40766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1amount_1satoshis(JNIEnv *env, jclass clz, int64_t this_arg) {
40767         LDKBalance* this_arg_conv = (LDKBalance*)untag_ptr(this_arg);
40768         int64_t ret_conv = Balance_claimable_amount_satoshis(this_arg_conv);
40769         return ret_conv;
40770 }
40771
40772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40773         LDKChannelMonitor this_obj_conv;
40774         this_obj_conv.inner = untag_ptr(this_obj);
40775         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40777         ChannelMonitor_free(this_obj_conv);
40778 }
40779
40780 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
40781         LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
40782         int64_t ret_ref = 0;
40783         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40784         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40785         return ret_ref;
40786 }
40787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40788         LDKChannelMonitor arg_conv;
40789         arg_conv.inner = untag_ptr(arg);
40790         arg_conv.is_owned = ptr_is_owned(arg);
40791         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40792         arg_conv.is_owned = false;
40793         int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
40794         return ret_conv;
40795 }
40796
40797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40798         LDKChannelMonitor orig_conv;
40799         orig_conv.inner = untag_ptr(orig);
40800         orig_conv.is_owned = ptr_is_owned(orig);
40801         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40802         orig_conv.is_owned = false;
40803         LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
40804         int64_t ret_ref = 0;
40805         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40806         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40807         return ret_ref;
40808 }
40809
40810 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
40811         LDKChannelMonitor obj_conv;
40812         obj_conv.inner = untag_ptr(obj);
40813         obj_conv.is_owned = ptr_is_owned(obj);
40814         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40815         obj_conv.is_owned = false;
40816         LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
40817         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40818         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40819         CVec_u8Z_free(ret_var);
40820         return ret_arr;
40821 }
40822
40823 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) {
40824         LDKChannelMonitor this_arg_conv;
40825         this_arg_conv.inner = untag_ptr(this_arg);
40826         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40828         this_arg_conv.is_owned = false;
40829         LDKChannelMonitorUpdate updates_conv;
40830         updates_conv.inner = untag_ptr(updates);
40831         updates_conv.is_owned = ptr_is_owned(updates);
40832         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
40833         updates_conv.is_owned = false;
40834         void* broadcaster_ptr = untag_ptr(broadcaster);
40835         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
40836         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
40837         void* fee_estimator_ptr = untag_ptr(fee_estimator);
40838         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
40839         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
40840         void* logger_ptr = untag_ptr(logger);
40841         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
40842         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
40843         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
40844         *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
40845         return tag_ptr(ret_conv, true);
40846 }
40847
40848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
40849         LDKChannelMonitor this_arg_conv;
40850         this_arg_conv.inner = untag_ptr(this_arg);
40851         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40853         this_arg_conv.is_owned = false;
40854         int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
40855         return ret_conv;
40856 }
40857
40858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
40859         LDKChannelMonitor this_arg_conv;
40860         this_arg_conv.inner = untag_ptr(this_arg);
40861         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40863         this_arg_conv.is_owned = false;
40864         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
40865         *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
40866         return tag_ptr(ret_conv, true);
40867 }
40868
40869 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg) {
40870         LDKChannelMonitor this_arg_conv;
40871         this_arg_conv.inner = untag_ptr(this_arg);
40872         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40874         this_arg_conv.is_owned = false;
40875         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
40876         int64_tArray ret_arr = NULL;
40877         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
40878         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
40879         for (size_t a = 0; a < ret_var.datalen; a++) {
40880                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv_52_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
40881                 *ret_conv_52_conv = ret_var.data[a];
40882                 ret_arr_ptr[a] = tag_ptr(ret_conv_52_conv, true);
40883         }
40884         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
40885         FREE(ret_var.data);
40886         return ret_arr;
40887 }
40888
40889 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) {
40890         LDKChannelMonitor this_arg_conv;
40891         this_arg_conv.inner = untag_ptr(this_arg);
40892         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40894         this_arg_conv.is_owned = false;
40895         void* filter_ptr = untag_ptr(filter);
40896         if (ptr_is_owned(filter)) { CHECK_ACCESS(filter_ptr); }
40897         LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
40898         void* logger_ptr = untag_ptr(logger);
40899         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
40900         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
40901         ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv, logger_conv);
40902 }
40903
40904 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
40905         LDKChannelMonitor this_arg_conv;
40906         this_arg_conv.inner = untag_ptr(this_arg);
40907         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40909         this_arg_conv.is_owned = false;
40910         LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
40911         int64_tArray ret_arr = NULL;
40912         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
40913         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
40914         for (size_t o = 0; o < ret_var.datalen; o++) {
40915                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
40916                 *ret_conv_14_copy = ret_var.data[o];
40917                 int64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
40918                 ret_arr_ptr[o] = ret_conv_14_ref;
40919         }
40920         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
40921         FREE(ret_var.data);
40922         return ret_arr;
40923 }
40924
40925 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
40926         LDKChannelMonitor this_arg_conv;
40927         this_arg_conv.inner = untag_ptr(this_arg);
40928         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40930         this_arg_conv.is_owned = false;
40931         void* handler_ptr = untag_ptr(handler);
40932         if (ptr_is_owned(handler)) { CHECK_ACCESS(handler_ptr); }
40933         LDKEventHandler* handler_conv = (LDKEventHandler*)handler_ptr;
40934         ChannelMonitor_process_pending_events(&this_arg_conv, handler_conv);
40935 }
40936
40937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1initial_1counterparty_1commitment_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
40938         LDKChannelMonitor this_arg_conv;
40939         this_arg_conv.inner = untag_ptr(this_arg);
40940         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40942         this_arg_conv.is_owned = false;
40943         LDKCommitmentTransaction ret_var = ChannelMonitor_initial_counterparty_commitment_tx(&this_arg_conv);
40944         int64_t ret_ref = 0;
40945         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40946         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40947         return ret_ref;
40948 }
40949
40950 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) {
40951         LDKChannelMonitor this_arg_conv;
40952         this_arg_conv.inner = untag_ptr(this_arg);
40953         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40955         this_arg_conv.is_owned = false;
40956         LDKChannelMonitorUpdate update_conv;
40957         update_conv.inner = untag_ptr(update);
40958         update_conv.is_owned = ptr_is_owned(update);
40959         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
40960         update_conv.is_owned = false;
40961         LDKCVec_CommitmentTransactionZ ret_var = ChannelMonitor_counterparty_commitment_txs_from_update(&this_arg_conv, &update_conv);
40962         int64_tArray ret_arr = NULL;
40963         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
40964         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
40965         for (size_t x = 0; x < ret_var.datalen; x++) {
40966                 LDKCommitmentTransaction ret_conv_23_var = ret_var.data[x];
40967                 int64_t ret_conv_23_ref = 0;
40968                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_23_var);
40969                 ret_conv_23_ref = tag_ptr(ret_conv_23_var.inner, ret_conv_23_var.is_owned);
40970                 ret_arr_ptr[x] = ret_conv_23_ref;
40971         }
40972         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
40973         FREE(ret_var.data);
40974         return ret_arr;
40975 }
40976
40977 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) {
40978         LDKChannelMonitor this_arg_conv;
40979         this_arg_conv.inner = untag_ptr(this_arg);
40980         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40982         this_arg_conv.is_owned = false;
40983         LDKTransaction justice_tx_ref;
40984         justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
40985         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
40986         (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
40987         justice_tx_ref.data_is_owned = true;
40988         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
40989         *ret_conv = ChannelMonitor_sign_to_local_justice_tx(&this_arg_conv, justice_tx_ref, input_idx, value, commitment_number);
40990         return tag_ptr(ret_conv, true);
40991 }
40992
40993 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1counterparty_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
40994         LDKChannelMonitor this_arg_conv;
40995         this_arg_conv.inner = untag_ptr(this_arg);
40996         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40998         this_arg_conv.is_owned = false;
40999         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
41000         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form);
41001         return ret_arr;
41002 }
41003
41004 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1holder_1commitment_1txn(JNIEnv *env, jclass clz, int64_t this_arg, int64_t logger) {
41005         LDKChannelMonitor this_arg_conv;
41006         this_arg_conv.inner = untag_ptr(this_arg);
41007         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41009         this_arg_conv.is_owned = false;
41010         void* logger_ptr = untag_ptr(logger);
41011         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
41012         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
41013         LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
41014         jobjectArray ret_arr = NULL;
41015         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
41016         ;
41017         for (size_t i = 0; i < ret_var.datalen; i++) {
41018                 LDKTransaction ret_conv_8_var = ret_var.data[i];
41019                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
41020                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
41021                 Transaction_free(ret_conv_8_var);
41022                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
41023         }
41024         
41025         FREE(ret_var.data);
41026         return ret_arr;
41027 }
41028
41029 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) {
41030         LDKChannelMonitor this_arg_conv;
41031         this_arg_conv.inner = untag_ptr(this_arg);
41032         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41034         this_arg_conv.is_owned = false;
41035         uint8_t header_arr[80];
41036         CHECK((*env)->GetArrayLength(env, header) == 80);
41037         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
41038         uint8_t (*header_ref)[80] = &header_arr;
41039         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
41040         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
41041         if (txdata_constr.datalen > 0)
41042                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
41043         else
41044                 txdata_constr.data = NULL;
41045         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
41046         for (size_t c = 0; c < txdata_constr.datalen; c++) {
41047                 int64_t txdata_conv_28 = txdata_vals[c];
41048                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
41049                 CHECK_ACCESS(txdata_conv_28_ptr);
41050                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
41051                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
41052                 txdata_constr.data[c] = txdata_conv_28_conv;
41053         }
41054         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
41055         void* broadcaster_ptr = untag_ptr(broadcaster);
41056         CHECK_ACCESS(broadcaster_ptr);
41057         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
41058         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
41059                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41060                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
41061         }
41062         void* fee_estimator_ptr = untag_ptr(fee_estimator);
41063         CHECK_ACCESS(fee_estimator_ptr);
41064         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
41065         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
41066                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41067                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
41068         }
41069         void* logger_ptr = untag_ptr(logger);
41070         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
41071         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
41072         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);
41073         int64_tArray ret_arr = NULL;
41074         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
41075         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
41076         for (size_t x = 0; x < ret_var.datalen; x++) {
41077                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
41078                 *ret_conv_49_conv = ret_var.data[x];
41079                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
41080         }
41081         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
41082         FREE(ret_var.data);
41083         return ret_arr;
41084 }
41085
41086 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) {
41087         LDKChannelMonitor this_arg_conv;
41088         this_arg_conv.inner = untag_ptr(this_arg);
41089         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41091         this_arg_conv.is_owned = false;
41092         uint8_t header_arr[80];
41093         CHECK((*env)->GetArrayLength(env, header) == 80);
41094         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
41095         uint8_t (*header_ref)[80] = &header_arr;
41096         void* broadcaster_ptr = untag_ptr(broadcaster);
41097         CHECK_ACCESS(broadcaster_ptr);
41098         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
41099         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
41100                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41101                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
41102         }
41103         void* fee_estimator_ptr = untag_ptr(fee_estimator);
41104         CHECK_ACCESS(fee_estimator_ptr);
41105         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
41106         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
41107                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41108                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
41109         }
41110         void* logger_ptr = untag_ptr(logger);
41111         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
41112         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
41113         ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
41114 }
41115
41116 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) {
41117         LDKChannelMonitor this_arg_conv;
41118         this_arg_conv.inner = untag_ptr(this_arg);
41119         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41121         this_arg_conv.is_owned = false;
41122         uint8_t header_arr[80];
41123         CHECK((*env)->GetArrayLength(env, header) == 80);
41124         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
41125         uint8_t (*header_ref)[80] = &header_arr;
41126         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
41127         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
41128         if (txdata_constr.datalen > 0)
41129                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
41130         else
41131                 txdata_constr.data = NULL;
41132         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
41133         for (size_t c = 0; c < txdata_constr.datalen; c++) {
41134                 int64_t txdata_conv_28 = txdata_vals[c];
41135                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
41136                 CHECK_ACCESS(txdata_conv_28_ptr);
41137                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
41138                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
41139                 txdata_constr.data[c] = txdata_conv_28_conv;
41140         }
41141         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
41142         void* broadcaster_ptr = untag_ptr(broadcaster);
41143         CHECK_ACCESS(broadcaster_ptr);
41144         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
41145         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
41146                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41147                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
41148         }
41149         void* fee_estimator_ptr = untag_ptr(fee_estimator);
41150         CHECK_ACCESS(fee_estimator_ptr);
41151         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
41152         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
41153                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41154                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
41155         }
41156         void* logger_ptr = untag_ptr(logger);
41157         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
41158         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
41159         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);
41160         int64_tArray ret_arr = NULL;
41161         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
41162         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
41163         for (size_t x = 0; x < ret_var.datalen; x++) {
41164                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
41165                 *ret_conv_49_conv = ret_var.data[x];
41166                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
41167         }
41168         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
41169         FREE(ret_var.data);
41170         return ret_arr;
41171 }
41172
41173 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) {
41174         LDKChannelMonitor this_arg_conv;
41175         this_arg_conv.inner = untag_ptr(this_arg);
41176         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41178         this_arg_conv.is_owned = false;
41179         uint8_t txid_arr[32];
41180         CHECK((*env)->GetArrayLength(env, txid) == 32);
41181         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
41182         uint8_t (*txid_ref)[32] = &txid_arr;
41183         void* broadcaster_ptr = untag_ptr(broadcaster);
41184         CHECK_ACCESS(broadcaster_ptr);
41185         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
41186         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
41187                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41188                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
41189         }
41190         void* fee_estimator_ptr = untag_ptr(fee_estimator);
41191         CHECK_ACCESS(fee_estimator_ptr);
41192         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
41193         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
41194                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41195                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
41196         }
41197         void* logger_ptr = untag_ptr(logger);
41198         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
41199         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
41200         ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
41201 }
41202
41203 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) {
41204         LDKChannelMonitor this_arg_conv;
41205         this_arg_conv.inner = untag_ptr(this_arg);
41206         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41208         this_arg_conv.is_owned = false;
41209         uint8_t header_arr[80];
41210         CHECK((*env)->GetArrayLength(env, header) == 80);
41211         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
41212         uint8_t (*header_ref)[80] = &header_arr;
41213         void* broadcaster_ptr = untag_ptr(broadcaster);
41214         CHECK_ACCESS(broadcaster_ptr);
41215         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
41216         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
41217                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41218                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
41219         }
41220         void* fee_estimator_ptr = untag_ptr(fee_estimator);
41221         CHECK_ACCESS(fee_estimator_ptr);
41222         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
41223         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
41224                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41225                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
41226         }
41227         void* logger_ptr = untag_ptr(logger);
41228         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
41229         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
41230         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
41231         int64_tArray ret_arr = NULL;
41232         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
41233         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
41234         for (size_t x = 0; x < ret_var.datalen; x++) {
41235                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
41236                 *ret_conv_49_conv = ret_var.data[x];
41237                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
41238         }
41239         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
41240         FREE(ret_var.data);
41241         return ret_arr;
41242 }
41243
41244 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
41245         LDKChannelMonitor this_arg_conv;
41246         this_arg_conv.inner = untag_ptr(this_arg);
41247         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41249         this_arg_conv.is_owned = false;
41250         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
41251         int64_tArray ret_arr = NULL;
41252         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
41253         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
41254         for (size_t c = 0; c < ret_var.datalen; c++) {
41255                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv_54_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
41256                 *ret_conv_54_conv = ret_var.data[c];
41257                 ret_arr_ptr[c] = tag_ptr(ret_conv_54_conv, true);
41258         }
41259         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
41260         FREE(ret_var.data);
41261         return ret_arr;
41262 }
41263
41264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
41265         LDKChannelMonitor this_arg_conv;
41266         this_arg_conv.inner = untag_ptr(this_arg);
41267         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41269         this_arg_conv.is_owned = false;
41270         LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
41271         int64_t ret_ref = 0;
41272         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41273         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41274         return ret_ref;
41275 }
41276
41277 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) {
41278         LDKChannelMonitor this_arg_conv;
41279         this_arg_conv.inner = untag_ptr(this_arg);
41280         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41282         this_arg_conv.is_owned = false;
41283         void* broadcaster_ptr = untag_ptr(broadcaster);
41284         CHECK_ACCESS(broadcaster_ptr);
41285         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
41286         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
41287                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41288                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
41289         }
41290         void* fee_estimator_ptr = untag_ptr(fee_estimator);
41291         CHECK_ACCESS(fee_estimator_ptr);
41292         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
41293         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
41294                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41295                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
41296         }
41297         void* logger_ptr = untag_ptr(logger);
41298         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
41299         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
41300         ChannelMonitor_rebroadcast_pending_claims(&this_arg_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
41301 }
41302
41303 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) {
41304         LDKChannelMonitor this_arg_conv;
41305         this_arg_conv.inner = untag_ptr(this_arg);
41306         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41308         this_arg_conv.is_owned = false;
41309         LDKTransaction tx_ref;
41310         tx_ref.datalen = (*env)->GetArrayLength(env, tx);
41311         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
41312         (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
41313         tx_ref.data_is_owned = true;
41314         LDKCVec_SpendableOutputDescriptorZ ret_var = ChannelMonitor_get_spendable_outputs(&this_arg_conv, tx_ref, confirmation_height);
41315         int64_tArray ret_arr = NULL;
41316         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
41317         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
41318         for (size_t b = 0; b < ret_var.datalen; b++) {
41319                 LDKSpendableOutputDescriptor *ret_conv_27_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
41320                 *ret_conv_27_copy = ret_var.data[b];
41321                 int64_t ret_conv_27_ref = tag_ptr(ret_conv_27_copy, true);
41322                 ret_arr_ptr[b] = ret_conv_27_ref;
41323         }
41324         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
41325         FREE(ret_var.data);
41326         return ret_arr;
41327 }
41328
41329 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1claimable_1balances(JNIEnv *env, jclass clz, int64_t this_arg) {
41330         LDKChannelMonitor this_arg_conv;
41331         this_arg_conv.inner = untag_ptr(this_arg);
41332         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41334         this_arg_conv.is_owned = false;
41335         LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
41336         int64_tArray ret_arr = NULL;
41337         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
41338         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
41339         for (size_t j = 0; j < ret_var.datalen; j++) {
41340                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
41341                 *ret_conv_9_copy = ret_var.data[j];
41342                 int64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
41343                 ret_arr_ptr[j] = ret_conv_9_ref;
41344         }
41345         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
41346         FREE(ret_var.data);
41347         return ret_arr;
41348 }
41349
41350 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) {
41351         LDKu8slice ser_ref;
41352         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41353         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41354         void* arg_a_ptr = untag_ptr(arg_a);
41355         if (ptr_is_owned(arg_a)) { CHECK_ACCESS(arg_a_ptr); }
41356         LDKEntropySource* arg_a_conv = (LDKEntropySource*)arg_a_ptr;
41357         void* arg_b_ptr = untag_ptr(arg_b);
41358         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
41359         LDKSignerProvider* arg_b_conv = (LDKSignerProvider*)arg_b_ptr;
41360         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
41361         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_read(ser_ref, arg_a_conv, arg_b_conv);
41362         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41363         return tag_ptr(ret_conv, true);
41364 }
41365
41366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41367         LDKOutPoint this_obj_conv;
41368         this_obj_conv.inner = untag_ptr(this_obj);
41369         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41371         OutPoint_free(this_obj_conv);
41372 }
41373
41374 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
41375         LDKOutPoint this_ptr_conv;
41376         this_ptr_conv.inner = untag_ptr(this_ptr);
41377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41379         this_ptr_conv.is_owned = false;
41380         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
41381         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
41382         return ret_arr;
41383 }
41384
41385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41386         LDKOutPoint this_ptr_conv;
41387         this_ptr_conv.inner = untag_ptr(this_ptr);
41388         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41390         this_ptr_conv.is_owned = false;
41391         LDKThirtyTwoBytes val_ref;
41392         CHECK((*env)->GetArrayLength(env, val) == 32);
41393         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
41394         OutPoint_set_txid(&this_ptr_conv, val_ref);
41395 }
41396
41397 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
41398         LDKOutPoint this_ptr_conv;
41399         this_ptr_conv.inner = untag_ptr(this_ptr);
41400         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41402         this_ptr_conv.is_owned = false;
41403         int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
41404         return ret_conv;
41405 }
41406
41407 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
41408         LDKOutPoint this_ptr_conv;
41409         this_ptr_conv.inner = untag_ptr(this_ptr);
41410         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41412         this_ptr_conv.is_owned = false;
41413         OutPoint_set_index(&this_ptr_conv, val);
41414 }
41415
41416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
41417         LDKThirtyTwoBytes txid_arg_ref;
41418         CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
41419         (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
41420         LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
41421         int64_t ret_ref = 0;
41422         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41423         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41424         return ret_ref;
41425 }
41426
41427 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
41428         LDKOutPoint ret_var = OutPoint_clone(arg);
41429         int64_t ret_ref = 0;
41430         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41431         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41432         return ret_ref;
41433 }
41434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41435         LDKOutPoint arg_conv;
41436         arg_conv.inner = untag_ptr(arg);
41437         arg_conv.is_owned = ptr_is_owned(arg);
41438         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41439         arg_conv.is_owned = false;
41440         int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
41441         return ret_conv;
41442 }
41443
41444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41445         LDKOutPoint orig_conv;
41446         orig_conv.inner = untag_ptr(orig);
41447         orig_conv.is_owned = ptr_is_owned(orig);
41448         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41449         orig_conv.is_owned = false;
41450         LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
41451         int64_t ret_ref = 0;
41452         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41453         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41454         return ret_ref;
41455 }
41456
41457 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OutPoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41458         LDKOutPoint a_conv;
41459         a_conv.inner = untag_ptr(a);
41460         a_conv.is_owned = ptr_is_owned(a);
41461         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41462         a_conv.is_owned = false;
41463         LDKOutPoint b_conv;
41464         b_conv.inner = untag_ptr(b);
41465         b_conv.is_owned = ptr_is_owned(b);
41466         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41467         b_conv.is_owned = false;
41468         jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
41469         return ret_conv;
41470 }
41471
41472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
41473         LDKOutPoint o_conv;
41474         o_conv.inner = untag_ptr(o);
41475         o_conv.is_owned = ptr_is_owned(o);
41476         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41477         o_conv.is_owned = false;
41478         int64_t ret_conv = OutPoint_hash(&o_conv);
41479         return ret_conv;
41480 }
41481
41482 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
41483         LDKOutPoint this_arg_conv;
41484         this_arg_conv.inner = untag_ptr(this_arg);
41485         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41487         this_arg_conv.is_owned = false;
41488         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
41489         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
41490         return ret_arr;
41491 }
41492
41493 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
41494         LDKOutPoint obj_conv;
41495         obj_conv.inner = untag_ptr(obj);
41496         obj_conv.is_owned = ptr_is_owned(obj);
41497         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41498         obj_conv.is_owned = false;
41499         LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
41500         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41501         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41502         CVec_u8Z_free(ret_var);
41503         return ret_arr;
41504 }
41505
41506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41507         LDKu8slice ser_ref;
41508         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41509         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41510         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
41511         *ret_conv = OutPoint_read(ser_ref);
41512         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41513         return tag_ptr(ret_conv, true);
41514 }
41515
41516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41517         LDKInboundHTLCErr this_obj_conv;
41518         this_obj_conv.inner = untag_ptr(this_obj);
41519         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41521         InboundHTLCErr_free(this_obj_conv);
41522 }
41523
41524 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1get_1err_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
41525         LDKInboundHTLCErr this_ptr_conv;
41526         this_ptr_conv.inner = untag_ptr(this_ptr);
41527         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41529         this_ptr_conv.is_owned = false;
41530         int16_t ret_conv = InboundHTLCErr_get_err_code(&this_ptr_conv);
41531         return ret_conv;
41532 }
41533
41534 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1set_1err_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
41535         LDKInboundHTLCErr this_ptr_conv;
41536         this_ptr_conv.inner = untag_ptr(this_ptr);
41537         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41539         this_ptr_conv.is_owned = false;
41540         InboundHTLCErr_set_err_code(&this_ptr_conv, val);
41541 }
41542
41543 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1get_1err_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
41544         LDKInboundHTLCErr 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         LDKCVec_u8Z ret_var = InboundHTLCErr_get_err_data(&this_ptr_conv);
41550         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41551         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41552         CVec_u8Z_free(ret_var);
41553         return ret_arr;
41554 }
41555
41556 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1set_1err_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41557         LDKInboundHTLCErr this_ptr_conv;
41558         this_ptr_conv.inner = untag_ptr(this_ptr);
41559         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41561         this_ptr_conv.is_owned = false;
41562         LDKCVec_u8Z val_ref;
41563         val_ref.datalen = (*env)->GetArrayLength(env, val);
41564         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
41565         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
41566         InboundHTLCErr_set_err_data(&this_ptr_conv, val_ref);
41567 }
41568
41569 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1get_1msg(JNIEnv *env, jclass clz, int64_t this_ptr) {
41570         LDKInboundHTLCErr this_ptr_conv;
41571         this_ptr_conv.inner = untag_ptr(this_ptr);
41572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41574         this_ptr_conv.is_owned = false;
41575         LDKStr ret_str = InboundHTLCErr_get_msg(&this_ptr_conv);
41576         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
41577         Str_free(ret_str);
41578         return ret_conv;
41579 }
41580
41581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1set_1msg(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
41582         LDKInboundHTLCErr this_ptr_conv;
41583         this_ptr_conv.inner = untag_ptr(this_ptr);
41584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41586         this_ptr_conv.is_owned = false;
41587         LDKStr val_conv = java_to_owned_str(env, val);
41588         InboundHTLCErr_set_msg(&this_ptr_conv, val_conv);
41589 }
41590
41591 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) {
41592         LDKCVec_u8Z err_data_arg_ref;
41593         err_data_arg_ref.datalen = (*env)->GetArrayLength(env, err_data_arg);
41594         err_data_arg_ref.data = MALLOC(err_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
41595         (*env)->GetByteArrayRegion(env, err_data_arg, 0, err_data_arg_ref.datalen, err_data_arg_ref.data);
41596         LDKStr msg_arg_conv = java_to_owned_str(env, msg_arg);
41597         LDKInboundHTLCErr ret_var = InboundHTLCErr_new(err_code_arg, err_data_arg_ref, msg_arg_conv);
41598         int64_t ret_ref = 0;
41599         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41600         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41601         return ret_ref;
41602 }
41603
41604 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) {
41605         LDKUpdateAddHTLC msg_conv;
41606         msg_conv.inner = untag_ptr(msg);
41607         msg_conv.is_owned = ptr_is_owned(msg);
41608         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
41609         msg_conv.is_owned = false;
41610         void* node_signer_ptr = untag_ptr(node_signer);
41611         if (ptr_is_owned(node_signer)) { CHECK_ACCESS(node_signer_ptr); }
41612         LDKNodeSigner* node_signer_conv = (LDKNodeSigner*)node_signer_ptr;
41613         void* logger_ptr = untag_ptr(logger);
41614         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
41615         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
41616         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
41617         *ret_conv = peel_payment_onion(&msg_conv, node_signer_conv, logger_conv, cur_height, accept_mpp_keysend, allow_skimmed_fees);
41618         return tag_ptr(ret_conv, true);
41619 }
41620
41621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PendingHTLCRouting_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
41622         if (!ptr_is_owned(this_ptr)) return;
41623         void* this_ptr_ptr = untag_ptr(this_ptr);
41624         CHECK_ACCESS(this_ptr_ptr);
41625         LDKPendingHTLCRouting this_ptr_conv = *(LDKPendingHTLCRouting*)(this_ptr_ptr);
41626         FREE(untag_ptr(this_ptr));
41627         PendingHTLCRouting_free(this_ptr_conv);
41628 }
41629
41630 static inline uint64_t PendingHTLCRouting_clone_ptr(LDKPendingHTLCRouting *NONNULL_PTR arg) {
41631         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
41632         *ret_copy = PendingHTLCRouting_clone(arg);
41633         int64_t ret_ref = tag_ptr(ret_copy, true);
41634         return ret_ref;
41635 }
41636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCRouting_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41637         LDKPendingHTLCRouting* arg_conv = (LDKPendingHTLCRouting*)untag_ptr(arg);
41638         int64_t ret_conv = PendingHTLCRouting_clone_ptr(arg_conv);
41639         return ret_conv;
41640 }
41641
41642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCRouting_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41643         LDKPendingHTLCRouting* orig_conv = (LDKPendingHTLCRouting*)untag_ptr(orig);
41644         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
41645         *ret_copy = PendingHTLCRouting_clone(orig_conv);
41646         int64_t ret_ref = tag_ptr(ret_copy, true);
41647         return ret_ref;
41648 }
41649
41650 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) {
41651         LDKOnionPacket onion_packet_conv;
41652         onion_packet_conv.inner = untag_ptr(onion_packet);
41653         onion_packet_conv.is_owned = ptr_is_owned(onion_packet);
41654         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_packet_conv);
41655         onion_packet_conv = OnionPacket_clone(&onion_packet_conv);
41656         LDKBlindedForward blinded_conv;
41657         blinded_conv.inner = untag_ptr(blinded);
41658         blinded_conv.is_owned = ptr_is_owned(blinded);
41659         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_conv);
41660         blinded_conv = BlindedForward_clone(&blinded_conv);
41661         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
41662         *ret_copy = PendingHTLCRouting_forward(onion_packet_conv, short_channel_id, blinded_conv);
41663         int64_t ret_ref = tag_ptr(ret_copy, true);
41664         return ret_ref;
41665 }
41666
41667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCRouting_1receive(JNIEnv *env, jclass clz, int64_t payment_data, int64_t payment_metadata, int32_t incoming_cltv_expiry, int8_tArray phantom_shared_secret, int64_tArray custom_tlvs, jboolean requires_blinded_error) {
41668         LDKFinalOnionHopData payment_data_conv;
41669         payment_data_conv.inner = untag_ptr(payment_data);
41670         payment_data_conv.is_owned = ptr_is_owned(payment_data);
41671         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_conv);
41672         payment_data_conv = FinalOnionHopData_clone(&payment_data_conv);
41673         void* payment_metadata_ptr = untag_ptr(payment_metadata);
41674         CHECK_ACCESS(payment_metadata_ptr);
41675         LDKCOption_CVec_u8ZZ payment_metadata_conv = *(LDKCOption_CVec_u8ZZ*)(payment_metadata_ptr);
41676         payment_metadata_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(payment_metadata));
41677         LDKThirtyTwoBytes phantom_shared_secret_ref;
41678         CHECK((*env)->GetArrayLength(env, phantom_shared_secret) == 32);
41679         (*env)->GetByteArrayRegion(env, phantom_shared_secret, 0, 32, phantom_shared_secret_ref.data);
41680         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
41681         custom_tlvs_constr.datalen = (*env)->GetArrayLength(env, custom_tlvs);
41682         if (custom_tlvs_constr.datalen > 0)
41683                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
41684         else
41685                 custom_tlvs_constr.data = NULL;
41686         int64_t* custom_tlvs_vals = (*env)->GetLongArrayElements (env, custom_tlvs, NULL);
41687         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
41688                 int64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
41689                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
41690                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
41691                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
41692                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
41693                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
41694         }
41695         (*env)->ReleaseLongArrayElements(env, custom_tlvs, custom_tlvs_vals, 0);
41696         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
41697         *ret_copy = PendingHTLCRouting_receive(payment_data_conv, payment_metadata_conv, incoming_cltv_expiry, phantom_shared_secret_ref, custom_tlvs_constr, requires_blinded_error);
41698         int64_t ret_ref = tag_ptr(ret_copy, true);
41699         return ret_ref;
41700 }
41701
41702 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) {
41703         LDKFinalOnionHopData payment_data_conv;
41704         payment_data_conv.inner = untag_ptr(payment_data);
41705         payment_data_conv.is_owned = ptr_is_owned(payment_data);
41706         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_conv);
41707         payment_data_conv = FinalOnionHopData_clone(&payment_data_conv);
41708         LDKThirtyTwoBytes payment_preimage_ref;
41709         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
41710         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
41711         void* payment_metadata_ptr = untag_ptr(payment_metadata);
41712         CHECK_ACCESS(payment_metadata_ptr);
41713         LDKCOption_CVec_u8ZZ payment_metadata_conv = *(LDKCOption_CVec_u8ZZ*)(payment_metadata_ptr);
41714         payment_metadata_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(payment_metadata));
41715         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
41716         custom_tlvs_constr.datalen = (*env)->GetArrayLength(env, custom_tlvs);
41717         if (custom_tlvs_constr.datalen > 0)
41718                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
41719         else
41720                 custom_tlvs_constr.data = NULL;
41721         int64_t* custom_tlvs_vals = (*env)->GetLongArrayElements (env, custom_tlvs, NULL);
41722         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
41723                 int64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
41724                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
41725                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
41726                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
41727                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
41728                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
41729         }
41730         (*env)->ReleaseLongArrayElements(env, custom_tlvs, custom_tlvs_vals, 0);
41731         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
41732         *ret_copy = PendingHTLCRouting_receive_keysend(payment_data_conv, payment_preimage_ref, payment_metadata_conv, incoming_cltv_expiry, custom_tlvs_constr);
41733         int64_t ret_ref = tag_ptr(ret_copy, true);
41734         return ret_ref;
41735 }
41736
41737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedForward_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41738         LDKBlindedForward this_obj_conv;
41739         this_obj_conv.inner = untag_ptr(this_obj);
41740         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41742         BlindedForward_free(this_obj_conv);
41743 }
41744
41745 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedForward_1get_1inbound_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
41746         LDKBlindedForward this_ptr_conv;
41747         this_ptr_conv.inner = untag_ptr(this_ptr);
41748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41750         this_ptr_conv.is_owned = false;
41751         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
41752         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, BlindedForward_get_inbound_blinding_point(&this_ptr_conv).compressed_form);
41753         return ret_arr;
41754 }
41755
41756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedForward_1set_1inbound_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41757         LDKBlindedForward this_ptr_conv;
41758         this_ptr_conv.inner = untag_ptr(this_ptr);
41759         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41761         this_ptr_conv.is_owned = false;
41762         LDKPublicKey val_ref;
41763         CHECK((*env)->GetArrayLength(env, val) == 33);
41764         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
41765         BlindedForward_set_inbound_blinding_point(&this_ptr_conv, val_ref);
41766 }
41767
41768 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_BlindedForward_1get_1failure(JNIEnv *env, jclass clz, int64_t this_ptr) {
41769         LDKBlindedForward this_ptr_conv;
41770         this_ptr_conv.inner = untag_ptr(this_ptr);
41771         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41773         this_ptr_conv.is_owned = false;
41774         jclass ret_conv = LDKBlindedFailure_to_java(env, BlindedForward_get_failure(&this_ptr_conv));
41775         return ret_conv;
41776 }
41777
41778 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedForward_1set_1failure(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
41779         LDKBlindedForward this_ptr_conv;
41780         this_ptr_conv.inner = untag_ptr(this_ptr);
41781         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41783         this_ptr_conv.is_owned = false;
41784         LDKBlindedFailure val_conv = LDKBlindedFailure_from_java(env, val);
41785         BlindedForward_set_failure(&this_ptr_conv, val_conv);
41786 }
41787
41788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedForward_1new(JNIEnv *env, jclass clz, int8_tArray inbound_blinding_point_arg, jclass failure_arg) {
41789         LDKPublicKey inbound_blinding_point_arg_ref;
41790         CHECK((*env)->GetArrayLength(env, inbound_blinding_point_arg) == 33);
41791         (*env)->GetByteArrayRegion(env, inbound_blinding_point_arg, 0, 33, inbound_blinding_point_arg_ref.compressed_form);
41792         LDKBlindedFailure failure_arg_conv = LDKBlindedFailure_from_java(env, failure_arg);
41793         LDKBlindedForward ret_var = BlindedForward_new(inbound_blinding_point_arg_ref, failure_arg_conv);
41794         int64_t ret_ref = 0;
41795         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41796         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41797         return ret_ref;
41798 }
41799
41800 static inline uint64_t BlindedForward_clone_ptr(LDKBlindedForward *NONNULL_PTR arg) {
41801         LDKBlindedForward ret_var = BlindedForward_clone(arg);
41802         int64_t ret_ref = 0;
41803         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41804         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41805         return ret_ref;
41806 }
41807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedForward_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41808         LDKBlindedForward arg_conv;
41809         arg_conv.inner = untag_ptr(arg);
41810         arg_conv.is_owned = ptr_is_owned(arg);
41811         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41812         arg_conv.is_owned = false;
41813         int64_t ret_conv = BlindedForward_clone_ptr(&arg_conv);
41814         return ret_conv;
41815 }
41816
41817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedForward_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41818         LDKBlindedForward orig_conv;
41819         orig_conv.inner = untag_ptr(orig);
41820         orig_conv.is_owned = ptr_is_owned(orig);
41821         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41822         orig_conv.is_owned = false;
41823         LDKBlindedForward ret_var = BlindedForward_clone(&orig_conv);
41824         int64_t ret_ref = 0;
41825         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41826         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41827         return ret_ref;
41828 }
41829
41830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedForward_1hash(JNIEnv *env, jclass clz, int64_t o) {
41831         LDKBlindedForward o_conv;
41832         o_conv.inner = untag_ptr(o);
41833         o_conv.is_owned = ptr_is_owned(o);
41834         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41835         o_conv.is_owned = false;
41836         int64_t ret_conv = BlindedForward_hash(&o_conv);
41837         return ret_conv;
41838 }
41839
41840 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedForward_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41841         LDKBlindedForward a_conv;
41842         a_conv.inner = untag_ptr(a);
41843         a_conv.is_owned = ptr_is_owned(a);
41844         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41845         a_conv.is_owned = false;
41846         LDKBlindedForward b_conv;
41847         b_conv.inner = untag_ptr(b);
41848         b_conv.is_owned = ptr_is_owned(b);
41849         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41850         b_conv.is_owned = false;
41851         jboolean ret_conv = BlindedForward_eq(&a_conv, &b_conv);
41852         return ret_conv;
41853 }
41854
41855 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41856         LDKPendingHTLCInfo this_obj_conv;
41857         this_obj_conv.inner = untag_ptr(this_obj);
41858         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41860         PendingHTLCInfo_free(this_obj_conv);
41861 }
41862
41863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1get_1routing(JNIEnv *env, jclass clz, int64_t this_ptr) {
41864         LDKPendingHTLCInfo this_ptr_conv;
41865         this_ptr_conv.inner = untag_ptr(this_ptr);
41866         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41868         this_ptr_conv.is_owned = false;
41869         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
41870         *ret_copy = PendingHTLCInfo_get_routing(&this_ptr_conv);
41871         int64_t ret_ref = tag_ptr(ret_copy, true);
41872         return ret_ref;
41873 }
41874
41875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1set_1routing(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41876         LDKPendingHTLCInfo this_ptr_conv;
41877         this_ptr_conv.inner = untag_ptr(this_ptr);
41878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41880         this_ptr_conv.is_owned = false;
41881         void* val_ptr = untag_ptr(val);
41882         CHECK_ACCESS(val_ptr);
41883         LDKPendingHTLCRouting val_conv = *(LDKPendingHTLCRouting*)(val_ptr);
41884         val_conv = PendingHTLCRouting_clone((LDKPendingHTLCRouting*)untag_ptr(val));
41885         PendingHTLCInfo_set_routing(&this_ptr_conv, val_conv);
41886 }
41887
41888 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1get_1incoming_1shared_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
41889         LDKPendingHTLCInfo this_ptr_conv;
41890         this_ptr_conv.inner = untag_ptr(this_ptr);
41891         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41893         this_ptr_conv.is_owned = false;
41894         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
41895         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *PendingHTLCInfo_get_incoming_shared_secret(&this_ptr_conv));
41896         return ret_arr;
41897 }
41898
41899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1set_1incoming_1shared_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41900         LDKPendingHTLCInfo this_ptr_conv;
41901         this_ptr_conv.inner = untag_ptr(this_ptr);
41902         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41904         this_ptr_conv.is_owned = false;
41905         LDKThirtyTwoBytes val_ref;
41906         CHECK((*env)->GetArrayLength(env, val) == 32);
41907         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
41908         PendingHTLCInfo_set_incoming_shared_secret(&this_ptr_conv, val_ref);
41909 }
41910
41911 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
41912         LDKPendingHTLCInfo this_ptr_conv;
41913         this_ptr_conv.inner = untag_ptr(this_ptr);
41914         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41916         this_ptr_conv.is_owned = false;
41917         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
41918         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *PendingHTLCInfo_get_payment_hash(&this_ptr_conv));
41919         return ret_arr;
41920 }
41921
41922 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41923         LDKPendingHTLCInfo this_ptr_conv;
41924         this_ptr_conv.inner = untag_ptr(this_ptr);
41925         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41927         this_ptr_conv.is_owned = false;
41928         LDKThirtyTwoBytes val_ref;
41929         CHECK((*env)->GetArrayLength(env, val) == 32);
41930         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
41931         PendingHTLCInfo_set_payment_hash(&this_ptr_conv, val_ref);
41932 }
41933
41934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1get_1incoming_1amt_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
41935         LDKPendingHTLCInfo this_ptr_conv;
41936         this_ptr_conv.inner = untag_ptr(this_ptr);
41937         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41939         this_ptr_conv.is_owned = false;
41940         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
41941         *ret_copy = PendingHTLCInfo_get_incoming_amt_msat(&this_ptr_conv);
41942         int64_t ret_ref = tag_ptr(ret_copy, true);
41943         return ret_ref;
41944 }
41945
41946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1set_1incoming_1amt_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41947         LDKPendingHTLCInfo this_ptr_conv;
41948         this_ptr_conv.inner = untag_ptr(this_ptr);
41949         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41951         this_ptr_conv.is_owned = false;
41952         void* val_ptr = untag_ptr(val);
41953         CHECK_ACCESS(val_ptr);
41954         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
41955         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
41956         PendingHTLCInfo_set_incoming_amt_msat(&this_ptr_conv, val_conv);
41957 }
41958
41959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1get_1outgoing_1amt_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
41960         LDKPendingHTLCInfo this_ptr_conv;
41961         this_ptr_conv.inner = untag_ptr(this_ptr);
41962         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41964         this_ptr_conv.is_owned = false;
41965         int64_t ret_conv = PendingHTLCInfo_get_outgoing_amt_msat(&this_ptr_conv);
41966         return ret_conv;
41967 }
41968
41969 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1set_1outgoing_1amt_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41970         LDKPendingHTLCInfo this_ptr_conv;
41971         this_ptr_conv.inner = untag_ptr(this_ptr);
41972         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41974         this_ptr_conv.is_owned = false;
41975         PendingHTLCInfo_set_outgoing_amt_msat(&this_ptr_conv, val);
41976 }
41977
41978 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1get_1outgoing_1cltv_1value(JNIEnv *env, jclass clz, int64_t this_ptr) {
41979         LDKPendingHTLCInfo this_ptr_conv;
41980         this_ptr_conv.inner = untag_ptr(this_ptr);
41981         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41983         this_ptr_conv.is_owned = false;
41984         int32_t ret_conv = PendingHTLCInfo_get_outgoing_cltv_value(&this_ptr_conv);
41985         return ret_conv;
41986 }
41987
41988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1set_1outgoing_1cltv_1value(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
41989         LDKPendingHTLCInfo this_ptr_conv;
41990         this_ptr_conv.inner = untag_ptr(this_ptr);
41991         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41993         this_ptr_conv.is_owned = false;
41994         PendingHTLCInfo_set_outgoing_cltv_value(&this_ptr_conv, val);
41995 }
41996
41997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1get_1skimmed_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
41998         LDKPendingHTLCInfo this_ptr_conv;
41999         this_ptr_conv.inner = untag_ptr(this_ptr);
42000         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42002         this_ptr_conv.is_owned = false;
42003         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
42004         *ret_copy = PendingHTLCInfo_get_skimmed_fee_msat(&this_ptr_conv);
42005         int64_t ret_ref = tag_ptr(ret_copy, true);
42006         return ret_ref;
42007 }
42008
42009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1set_1skimmed_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42010         LDKPendingHTLCInfo this_ptr_conv;
42011         this_ptr_conv.inner = untag_ptr(this_ptr);
42012         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42014         this_ptr_conv.is_owned = false;
42015         void* val_ptr = untag_ptr(val);
42016         CHECK_ACCESS(val_ptr);
42017         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
42018         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
42019         PendingHTLCInfo_set_skimmed_fee_msat(&this_ptr_conv, val_conv);
42020 }
42021
42022 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) {
42023         void* routing_arg_ptr = untag_ptr(routing_arg);
42024         CHECK_ACCESS(routing_arg_ptr);
42025         LDKPendingHTLCRouting routing_arg_conv = *(LDKPendingHTLCRouting*)(routing_arg_ptr);
42026         routing_arg_conv = PendingHTLCRouting_clone((LDKPendingHTLCRouting*)untag_ptr(routing_arg));
42027         LDKThirtyTwoBytes incoming_shared_secret_arg_ref;
42028         CHECK((*env)->GetArrayLength(env, incoming_shared_secret_arg) == 32);
42029         (*env)->GetByteArrayRegion(env, incoming_shared_secret_arg, 0, 32, incoming_shared_secret_arg_ref.data);
42030         LDKThirtyTwoBytes payment_hash_arg_ref;
42031         CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
42032         (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
42033         void* incoming_amt_msat_arg_ptr = untag_ptr(incoming_amt_msat_arg);
42034         CHECK_ACCESS(incoming_amt_msat_arg_ptr);
42035         LDKCOption_u64Z incoming_amt_msat_arg_conv = *(LDKCOption_u64Z*)(incoming_amt_msat_arg_ptr);
42036         incoming_amt_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(incoming_amt_msat_arg));
42037         void* skimmed_fee_msat_arg_ptr = untag_ptr(skimmed_fee_msat_arg);
42038         CHECK_ACCESS(skimmed_fee_msat_arg_ptr);
42039         LDKCOption_u64Z skimmed_fee_msat_arg_conv = *(LDKCOption_u64Z*)(skimmed_fee_msat_arg_ptr);
42040         skimmed_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(skimmed_fee_msat_arg));
42041         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);
42042         int64_t ret_ref = 0;
42043         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42044         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42045         return ret_ref;
42046 }
42047
42048 static inline uint64_t PendingHTLCInfo_clone_ptr(LDKPendingHTLCInfo *NONNULL_PTR arg) {
42049         LDKPendingHTLCInfo ret_var = PendingHTLCInfo_clone(arg);
42050         int64_t ret_ref = 0;
42051         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42052         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42053         return ret_ref;
42054 }
42055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42056         LDKPendingHTLCInfo arg_conv;
42057         arg_conv.inner = untag_ptr(arg);
42058         arg_conv.is_owned = ptr_is_owned(arg);
42059         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42060         arg_conv.is_owned = false;
42061         int64_t ret_conv = PendingHTLCInfo_clone_ptr(&arg_conv);
42062         return ret_conv;
42063 }
42064
42065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42066         LDKPendingHTLCInfo orig_conv;
42067         orig_conv.inner = untag_ptr(orig);
42068         orig_conv.is_owned = ptr_is_owned(orig);
42069         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42070         orig_conv.is_owned = false;
42071         LDKPendingHTLCInfo ret_var = PendingHTLCInfo_clone(&orig_conv);
42072         int64_t ret_ref = 0;
42073         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42074         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42075         return ret_ref;
42076 }
42077
42078 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_BlindedFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42079         LDKBlindedFailure* orig_conv = (LDKBlindedFailure*)untag_ptr(orig);
42080         jclass ret_conv = LDKBlindedFailure_to_java(env, BlindedFailure_clone(orig_conv));
42081         return ret_conv;
42082 }
42083
42084 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_BlindedFailure_1from_1introduction_1node(JNIEnv *env, jclass clz) {
42085         jclass ret_conv = LDKBlindedFailure_to_java(env, BlindedFailure_from_introduction_node());
42086         return ret_conv;
42087 }
42088
42089 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_BlindedFailure_1from_1blinded_1node(JNIEnv *env, jclass clz) {
42090         jclass ret_conv = LDKBlindedFailure_to_java(env, BlindedFailure_from_blinded_node());
42091         return ret_conv;
42092 }
42093
42094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedFailure_1hash(JNIEnv *env, jclass clz, int64_t o) {
42095         LDKBlindedFailure* o_conv = (LDKBlindedFailure*)untag_ptr(o);
42096         int64_t ret_conv = BlindedFailure_hash(o_conv);
42097         return ret_conv;
42098 }
42099
42100 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42101         LDKBlindedFailure* a_conv = (LDKBlindedFailure*)untag_ptr(a);
42102         LDKBlindedFailure* b_conv = (LDKBlindedFailure*)untag_ptr(b);
42103         jboolean ret_conv = BlindedFailure_eq(a_conv, b_conv);
42104         return ret_conv;
42105 }
42106
42107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FailureCode_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         LDKFailureCode this_ptr_conv = *(LDKFailureCode*)(this_ptr_ptr);
42112         FREE(untag_ptr(this_ptr));
42113         FailureCode_free(this_ptr_conv);
42114 }
42115
42116 static inline uint64_t FailureCode_clone_ptr(LDKFailureCode *NONNULL_PTR arg) {
42117         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
42118         *ret_copy = FailureCode_clone(arg);
42119         int64_t ret_ref = tag_ptr(ret_copy, true);
42120         return ret_ref;
42121 }
42122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42123         LDKFailureCode* arg_conv = (LDKFailureCode*)untag_ptr(arg);
42124         int64_t ret_conv = FailureCode_clone_ptr(arg_conv);
42125         return ret_conv;
42126 }
42127
42128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42129         LDKFailureCode* orig_conv = (LDKFailureCode*)untag_ptr(orig);
42130         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
42131         *ret_copy = FailureCode_clone(orig_conv);
42132         int64_t ret_ref = tag_ptr(ret_copy, true);
42133         return ret_ref;
42134 }
42135
42136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1temporary_1node_1failure(JNIEnv *env, jclass clz) {
42137         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
42138         *ret_copy = FailureCode_temporary_node_failure();
42139         int64_t ret_ref = tag_ptr(ret_copy, true);
42140         return ret_ref;
42141 }
42142
42143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1required_1node_1feature_1missing(JNIEnv *env, jclass clz) {
42144         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
42145         *ret_copy = FailureCode_required_node_feature_missing();
42146         int64_t ret_ref = tag_ptr(ret_copy, true);
42147         return ret_ref;
42148 }
42149
42150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1incorrect_1or_1unknown_1payment_1details(JNIEnv *env, jclass clz) {
42151         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
42152         *ret_copy = FailureCode_incorrect_or_unknown_payment_details();
42153         int64_t ret_ref = tag_ptr(ret_copy, true);
42154         return ret_ref;
42155 }
42156
42157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1invalid_1onion_1payload(JNIEnv *env, jclass clz, int64_t a) {
42158         void* a_ptr = untag_ptr(a);
42159         CHECK_ACCESS(a_ptr);
42160         LDKCOption_C2Tuple_u64u16ZZ a_conv = *(LDKCOption_C2Tuple_u64u16ZZ*)(a_ptr);
42161         a_conv = COption_C2Tuple_u64u16ZZ_clone((LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(a));
42162         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
42163         *ret_copy = FailureCode_invalid_onion_payload(a_conv);
42164         int64_t ret_ref = tag_ptr(ret_copy, true);
42165         return ret_ref;
42166 }
42167
42168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42169         LDKChannelManager this_obj_conv;
42170         this_obj_conv.inner = untag_ptr(this_obj);
42171         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42173         ChannelManager_free(this_obj_conv);
42174 }
42175
42176 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42177         LDKChainParameters this_obj_conv;
42178         this_obj_conv.inner = untag_ptr(this_obj);
42179         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42181         ChainParameters_free(this_obj_conv);
42182 }
42183
42184 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1network(JNIEnv *env, jclass clz, int64_t this_ptr) {
42185         LDKChainParameters this_ptr_conv;
42186         this_ptr_conv.inner = untag_ptr(this_ptr);
42187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42189         this_ptr_conv.is_owned = false;
42190         jclass ret_conv = LDKNetwork_to_java(env, ChainParameters_get_network(&this_ptr_conv));
42191         return ret_conv;
42192 }
42193
42194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1network(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
42195         LDKChainParameters this_ptr_conv;
42196         this_ptr_conv.inner = untag_ptr(this_ptr);
42197         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42199         this_ptr_conv.is_owned = false;
42200         LDKNetwork val_conv = LDKNetwork_from_java(env, val);
42201         ChainParameters_set_network(&this_ptr_conv, val_conv);
42202 }
42203
42204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr) {
42205         LDKChainParameters this_ptr_conv;
42206         this_ptr_conv.inner = untag_ptr(this_ptr);
42207         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42209         this_ptr_conv.is_owned = false;
42210         LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
42211         int64_t ret_ref = 0;
42212         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42213         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42214         return ret_ref;
42215 }
42216
42217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42218         LDKChainParameters this_ptr_conv;
42219         this_ptr_conv.inner = untag_ptr(this_ptr);
42220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42222         this_ptr_conv.is_owned = false;
42223         LDKBestBlock val_conv;
42224         val_conv.inner = untag_ptr(val);
42225         val_conv.is_owned = ptr_is_owned(val);
42226         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42227         val_conv = BestBlock_clone(&val_conv);
42228         ChainParameters_set_best_block(&this_ptr_conv, val_conv);
42229 }
42230
42231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1new(JNIEnv *env, jclass clz, jclass network_arg, int64_t best_block_arg) {
42232         LDKNetwork network_arg_conv = LDKNetwork_from_java(env, network_arg);
42233         LDKBestBlock best_block_arg_conv;
42234         best_block_arg_conv.inner = untag_ptr(best_block_arg);
42235         best_block_arg_conv.is_owned = ptr_is_owned(best_block_arg);
42236         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
42237         best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
42238         LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
42239         int64_t ret_ref = 0;
42240         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42241         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42242         return ret_ref;
42243 }
42244
42245 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
42246         LDKChainParameters ret_var = ChainParameters_clone(arg);
42247         int64_t ret_ref = 0;
42248         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42249         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42250         return ret_ref;
42251 }
42252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42253         LDKChainParameters arg_conv;
42254         arg_conv.inner = untag_ptr(arg);
42255         arg_conv.is_owned = ptr_is_owned(arg);
42256         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42257         arg_conv.is_owned = false;
42258         int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
42259         return ret_conv;
42260 }
42261
42262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42263         LDKChainParameters orig_conv;
42264         orig_conv.inner = untag_ptr(orig);
42265         orig_conv.is_owned = ptr_is_owned(orig);
42266         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42267         orig_conv.is_owned = false;
42268         LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
42269         int64_t ret_ref = 0;
42270         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42271         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42272         return ret_ref;
42273 }
42274
42275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42276         LDKCounterpartyForwardingInfo this_obj_conv;
42277         this_obj_conv.inner = untag_ptr(this_obj);
42278         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42280         CounterpartyForwardingInfo_free(this_obj_conv);
42281 }
42282
42283 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42284         LDKCounterpartyForwardingInfo this_ptr_conv;
42285         this_ptr_conv.inner = untag_ptr(this_ptr);
42286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42288         this_ptr_conv.is_owned = false;
42289         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
42290         return ret_conv;
42291 }
42292
42293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
42294         LDKCounterpartyForwardingInfo this_ptr_conv;
42295         this_ptr_conv.inner = untag_ptr(this_ptr);
42296         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42298         this_ptr_conv.is_owned = false;
42299         CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
42300 }
42301
42302 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
42303         LDKCounterpartyForwardingInfo this_ptr_conv;
42304         this_ptr_conv.inner = untag_ptr(this_ptr);
42305         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42307         this_ptr_conv.is_owned = false;
42308         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
42309         return ret_conv;
42310 }
42311
42312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
42313         LDKCounterpartyForwardingInfo this_ptr_conv;
42314         this_ptr_conv.inner = untag_ptr(this_ptr);
42315         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42317         this_ptr_conv.is_owned = false;
42318         CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
42319 }
42320
42321 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
42322         LDKCounterpartyForwardingInfo this_ptr_conv;
42323         this_ptr_conv.inner = untag_ptr(this_ptr);
42324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42326         this_ptr_conv.is_owned = false;
42327         int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
42328         return ret_conv;
42329 }
42330
42331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
42332         LDKCounterpartyForwardingInfo this_ptr_conv;
42333         this_ptr_conv.inner = untag_ptr(this_ptr);
42334         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42336         this_ptr_conv.is_owned = false;
42337         CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
42338 }
42339
42340 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) {
42341         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
42342         int64_t ret_ref = 0;
42343         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42344         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42345         return ret_ref;
42346 }
42347
42348 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
42349         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
42350         int64_t ret_ref = 0;
42351         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42352         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42353         return ret_ref;
42354 }
42355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42356         LDKCounterpartyForwardingInfo arg_conv;
42357         arg_conv.inner = untag_ptr(arg);
42358         arg_conv.is_owned = ptr_is_owned(arg);
42359         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42360         arg_conv.is_owned = false;
42361         int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
42362         return ret_conv;
42363 }
42364
42365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42366         LDKCounterpartyForwardingInfo orig_conv;
42367         orig_conv.inner = untag_ptr(orig);
42368         orig_conv.is_owned = ptr_is_owned(orig);
42369         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42370         orig_conv.is_owned = false;
42371         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
42372         int64_t ret_ref = 0;
42373         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42374         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42375         return ret_ref;
42376 }
42377
42378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42379         LDKChannelCounterparty this_obj_conv;
42380         this_obj_conv.inner = untag_ptr(this_obj);
42381         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42383         ChannelCounterparty_free(this_obj_conv);
42384 }
42385
42386 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42387         LDKChannelCounterparty this_ptr_conv;
42388         this_ptr_conv.inner = untag_ptr(this_ptr);
42389         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42391         this_ptr_conv.is_owned = false;
42392         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
42393         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form);
42394         return ret_arr;
42395 }
42396
42397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42398         LDKChannelCounterparty 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         LDKPublicKey val_ref;
42404         CHECK((*env)->GetArrayLength(env, val) == 33);
42405         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
42406         ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
42407 }
42408
42409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
42410         LDKChannelCounterparty 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         LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
42416         int64_t ret_ref = 0;
42417         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42418         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42419         return ret_ref;
42420 }
42421
42422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42423         LDKChannelCounterparty this_ptr_conv;
42424         this_ptr_conv.inner = untag_ptr(this_ptr);
42425         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42427         this_ptr_conv.is_owned = false;
42428         LDKInitFeatures val_conv;
42429         val_conv.inner = untag_ptr(val);
42430         val_conv.is_owned = ptr_is_owned(val);
42431         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42432         val_conv = InitFeatures_clone(&val_conv);
42433         ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
42434 }
42435
42436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
42437         LDKChannelCounterparty this_ptr_conv;
42438         this_ptr_conv.inner = untag_ptr(this_ptr);
42439         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42441         this_ptr_conv.is_owned = false;
42442         int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
42443         return ret_conv;
42444 }
42445
42446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42447         LDKChannelCounterparty this_ptr_conv;
42448         this_ptr_conv.inner = untag_ptr(this_ptr);
42449         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42451         this_ptr_conv.is_owned = false;
42452         ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
42453 }
42454
42455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
42456         LDKChannelCounterparty this_ptr_conv;
42457         this_ptr_conv.inner = untag_ptr(this_ptr);
42458         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42460         this_ptr_conv.is_owned = false;
42461         LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
42462         int64_t ret_ref = 0;
42463         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42464         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42465         return ret_ref;
42466 }
42467
42468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42469         LDKChannelCounterparty this_ptr_conv;
42470         this_ptr_conv.inner = untag_ptr(this_ptr);
42471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42473         this_ptr_conv.is_owned = false;
42474         LDKCounterpartyForwardingInfo val_conv;
42475         val_conv.inner = untag_ptr(val);
42476         val_conv.is_owned = ptr_is_owned(val);
42477         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42478         val_conv = CounterpartyForwardingInfo_clone(&val_conv);
42479         ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
42480 }
42481
42482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1outbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42483         LDKChannelCounterparty this_ptr_conv;
42484         this_ptr_conv.inner = untag_ptr(this_ptr);
42485         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42487         this_ptr_conv.is_owned = false;
42488         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
42489         *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
42490         int64_t ret_ref = tag_ptr(ret_copy, true);
42491         return ret_ref;
42492 }
42493
42494 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) {
42495         LDKChannelCounterparty this_ptr_conv;
42496         this_ptr_conv.inner = untag_ptr(this_ptr);
42497         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42499         this_ptr_conv.is_owned = false;
42500         void* val_ptr = untag_ptr(val);
42501         CHECK_ACCESS(val_ptr);
42502         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
42503         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
42504         ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
42505 }
42506
42507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1outbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42508         LDKChannelCounterparty this_ptr_conv;
42509         this_ptr_conv.inner = untag_ptr(this_ptr);
42510         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42512         this_ptr_conv.is_owned = false;
42513         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
42514         *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
42515         int64_t ret_ref = tag_ptr(ret_copy, true);
42516         return ret_ref;
42517 }
42518
42519 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) {
42520         LDKChannelCounterparty this_ptr_conv;
42521         this_ptr_conv.inner = untag_ptr(this_ptr);
42522         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42524         this_ptr_conv.is_owned = false;
42525         void* val_ptr = untag_ptr(val);
42526         CHECK_ACCESS(val_ptr);
42527         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
42528         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
42529         ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
42530 }
42531
42532 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) {
42533         LDKPublicKey node_id_arg_ref;
42534         CHECK((*env)->GetArrayLength(env, node_id_arg) == 33);
42535         (*env)->GetByteArrayRegion(env, node_id_arg, 0, 33, node_id_arg_ref.compressed_form);
42536         LDKInitFeatures features_arg_conv;
42537         features_arg_conv.inner = untag_ptr(features_arg);
42538         features_arg_conv.is_owned = ptr_is_owned(features_arg);
42539         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
42540         features_arg_conv = InitFeatures_clone(&features_arg_conv);
42541         LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
42542         forwarding_info_arg_conv.inner = untag_ptr(forwarding_info_arg);
42543         forwarding_info_arg_conv.is_owned = ptr_is_owned(forwarding_info_arg);
42544         CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
42545         forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
42546         void* outbound_htlc_minimum_msat_arg_ptr = untag_ptr(outbound_htlc_minimum_msat_arg);
42547         CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
42548         LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
42549         outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_minimum_msat_arg));
42550         void* outbound_htlc_maximum_msat_arg_ptr = untag_ptr(outbound_htlc_maximum_msat_arg);
42551         CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
42552         LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
42553         outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_maximum_msat_arg));
42554         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);
42555         int64_t ret_ref = 0;
42556         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42557         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42558         return ret_ref;
42559 }
42560
42561 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
42562         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
42563         int64_t ret_ref = 0;
42564         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42565         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42566         return ret_ref;
42567 }
42568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42569         LDKChannelCounterparty arg_conv;
42570         arg_conv.inner = untag_ptr(arg);
42571         arg_conv.is_owned = ptr_is_owned(arg);
42572         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42573         arg_conv.is_owned = false;
42574         int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
42575         return ret_conv;
42576 }
42577
42578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42579         LDKChannelCounterparty orig_conv;
42580         orig_conv.inner = untag_ptr(orig);
42581         orig_conv.is_owned = ptr_is_owned(orig);
42582         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42583         orig_conv.is_owned = false;
42584         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
42585         int64_t ret_ref = 0;
42586         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42587         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42588         return ret_ref;
42589 }
42590
42591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42592         LDKChannelDetails this_obj_conv;
42593         this_obj_conv.inner = untag_ptr(this_obj);
42594         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42596         ChannelDetails_free(this_obj_conv);
42597 }
42598
42599 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42600         LDKChannelDetails this_ptr_conv;
42601         this_ptr_conv.inner = untag_ptr(this_ptr);
42602         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42604         this_ptr_conv.is_owned = false;
42605         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
42606         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
42607         return ret_arr;
42608 }
42609
42610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42611         LDKChannelDetails this_ptr_conv;
42612         this_ptr_conv.inner = untag_ptr(this_ptr);
42613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42615         this_ptr_conv.is_owned = false;
42616         LDKThirtyTwoBytes val_ref;
42617         CHECK((*env)->GetArrayLength(env, val) == 32);
42618         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
42619         ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
42620 }
42621
42622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr) {
42623         LDKChannelDetails 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         LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
42629         int64_t ret_ref = 0;
42630         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42631         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42632         return ret_ref;
42633 }
42634
42635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42636         LDKChannelDetails this_ptr_conv;
42637         this_ptr_conv.inner = untag_ptr(this_ptr);
42638         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42640         this_ptr_conv.is_owned = false;
42641         LDKChannelCounterparty val_conv;
42642         val_conv.inner = untag_ptr(val);
42643         val_conv.is_owned = ptr_is_owned(val);
42644         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42645         val_conv = ChannelCounterparty_clone(&val_conv);
42646         ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
42647 }
42648
42649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr) {
42650         LDKChannelDetails this_ptr_conv;
42651         this_ptr_conv.inner = untag_ptr(this_ptr);
42652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42654         this_ptr_conv.is_owned = false;
42655         LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
42656         int64_t ret_ref = 0;
42657         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42658         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42659         return ret_ref;
42660 }
42661
42662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42663         LDKChannelDetails this_ptr_conv;
42664         this_ptr_conv.inner = untag_ptr(this_ptr);
42665         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42667         this_ptr_conv.is_owned = false;
42668         LDKOutPoint val_conv;
42669         val_conv.inner = untag_ptr(val);
42670         val_conv.is_owned = ptr_is_owned(val);
42671         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42672         val_conv = OutPoint_clone(&val_conv);
42673         ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
42674 }
42675
42676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
42677         LDKChannelDetails this_ptr_conv;
42678         this_ptr_conv.inner = untag_ptr(this_ptr);
42679         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42681         this_ptr_conv.is_owned = false;
42682         LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
42683         int64_t ret_ref = 0;
42684         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42685         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42686         return ret_ref;
42687 }
42688
42689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42690         LDKChannelDetails 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         LDKChannelTypeFeatures val_conv;
42696         val_conv.inner = untag_ptr(val);
42697         val_conv.is_owned = ptr_is_owned(val);
42698         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42699         val_conv = ChannelTypeFeatures_clone(&val_conv);
42700         ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
42701 }
42702
42703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42704         LDKChannelDetails this_ptr_conv;
42705         this_ptr_conv.inner = untag_ptr(this_ptr);
42706         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42708         this_ptr_conv.is_owned = false;
42709         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
42710         *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
42711         int64_t ret_ref = tag_ptr(ret_copy, true);
42712         return ret_ref;
42713 }
42714
42715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42716         LDKChannelDetails this_ptr_conv;
42717         this_ptr_conv.inner = untag_ptr(this_ptr);
42718         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42720         this_ptr_conv.is_owned = false;
42721         void* val_ptr = untag_ptr(val);
42722         CHECK_ACCESS(val_ptr);
42723         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
42724         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
42725         ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
42726 }
42727
42728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
42729         LDKChannelDetails this_ptr_conv;
42730         this_ptr_conv.inner = untag_ptr(this_ptr);
42731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42733         this_ptr_conv.is_owned = false;
42734         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
42735         *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
42736         int64_t ret_ref = tag_ptr(ret_copy, true);
42737         return ret_ref;
42738 }
42739
42740 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42741         LDKChannelDetails this_ptr_conv;
42742         this_ptr_conv.inner = untag_ptr(this_ptr);
42743         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42745         this_ptr_conv.is_owned = false;
42746         void* val_ptr = untag_ptr(val);
42747         CHECK_ACCESS(val_ptr);
42748         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
42749         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
42750         ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
42751 }
42752
42753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
42754         LDKChannelDetails this_ptr_conv;
42755         this_ptr_conv.inner = untag_ptr(this_ptr);
42756         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42758         this_ptr_conv.is_owned = false;
42759         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
42760         *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
42761         int64_t ret_ref = tag_ptr(ret_copy, true);
42762         return ret_ref;
42763 }
42764
42765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42766         LDKChannelDetails this_ptr_conv;
42767         this_ptr_conv.inner = untag_ptr(this_ptr);
42768         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42770         this_ptr_conv.is_owned = false;
42771         void* val_ptr = untag_ptr(val);
42772         CHECK_ACCESS(val_ptr);
42773         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
42774         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
42775         ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
42776 }
42777
42778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
42779         LDKChannelDetails this_ptr_conv;
42780         this_ptr_conv.inner = untag_ptr(this_ptr);
42781         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42783         this_ptr_conv.is_owned = false;
42784         int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
42785         return ret_conv;
42786 }
42787
42788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42789         LDKChannelDetails this_ptr_conv;
42790         this_ptr_conv.inner = untag_ptr(this_ptr);
42791         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42793         this_ptr_conv.is_owned = false;
42794         ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
42795 }
42796
42797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
42798         LDKChannelDetails this_ptr_conv;
42799         this_ptr_conv.inner = untag_ptr(this_ptr);
42800         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42802         this_ptr_conv.is_owned = false;
42803         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
42804         *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
42805         int64_t ret_ref = tag_ptr(ret_copy, true);
42806         return ret_ref;
42807 }
42808
42809 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42810         LDKChannelDetails 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         void* val_ptr = untag_ptr(val);
42816         CHECK_ACCESS(val_ptr);
42817         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
42818         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
42819         ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
42820 }
42821
42822 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42823         LDKChannelDetails this_ptr_conv;
42824         this_ptr_conv.inner = untag_ptr(this_ptr);
42825         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42827         this_ptr_conv.is_owned = false;
42828         int8_tArray ret_arr = (*env)->NewByteArray(env, 16);
42829         (*env)->SetByteArrayRegion(env, ret_arr, 0, 16, ChannelDetails_get_user_channel_id(&this_ptr_conv).le_bytes);
42830         return ret_arr;
42831 }
42832
42833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42834         LDKChannelDetails this_ptr_conv;
42835         this_ptr_conv.inner = untag_ptr(this_ptr);
42836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42838         this_ptr_conv.is_owned = false;
42839         LDKU128 val_ref;
42840         CHECK((*env)->GetArrayLength(env, val) == 16);
42841         (*env)->GetByteArrayRegion(env, val, 0, 16, val_ref.le_bytes);
42842         ChannelDetails_set_user_channel_id(&this_ptr_conv, val_ref);
42843 }
42844
42845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
42846         LDKChannelDetails this_ptr_conv;
42847         this_ptr_conv.inner = untag_ptr(this_ptr);
42848         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42850         this_ptr_conv.is_owned = false;
42851         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
42852         *ret_copy = ChannelDetails_get_feerate_sat_per_1000_weight(&this_ptr_conv);
42853         int64_t ret_ref = tag_ptr(ret_copy, true);
42854         return ret_ref;
42855 }
42856
42857 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) {
42858         LDKChannelDetails 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         void* val_ptr = untag_ptr(val);
42864         CHECK_ACCESS(val_ptr);
42865         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
42866         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
42867         ChannelDetails_set_feerate_sat_per_1000_weight(&this_ptr_conv, val_conv);
42868 }
42869
42870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42871         LDKChannelDetails this_ptr_conv;
42872         this_ptr_conv.inner = untag_ptr(this_ptr);
42873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42875         this_ptr_conv.is_owned = false;
42876         int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
42877         return ret_conv;
42878 }
42879
42880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42881         LDKChannelDetails this_ptr_conv;
42882         this_ptr_conv.inner = untag_ptr(this_ptr);
42883         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42885         this_ptr_conv.is_owned = false;
42886         ChannelDetails_set_balance_msat(&this_ptr_conv, val);
42887 }
42888
42889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42890         LDKChannelDetails this_ptr_conv;
42891         this_ptr_conv.inner = untag_ptr(this_ptr);
42892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42894         this_ptr_conv.is_owned = false;
42895         int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
42896         return ret_conv;
42897 }
42898
42899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42900         LDKChannelDetails this_ptr_conv;
42901         this_ptr_conv.inner = untag_ptr(this_ptr);
42902         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42904         this_ptr_conv.is_owned = false;
42905         ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
42906 }
42907
42908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1next_1outbound_1htlc_1limit_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42909         LDKChannelDetails this_ptr_conv;
42910         this_ptr_conv.inner = untag_ptr(this_ptr);
42911         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42913         this_ptr_conv.is_owned = false;
42914         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
42915         return ret_conv;
42916 }
42917
42918 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) {
42919         LDKChannelDetails this_ptr_conv;
42920         this_ptr_conv.inner = untag_ptr(this_ptr);
42921         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42923         this_ptr_conv.is_owned = false;
42924         ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
42925 }
42926
42927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1next_1outbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42928         LDKChannelDetails this_ptr_conv;
42929         this_ptr_conv.inner = untag_ptr(this_ptr);
42930         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42932         this_ptr_conv.is_owned = false;
42933         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_minimum_msat(&this_ptr_conv);
42934         return ret_conv;
42935 }
42936
42937 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) {
42938         LDKChannelDetails this_ptr_conv;
42939         this_ptr_conv.inner = untag_ptr(this_ptr);
42940         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42942         this_ptr_conv.is_owned = false;
42943         ChannelDetails_set_next_outbound_htlc_minimum_msat(&this_ptr_conv, val);
42944 }
42945
42946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42947         LDKChannelDetails this_ptr_conv;
42948         this_ptr_conv.inner = untag_ptr(this_ptr);
42949         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42951         this_ptr_conv.is_owned = false;
42952         int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
42953         return ret_conv;
42954 }
42955
42956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42957         LDKChannelDetails this_ptr_conv;
42958         this_ptr_conv.inner = untag_ptr(this_ptr);
42959         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42961         this_ptr_conv.is_owned = false;
42962         ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
42963 }
42964
42965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr) {
42966         LDKChannelDetails this_ptr_conv;
42967         this_ptr_conv.inner = untag_ptr(this_ptr);
42968         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42970         this_ptr_conv.is_owned = false;
42971         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
42972         *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
42973         int64_t ret_ref = tag_ptr(ret_copy, true);
42974         return ret_ref;
42975 }
42976
42977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42978         LDKChannelDetails this_ptr_conv;
42979         this_ptr_conv.inner = untag_ptr(this_ptr);
42980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42982         this_ptr_conv.is_owned = false;
42983         void* val_ptr = untag_ptr(val);
42984         CHECK_ACCESS(val_ptr);
42985         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
42986         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
42987         ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
42988 }
42989
42990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations(JNIEnv *env, jclass clz, int64_t this_ptr) {
42991         LDKChannelDetails this_ptr_conv;
42992         this_ptr_conv.inner = untag_ptr(this_ptr);
42993         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42995         this_ptr_conv.is_owned = false;
42996         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
42997         *ret_copy = ChannelDetails_get_confirmations(&this_ptr_conv);
42998         int64_t ret_ref = tag_ptr(ret_copy, true);
42999         return ret_ref;
43000 }
43001
43002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43003         LDKChannelDetails this_ptr_conv;
43004         this_ptr_conv.inner = untag_ptr(this_ptr);
43005         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43007         this_ptr_conv.is_owned = false;
43008         void* val_ptr = untag_ptr(val);
43009         CHECK_ACCESS(val_ptr);
43010         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
43011         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
43012         ChannelDetails_set_confirmations(&this_ptr_conv, val_conv);
43013 }
43014
43015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1force_1close_1spend_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
43016         LDKChannelDetails this_ptr_conv;
43017         this_ptr_conv.inner = untag_ptr(this_ptr);
43018         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43020         this_ptr_conv.is_owned = false;
43021         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
43022         *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
43023         int64_t ret_ref = tag_ptr(ret_copy, true);
43024         return ret_ref;
43025 }
43026
43027 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) {
43028         LDKChannelDetails this_ptr_conv;
43029         this_ptr_conv.inner = untag_ptr(this_ptr);
43030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43032         this_ptr_conv.is_owned = false;
43033         void* val_ptr = untag_ptr(val);
43034         CHECK_ACCESS(val_ptr);
43035         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
43036         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
43037         ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
43038 }
43039
43040 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr) {
43041         LDKChannelDetails this_ptr_conv;
43042         this_ptr_conv.inner = untag_ptr(this_ptr);
43043         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43045         this_ptr_conv.is_owned = false;
43046         jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
43047         return ret_conv;
43048 }
43049
43050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
43051         LDKChannelDetails this_ptr_conv;
43052         this_ptr_conv.inner = untag_ptr(this_ptr);
43053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43055         this_ptr_conv.is_owned = false;
43056         ChannelDetails_set_is_outbound(&this_ptr_conv, val);
43057 }
43058
43059 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1channel_1ready(JNIEnv *env, jclass clz, int64_t this_ptr) {
43060         LDKChannelDetails this_ptr_conv;
43061         this_ptr_conv.inner = untag_ptr(this_ptr);
43062         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43064         this_ptr_conv.is_owned = false;
43065         jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
43066         return ret_conv;
43067 }
43068
43069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1channel_1ready(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
43070         LDKChannelDetails this_ptr_conv;
43071         this_ptr_conv.inner = untag_ptr(this_ptr);
43072         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43074         this_ptr_conv.is_owned = false;
43075         ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
43076 }
43077
43078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1shutdown_1state(JNIEnv *env, jclass clz, int64_t this_ptr) {
43079         LDKChannelDetails this_ptr_conv;
43080         this_ptr_conv.inner = untag_ptr(this_ptr);
43081         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43083         this_ptr_conv.is_owned = false;
43084         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
43085         *ret_copy = ChannelDetails_get_channel_shutdown_state(&this_ptr_conv);
43086         int64_t ret_ref = tag_ptr(ret_copy, true);
43087         return ret_ref;
43088 }
43089
43090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1shutdown_1state(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43091         LDKChannelDetails this_ptr_conv;
43092         this_ptr_conv.inner = untag_ptr(this_ptr);
43093         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43095         this_ptr_conv.is_owned = false;
43096         void* val_ptr = untag_ptr(val);
43097         CHECK_ACCESS(val_ptr);
43098         LDKCOption_ChannelShutdownStateZ val_conv = *(LDKCOption_ChannelShutdownStateZ*)(val_ptr);
43099         val_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(val));
43100         ChannelDetails_set_channel_shutdown_state(&this_ptr_conv, val_conv);
43101 }
43102
43103 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr) {
43104         LDKChannelDetails 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         jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
43110         return ret_conv;
43111 }
43112
43113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
43114         LDKChannelDetails 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         ChannelDetails_set_is_usable(&this_ptr_conv, val);
43120 }
43121
43122 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr) {
43123         LDKChannelDetails 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         jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
43129         return ret_conv;
43130 }
43131
43132 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
43133         LDKChannelDetails 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         ChannelDetails_set_is_public(&this_ptr_conv, val);
43139 }
43140
43141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43142         LDKChannelDetails 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         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
43148         *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&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_ChannelDetails_1set_1inbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43154         LDKChannelDetails 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         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
43162         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
43163         ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
43164 }
43165
43166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43167         LDKChannelDetails 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         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
43173         *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
43174         int64_t ret_ref = tag_ptr(ret_copy, true);
43175         return ret_ref;
43176 }
43177
43178 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) {
43179         LDKChannelDetails this_ptr_conv;
43180         this_ptr_conv.inner = untag_ptr(this_ptr);
43181         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43183         this_ptr_conv.is_owned = false;
43184         void* val_ptr = untag_ptr(val);
43185         CHECK_ACCESS(val_ptr);
43186         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
43187         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
43188         ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
43189 }
43190
43191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
43192         LDKChannelDetails this_ptr_conv;
43193         this_ptr_conv.inner = untag_ptr(this_ptr);
43194         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43196         this_ptr_conv.is_owned = false;
43197         LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
43198         int64_t ret_ref = 0;
43199         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43200         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43201         return ret_ref;
43202 }
43203
43204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43205         LDKChannelDetails this_ptr_conv;
43206         this_ptr_conv.inner = untag_ptr(this_ptr);
43207         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43209         this_ptr_conv.is_owned = false;
43210         LDKChannelConfig val_conv;
43211         val_conv.inner = untag_ptr(val);
43212         val_conv.is_owned = ptr_is_owned(val);
43213         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43214         val_conv = ChannelConfig_clone(&val_conv);
43215         ChannelDetails_set_config(&this_ptr_conv, val_conv);
43216 }
43217
43218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t counterparty_arg, int64_t funding_txo_arg, int64_t channel_type_arg, int64_t short_channel_id_arg, int64_t outbound_scid_alias_arg, int64_t inbound_scid_alias_arg, int64_t channel_value_satoshis_arg, int64_t unspendable_punishment_reserve_arg, int8_tArray user_channel_id_arg, int64_t feerate_sat_per_1000_weight_arg, int64_t balance_msat_arg, int64_t outbound_capacity_msat_arg, int64_t next_outbound_htlc_limit_msat_arg, int64_t next_outbound_htlc_minimum_msat_arg, int64_t inbound_capacity_msat_arg, int64_t confirmations_required_arg, int64_t confirmations_arg, int64_t force_close_spend_delay_arg, jboolean is_outbound_arg, jboolean is_channel_ready_arg, int64_t channel_shutdown_state_arg, jboolean is_usable_arg, jboolean is_public_arg, int64_t inbound_htlc_minimum_msat_arg, int64_t inbound_htlc_maximum_msat_arg, int64_t config_arg) {
43219         LDKThirtyTwoBytes channel_id_arg_ref;
43220         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
43221         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
43222         LDKChannelCounterparty counterparty_arg_conv;
43223         counterparty_arg_conv.inner = untag_ptr(counterparty_arg);
43224         counterparty_arg_conv.is_owned = ptr_is_owned(counterparty_arg);
43225         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
43226         counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
43227         LDKOutPoint funding_txo_arg_conv;
43228         funding_txo_arg_conv.inner = untag_ptr(funding_txo_arg);
43229         funding_txo_arg_conv.is_owned = ptr_is_owned(funding_txo_arg);
43230         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
43231         funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
43232         LDKChannelTypeFeatures channel_type_arg_conv;
43233         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
43234         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
43235         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
43236         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
43237         void* short_channel_id_arg_ptr = untag_ptr(short_channel_id_arg);
43238         CHECK_ACCESS(short_channel_id_arg_ptr);
43239         LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
43240         short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_arg));
43241         void* outbound_scid_alias_arg_ptr = untag_ptr(outbound_scid_alias_arg);
43242         CHECK_ACCESS(outbound_scid_alias_arg_ptr);
43243         LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
43244         outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_scid_alias_arg));
43245         void* inbound_scid_alias_arg_ptr = untag_ptr(inbound_scid_alias_arg);
43246         CHECK_ACCESS(inbound_scid_alias_arg_ptr);
43247         LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
43248         inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_scid_alias_arg));
43249         void* unspendable_punishment_reserve_arg_ptr = untag_ptr(unspendable_punishment_reserve_arg);
43250         CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
43251         LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
43252         LDKU128 user_channel_id_arg_ref;
43253         CHECK((*env)->GetArrayLength(env, user_channel_id_arg) == 16);
43254         (*env)->GetByteArrayRegion(env, user_channel_id_arg, 0, 16, user_channel_id_arg_ref.le_bytes);
43255         void* feerate_sat_per_1000_weight_arg_ptr = untag_ptr(feerate_sat_per_1000_weight_arg);
43256         CHECK_ACCESS(feerate_sat_per_1000_weight_arg_ptr);
43257         LDKCOption_u32Z feerate_sat_per_1000_weight_arg_conv = *(LDKCOption_u32Z*)(feerate_sat_per_1000_weight_arg_ptr);
43258         feerate_sat_per_1000_weight_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(feerate_sat_per_1000_weight_arg));
43259         void* confirmations_required_arg_ptr = untag_ptr(confirmations_required_arg);
43260         CHECK_ACCESS(confirmations_required_arg_ptr);
43261         LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
43262         confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_required_arg));
43263         void* confirmations_arg_ptr = untag_ptr(confirmations_arg);
43264         CHECK_ACCESS(confirmations_arg_ptr);
43265         LDKCOption_u32Z confirmations_arg_conv = *(LDKCOption_u32Z*)(confirmations_arg_ptr);
43266         confirmations_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_arg));
43267         void* force_close_spend_delay_arg_ptr = untag_ptr(force_close_spend_delay_arg);
43268         CHECK_ACCESS(force_close_spend_delay_arg_ptr);
43269         LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
43270         force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(force_close_spend_delay_arg));
43271         void* channel_shutdown_state_arg_ptr = untag_ptr(channel_shutdown_state_arg);
43272         CHECK_ACCESS(channel_shutdown_state_arg_ptr);
43273         LDKCOption_ChannelShutdownStateZ channel_shutdown_state_arg_conv = *(LDKCOption_ChannelShutdownStateZ*)(channel_shutdown_state_arg_ptr);
43274         channel_shutdown_state_arg_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(channel_shutdown_state_arg));
43275         void* inbound_htlc_minimum_msat_arg_ptr = untag_ptr(inbound_htlc_minimum_msat_arg);
43276         CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
43277         LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
43278         inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_minimum_msat_arg));
43279         void* inbound_htlc_maximum_msat_arg_ptr = untag_ptr(inbound_htlc_maximum_msat_arg);
43280         CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
43281         LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
43282         inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_maximum_msat_arg));
43283         LDKChannelConfig config_arg_conv;
43284         config_arg_conv.inner = untag_ptr(config_arg);
43285         config_arg_conv.is_owned = ptr_is_owned(config_arg);
43286         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_arg_conv);
43287         config_arg_conv = ChannelConfig_clone(&config_arg_conv);
43288         LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, channel_type_arg_conv, short_channel_id_arg_conv, outbound_scid_alias_arg_conv, inbound_scid_alias_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_channel_id_arg_ref, feerate_sat_per_1000_weight_arg_conv, balance_msat_arg, outbound_capacity_msat_arg, next_outbound_htlc_limit_msat_arg, next_outbound_htlc_minimum_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, confirmations_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_channel_ready_arg, channel_shutdown_state_arg_conv, is_usable_arg, is_public_arg, inbound_htlc_minimum_msat_arg_conv, inbound_htlc_maximum_msat_arg_conv, config_arg_conv);
43289         int64_t ret_ref = 0;
43290         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43291         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43292         return ret_ref;
43293 }
43294
43295 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
43296         LDKChannelDetails ret_var = ChannelDetails_clone(arg);
43297         int64_t ret_ref = 0;
43298         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43299         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43300         return ret_ref;
43301 }
43302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43303         LDKChannelDetails arg_conv;
43304         arg_conv.inner = untag_ptr(arg);
43305         arg_conv.is_owned = ptr_is_owned(arg);
43306         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43307         arg_conv.is_owned = false;
43308         int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
43309         return ret_conv;
43310 }
43311
43312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43313         LDKChannelDetails orig_conv;
43314         orig_conv.inner = untag_ptr(orig);
43315         orig_conv.is_owned = ptr_is_owned(orig);
43316         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43317         orig_conv.is_owned = false;
43318         LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
43319         int64_t ret_ref = 0;
43320         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43321         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43322         return ret_ref;
43323 }
43324
43325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1payment_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
43326         LDKChannelDetails this_arg_conv;
43327         this_arg_conv.inner = untag_ptr(this_arg);
43328         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43330         this_arg_conv.is_owned = false;
43331         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
43332         *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
43333         int64_t ret_ref = tag_ptr(ret_copy, true);
43334         return ret_ref;
43335 }
43336
43337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1payment_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
43338         LDKChannelDetails this_arg_conv;
43339         this_arg_conv.inner = untag_ptr(this_arg);
43340         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43342         this_arg_conv.is_owned = false;
43343         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
43344         *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
43345         int64_t ret_ref = tag_ptr(ret_copy, true);
43346         return ret_ref;
43347 }
43348
43349 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43350         LDKChannelShutdownState* orig_conv = (LDKChannelShutdownState*)untag_ptr(orig);
43351         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_clone(orig_conv));
43352         return ret_conv;
43353 }
43354
43355 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1not_1shutting_1down(JNIEnv *env, jclass clz) {
43356         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_not_shutting_down());
43357         return ret_conv;
43358 }
43359
43360 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1shutdown_1initiated(JNIEnv *env, jclass clz) {
43361         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_shutdown_initiated());
43362         return ret_conv;
43363 }
43364
43365 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1resolving_1htlcs(JNIEnv *env, jclass clz) {
43366         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_resolving_htlcs());
43367         return ret_conv;
43368 }
43369
43370 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1negotiating_1closing_1fee(JNIEnv *env, jclass clz) {
43371         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_negotiating_closing_fee());
43372         return ret_conv;
43373 }
43374
43375 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1shutdown_1complete(JNIEnv *env, jclass clz) {
43376         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_shutdown_complete());
43377         return ret_conv;
43378 }
43379
43380 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43381         LDKChannelShutdownState* a_conv = (LDKChannelShutdownState*)untag_ptr(a);
43382         LDKChannelShutdownState* b_conv = (LDKChannelShutdownState*)untag_ptr(b);
43383         jboolean ret_conv = ChannelShutdownState_eq(a_conv, b_conv);
43384         return ret_conv;
43385 }
43386
43387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
43388         if (!ptr_is_owned(this_ptr)) return;
43389         void* this_ptr_ptr = untag_ptr(this_ptr);
43390         CHECK_ACCESS(this_ptr_ptr);
43391         LDKRecentPaymentDetails this_ptr_conv = *(LDKRecentPaymentDetails*)(this_ptr_ptr);
43392         FREE(untag_ptr(this_ptr));
43393         RecentPaymentDetails_free(this_ptr_conv);
43394 }
43395
43396 static inline uint64_t RecentPaymentDetails_clone_ptr(LDKRecentPaymentDetails *NONNULL_PTR arg) {
43397         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
43398         *ret_copy = RecentPaymentDetails_clone(arg);
43399         int64_t ret_ref = tag_ptr(ret_copy, true);
43400         return ret_ref;
43401 }
43402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43403         LDKRecentPaymentDetails* arg_conv = (LDKRecentPaymentDetails*)untag_ptr(arg);
43404         int64_t ret_conv = RecentPaymentDetails_clone_ptr(arg_conv);
43405         return ret_conv;
43406 }
43407
43408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43409         LDKRecentPaymentDetails* orig_conv = (LDKRecentPaymentDetails*)untag_ptr(orig);
43410         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
43411         *ret_copy = RecentPaymentDetails_clone(orig_conv);
43412         int64_t ret_ref = tag_ptr(ret_copy, true);
43413         return ret_ref;
43414 }
43415
43416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1awaiting_1invoice(JNIEnv *env, jclass clz, int8_tArray payment_id) {
43417         LDKThirtyTwoBytes payment_id_ref;
43418         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
43419         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
43420         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
43421         *ret_copy = RecentPaymentDetails_awaiting_invoice(payment_id_ref);
43422         int64_t ret_ref = tag_ptr(ret_copy, true);
43423         return ret_ref;
43424 }
43425
43426 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) {
43427         LDKThirtyTwoBytes payment_id_ref;
43428         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
43429         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
43430         LDKThirtyTwoBytes payment_hash_ref;
43431         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
43432         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
43433         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
43434         *ret_copy = RecentPaymentDetails_pending(payment_id_ref, payment_hash_ref, total_msat);
43435         int64_t ret_ref = tag_ptr(ret_copy, true);
43436         return ret_ref;
43437 }
43438
43439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1fulfilled(JNIEnv *env, jclass clz, int8_tArray payment_id, int64_t payment_hash) {
43440         LDKThirtyTwoBytes payment_id_ref;
43441         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
43442         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
43443         void* payment_hash_ptr = untag_ptr(payment_hash);
43444         CHECK_ACCESS(payment_hash_ptr);
43445         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
43446         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
43447         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
43448         *ret_copy = RecentPaymentDetails_fulfilled(payment_id_ref, payment_hash_conv);
43449         int64_t ret_ref = tag_ptr(ret_copy, true);
43450         return ret_ref;
43451 }
43452
43453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1abandoned(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash) {
43454         LDKThirtyTwoBytes payment_id_ref;
43455         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
43456         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
43457         LDKThirtyTwoBytes payment_hash_ref;
43458         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
43459         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
43460         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
43461         *ret_copy = RecentPaymentDetails_abandoned(payment_id_ref, payment_hash_ref);
43462         int64_t ret_ref = tag_ptr(ret_copy, true);
43463         return ret_ref;
43464 }
43465
43466 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43467         LDKPhantomRouteHints this_obj_conv;
43468         this_obj_conv.inner = untag_ptr(this_obj);
43469         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43471         PhantomRouteHints_free(this_obj_conv);
43472 }
43473
43474 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
43475         LDKPhantomRouteHints this_ptr_conv;
43476         this_ptr_conv.inner = untag_ptr(this_ptr);
43477         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43479         this_ptr_conv.is_owned = false;
43480         LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
43481         int64_tArray ret_arr = NULL;
43482         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
43483         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
43484         for (size_t q = 0; q < ret_var.datalen; q++) {
43485                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
43486                 int64_t ret_conv_16_ref = 0;
43487                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
43488                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
43489                 ret_arr_ptr[q] = ret_conv_16_ref;
43490         }
43491         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
43492         FREE(ret_var.data);
43493         return ret_arr;
43494 }
43495
43496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
43497         LDKPhantomRouteHints 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         LDKCVec_ChannelDetailsZ val_constr;
43503         val_constr.datalen = (*env)->GetArrayLength(env, val);
43504         if (val_constr.datalen > 0)
43505                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
43506         else
43507                 val_constr.data = NULL;
43508         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
43509         for (size_t q = 0; q < val_constr.datalen; q++) {
43510                 int64_t val_conv_16 = val_vals[q];
43511                 LDKChannelDetails val_conv_16_conv;
43512                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
43513                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
43514                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
43515                 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
43516                 val_constr.data[q] = val_conv_16_conv;
43517         }
43518         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
43519         PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
43520 }
43521
43522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr) {
43523         LDKPhantomRouteHints this_ptr_conv;
43524         this_ptr_conv.inner = untag_ptr(this_ptr);
43525         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43527         this_ptr_conv.is_owned = false;
43528         int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
43529         return ret_conv;
43530 }
43531
43532 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43533         LDKPhantomRouteHints this_ptr_conv;
43534         this_ptr_conv.inner = untag_ptr(this_ptr);
43535         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43537         this_ptr_conv.is_owned = false;
43538         PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
43539 }
43540
43541 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
43542         LDKPhantomRouteHints this_ptr_conv;
43543         this_ptr_conv.inner = untag_ptr(this_ptr);
43544         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43546         this_ptr_conv.is_owned = false;
43547         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43548         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form);
43549         return ret_arr;
43550 }
43551
43552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43553         LDKPhantomRouteHints this_ptr_conv;
43554         this_ptr_conv.inner = untag_ptr(this_ptr);
43555         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43557         this_ptr_conv.is_owned = false;
43558         LDKPublicKey val_ref;
43559         CHECK((*env)->GetArrayLength(env, val) == 33);
43560         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43561         PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
43562 }
43563
43564 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) {
43565         LDKCVec_ChannelDetailsZ channels_arg_constr;
43566         channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
43567         if (channels_arg_constr.datalen > 0)
43568                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
43569         else
43570                 channels_arg_constr.data = NULL;
43571         int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
43572         for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
43573                 int64_t channels_arg_conv_16 = channels_arg_vals[q];
43574                 LDKChannelDetails channels_arg_conv_16_conv;
43575                 channels_arg_conv_16_conv.inner = untag_ptr(channels_arg_conv_16);
43576                 channels_arg_conv_16_conv.is_owned = ptr_is_owned(channels_arg_conv_16);
43577                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
43578                 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
43579                 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
43580         }
43581         (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
43582         LDKPublicKey real_node_pubkey_arg_ref;
43583         CHECK((*env)->GetArrayLength(env, real_node_pubkey_arg) == 33);
43584         (*env)->GetByteArrayRegion(env, real_node_pubkey_arg, 0, 33, real_node_pubkey_arg_ref.compressed_form);
43585         LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
43586         int64_t ret_ref = 0;
43587         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43588         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43589         return ret_ref;
43590 }
43591
43592 static inline uint64_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
43593         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
43594         int64_t ret_ref = 0;
43595         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43596         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43597         return ret_ref;
43598 }
43599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43600         LDKPhantomRouteHints arg_conv;
43601         arg_conv.inner = untag_ptr(arg);
43602         arg_conv.is_owned = ptr_is_owned(arg);
43603         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43604         arg_conv.is_owned = false;
43605         int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
43606         return ret_conv;
43607 }
43608
43609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43610         LDKPhantomRouteHints orig_conv;
43611         orig_conv.inner = untag_ptr(orig);
43612         orig_conv.is_owned = ptr_is_owned(orig);
43613         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43614         orig_conv.is_owned = false;
43615         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
43616         int64_t ret_ref = 0;
43617         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43618         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43619         return ret_ref;
43620 }
43621
43622 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) {
43623         void* fee_est_ptr = untag_ptr(fee_est);
43624         CHECK_ACCESS(fee_est_ptr);
43625         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
43626         if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
43627                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43628                 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
43629         }
43630         void* chain_monitor_ptr = untag_ptr(chain_monitor);
43631         CHECK_ACCESS(chain_monitor_ptr);
43632         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
43633         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
43634                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43635                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
43636         }
43637         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
43638         CHECK_ACCESS(tx_broadcaster_ptr);
43639         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
43640         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
43641                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43642                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
43643         }
43644         void* router_ptr = untag_ptr(router);
43645         CHECK_ACCESS(router_ptr);
43646         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
43647         if (router_conv.free == LDKRouter_JCalls_free) {
43648                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43649                 LDKRouter_JCalls_cloned(&router_conv);
43650         }
43651         void* logger_ptr = untag_ptr(logger);
43652         CHECK_ACCESS(logger_ptr);
43653         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
43654         if (logger_conv.free == LDKLogger_JCalls_free) {
43655                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43656                 LDKLogger_JCalls_cloned(&logger_conv);
43657         }
43658         void* entropy_source_ptr = untag_ptr(entropy_source);
43659         CHECK_ACCESS(entropy_source_ptr);
43660         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
43661         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
43662                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43663                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
43664         }
43665         void* node_signer_ptr = untag_ptr(node_signer);
43666         CHECK_ACCESS(node_signer_ptr);
43667         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
43668         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
43669                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43670                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
43671         }
43672         void* signer_provider_ptr = untag_ptr(signer_provider);
43673         CHECK_ACCESS(signer_provider_ptr);
43674         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
43675         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
43676                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43677                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
43678         }
43679         LDKUserConfig config_conv;
43680         config_conv.inner = untag_ptr(config);
43681         config_conv.is_owned = ptr_is_owned(config);
43682         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
43683         config_conv = UserConfig_clone(&config_conv);
43684         LDKChainParameters params_conv;
43685         params_conv.inner = untag_ptr(params);
43686         params_conv.is_owned = ptr_is_owned(params);
43687         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
43688         params_conv = ChainParameters_clone(&params_conv);
43689         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);
43690         int64_t ret_ref = 0;
43691         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43692         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43693         return ret_ref;
43694 }
43695
43696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1current_1default_1configuration(JNIEnv *env, jclass clz, int64_t this_arg) {
43697         LDKChannelManager this_arg_conv;
43698         this_arg_conv.inner = untag_ptr(this_arg);
43699         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43701         this_arg_conv.is_owned = false;
43702         LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
43703         int64_t ret_ref = 0;
43704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43706         return ret_ref;
43707 }
43708
43709 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) {
43710         LDKChannelManager this_arg_conv;
43711         this_arg_conv.inner = untag_ptr(this_arg);
43712         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43714         this_arg_conv.is_owned = false;
43715         LDKPublicKey their_network_key_ref;
43716         CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
43717         (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
43718         LDKU128 user_channel_id_ref;
43719         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
43720         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
43721         void* temporary_channel_id_ptr = untag_ptr(temporary_channel_id);
43722         CHECK_ACCESS(temporary_channel_id_ptr);
43723         LDKCOption_ThirtyTwoBytesZ temporary_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(temporary_channel_id_ptr);
43724         temporary_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(temporary_channel_id));
43725         LDKUserConfig override_config_conv;
43726         override_config_conv.inner = untag_ptr(override_config);
43727         override_config_conv.is_owned = ptr_is_owned(override_config);
43728         CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
43729         override_config_conv = UserConfig_clone(&override_config_conv);
43730         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
43731         *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);
43732         return tag_ptr(ret_conv, true);
43733 }
43734
43735 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
43736         LDKChannelManager this_arg_conv;
43737         this_arg_conv.inner = untag_ptr(this_arg);
43738         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43740         this_arg_conv.is_owned = false;
43741         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
43742         int64_tArray ret_arr = NULL;
43743         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
43744         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
43745         for (size_t q = 0; q < ret_var.datalen; q++) {
43746                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
43747                 int64_t ret_conv_16_ref = 0;
43748                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
43749                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
43750                 ret_arr_ptr[q] = ret_conv_16_ref;
43751         }
43752         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
43753         FREE(ret_var.data);
43754         return ret_arr;
43755 }
43756
43757 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
43758         LDKChannelManager this_arg_conv;
43759         this_arg_conv.inner = untag_ptr(this_arg);
43760         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43762         this_arg_conv.is_owned = false;
43763         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
43764         int64_tArray ret_arr = NULL;
43765         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
43766         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
43767         for (size_t q = 0; q < ret_var.datalen; q++) {
43768                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
43769                 int64_t ret_conv_16_ref = 0;
43770                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
43771                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
43772                 ret_arr_ptr[q] = ret_conv_16_ref;
43773         }
43774         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
43775         FREE(ret_var.data);
43776         return ret_arr;
43777 }
43778
43779 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) {
43780         LDKChannelManager this_arg_conv;
43781         this_arg_conv.inner = untag_ptr(this_arg);
43782         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43784         this_arg_conv.is_owned = false;
43785         LDKPublicKey counterparty_node_id_ref;
43786         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
43787         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
43788         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels_with_counterparty(&this_arg_conv, counterparty_node_id_ref);
43789         int64_tArray ret_arr = NULL;
43790         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
43791         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
43792         for (size_t q = 0; q < ret_var.datalen; q++) {
43793                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
43794                 int64_t ret_conv_16_ref = 0;
43795                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
43796                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
43797                 ret_arr_ptr[q] = ret_conv_16_ref;
43798         }
43799         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
43800         FREE(ret_var.data);
43801         return ret_arr;
43802 }
43803
43804 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1recent_1payments(JNIEnv *env, jclass clz, int64_t this_arg) {
43805         LDKChannelManager this_arg_conv;
43806         this_arg_conv.inner = untag_ptr(this_arg);
43807         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43809         this_arg_conv.is_owned = false;
43810         LDKCVec_RecentPaymentDetailsZ ret_var = ChannelManager_list_recent_payments(&this_arg_conv);
43811         int64_tArray ret_arr = NULL;
43812         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
43813         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
43814         for (size_t w = 0; w < ret_var.datalen; w++) {
43815                 LDKRecentPaymentDetails *ret_conv_22_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
43816                 *ret_conv_22_copy = ret_var.data[w];
43817                 int64_t ret_conv_22_ref = tag_ptr(ret_conv_22_copy, true);
43818                 ret_arr_ptr[w] = ret_conv_22_ref;
43819         }
43820         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
43821         FREE(ret_var.data);
43822         return ret_arr;
43823 }
43824
43825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id) {
43826         LDKChannelManager this_arg_conv;
43827         this_arg_conv.inner = untag_ptr(this_arg);
43828         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43830         this_arg_conv.is_owned = false;
43831         uint8_t channel_id_arr[32];
43832         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
43833         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
43834         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
43835         LDKPublicKey counterparty_node_id_ref;
43836         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
43837         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
43838         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
43839         *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
43840         return tag_ptr(ret_conv, true);
43841 }
43842
43843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel_1with_1feerate_1and_1script(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id, int64_t target_feerate_sats_per_1000_weight, int64_t shutdown_script) {
43844         LDKChannelManager this_arg_conv;
43845         this_arg_conv.inner = untag_ptr(this_arg);
43846         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43848         this_arg_conv.is_owned = false;
43849         uint8_t channel_id_arr[32];
43850         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
43851         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
43852         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
43853         LDKPublicKey counterparty_node_id_ref;
43854         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
43855         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
43856         void* target_feerate_sats_per_1000_weight_ptr = untag_ptr(target_feerate_sats_per_1000_weight);
43857         CHECK_ACCESS(target_feerate_sats_per_1000_weight_ptr);
43858         LDKCOption_u32Z target_feerate_sats_per_1000_weight_conv = *(LDKCOption_u32Z*)(target_feerate_sats_per_1000_weight_ptr);
43859         target_feerate_sats_per_1000_weight_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(target_feerate_sats_per_1000_weight));
43860         LDKShutdownScript shutdown_script_conv;
43861         shutdown_script_conv.inner = untag_ptr(shutdown_script);
43862         shutdown_script_conv.is_owned = ptr_is_owned(shutdown_script);
43863         CHECK_INNER_FIELD_ACCESS_OR_NULL(shutdown_script_conv);
43864         shutdown_script_conv = ShutdownScript_clone(&shutdown_script_conv);
43865         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
43866         *ret_conv = ChannelManager_close_channel_with_feerate_and_script(&this_arg_conv, channel_id_ref, counterparty_node_id_ref, target_feerate_sats_per_1000_weight_conv, shutdown_script_conv);
43867         return tag_ptr(ret_conv, true);
43868 }
43869
43870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1broadcasting_1latest_1txn(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id) {
43871         LDKChannelManager this_arg_conv;
43872         this_arg_conv.inner = untag_ptr(this_arg);
43873         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43875         this_arg_conv.is_owned = false;
43876         uint8_t channel_id_arr[32];
43877         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
43878         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
43879         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
43880         LDKPublicKey counterparty_node_id_ref;
43881         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
43882         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
43883         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
43884         *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
43885         return tag_ptr(ret_conv, true);
43886 }
43887
43888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1without_1broadcasting_1txn(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id) {
43889         LDKChannelManager this_arg_conv;
43890         this_arg_conv.inner = untag_ptr(this_arg);
43891         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43893         this_arg_conv.is_owned = false;
43894         uint8_t channel_id_arr[32];
43895         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
43896         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
43897         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
43898         LDKPublicKey counterparty_node_id_ref;
43899         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
43900         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
43901         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
43902         *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
43903         return tag_ptr(ret_conv, true);
43904 }
43905
43906 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels_1broadcasting_1latest_1txn(JNIEnv *env, jclass clz, int64_t this_arg) {
43907         LDKChannelManager this_arg_conv;
43908         this_arg_conv.inner = untag_ptr(this_arg);
43909         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43911         this_arg_conv.is_owned = false;
43912         ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
43913 }
43914
43915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels_1without_1broadcasting_1txn(JNIEnv *env, jclass clz, int64_t this_arg) {
43916         LDKChannelManager this_arg_conv;
43917         this_arg_conv.inner = untag_ptr(this_arg);
43918         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43920         this_arg_conv.is_owned = false;
43921         ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
43922 }
43923
43924 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) {
43925         LDKChannelManager this_arg_conv;
43926         this_arg_conv.inner = untag_ptr(this_arg);
43927         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43929         this_arg_conv.is_owned = false;
43930         LDKRoute route_conv;
43931         route_conv.inner = untag_ptr(route);
43932         route_conv.is_owned = ptr_is_owned(route);
43933         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
43934         route_conv.is_owned = false;
43935         LDKThirtyTwoBytes payment_hash_ref;
43936         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
43937         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
43938         LDKRecipientOnionFields recipient_onion_conv;
43939         recipient_onion_conv.inner = untag_ptr(recipient_onion);
43940         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
43941         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
43942         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
43943         LDKThirtyTwoBytes payment_id_ref;
43944         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
43945         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
43946         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
43947         *ret_conv = ChannelManager_send_payment_with_route(&this_arg_conv, &route_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref);
43948         return tag_ptr(ret_conv, true);
43949 }
43950
43951 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) {
43952         LDKChannelManager this_arg_conv;
43953         this_arg_conv.inner = untag_ptr(this_arg);
43954         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43956         this_arg_conv.is_owned = false;
43957         LDKThirtyTwoBytes payment_hash_ref;
43958         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
43959         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
43960         LDKRecipientOnionFields recipient_onion_conv;
43961         recipient_onion_conv.inner = untag_ptr(recipient_onion);
43962         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
43963         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
43964         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
43965         LDKThirtyTwoBytes payment_id_ref;
43966         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
43967         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
43968         LDKRouteParameters route_params_conv;
43969         route_params_conv.inner = untag_ptr(route_params);
43970         route_params_conv.is_owned = ptr_is_owned(route_params);
43971         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
43972         route_params_conv = RouteParameters_clone(&route_params_conv);
43973         void* retry_strategy_ptr = untag_ptr(retry_strategy);
43974         CHECK_ACCESS(retry_strategy_ptr);
43975         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
43976         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
43977         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
43978         *ret_conv = ChannelManager_send_payment(&this_arg_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref, route_params_conv, retry_strategy_conv);
43979         return tag_ptr(ret_conv, true);
43980 }
43981
43982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1abandon_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_id) {
43983         LDKChannelManager this_arg_conv;
43984         this_arg_conv.inner = untag_ptr(this_arg);
43985         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43987         this_arg_conv.is_owned = false;
43988         LDKThirtyTwoBytes payment_id_ref;
43989         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
43990         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
43991         ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
43992 }
43993
43994 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) {
43995         LDKChannelManager this_arg_conv;
43996         this_arg_conv.inner = untag_ptr(this_arg);
43997         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43999         this_arg_conv.is_owned = false;
44000         LDKRoute route_conv;
44001         route_conv.inner = untag_ptr(route);
44002         route_conv.is_owned = ptr_is_owned(route);
44003         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
44004         route_conv.is_owned = false;
44005         void* payment_preimage_ptr = untag_ptr(payment_preimage);
44006         CHECK_ACCESS(payment_preimage_ptr);
44007         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
44008         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
44009         LDKRecipientOnionFields recipient_onion_conv;
44010         recipient_onion_conv.inner = untag_ptr(recipient_onion);
44011         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
44012         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
44013         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
44014         LDKThirtyTwoBytes payment_id_ref;
44015         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
44016         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
44017         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
44018         *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_conv, recipient_onion_conv, payment_id_ref);
44019         return tag_ptr(ret_conv, true);
44020 }
44021
44022 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) {
44023         LDKChannelManager this_arg_conv;
44024         this_arg_conv.inner = untag_ptr(this_arg);
44025         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44027         this_arg_conv.is_owned = false;
44028         void* payment_preimage_ptr = untag_ptr(payment_preimage);
44029         CHECK_ACCESS(payment_preimage_ptr);
44030         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
44031         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
44032         LDKRecipientOnionFields recipient_onion_conv;
44033         recipient_onion_conv.inner = untag_ptr(recipient_onion);
44034         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
44035         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
44036         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
44037         LDKThirtyTwoBytes payment_id_ref;
44038         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
44039         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
44040         LDKRouteParameters route_params_conv;
44041         route_params_conv.inner = untag_ptr(route_params);
44042         route_params_conv.is_owned = ptr_is_owned(route_params);
44043         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
44044         route_params_conv = RouteParameters_clone(&route_params_conv);
44045         void* retry_strategy_ptr = untag_ptr(retry_strategy);
44046         CHECK_ACCESS(retry_strategy_ptr);
44047         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
44048         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
44049         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
44050         *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);
44051         return tag_ptr(ret_conv, true);
44052 }
44053
44054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1probe(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path) {
44055         LDKChannelManager this_arg_conv;
44056         this_arg_conv.inner = untag_ptr(this_arg);
44057         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44059         this_arg_conv.is_owned = false;
44060         LDKPath path_conv;
44061         path_conv.inner = untag_ptr(path);
44062         path_conv.is_owned = ptr_is_owned(path);
44063         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
44064         path_conv = Path_clone(&path_conv);
44065         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
44066         *ret_conv = ChannelManager_send_probe(&this_arg_conv, path_conv);
44067         return tag_ptr(ret_conv, true);
44068 }
44069
44070 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) {
44071         LDKChannelManager this_arg_conv;
44072         this_arg_conv.inner = untag_ptr(this_arg);
44073         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44075         this_arg_conv.is_owned = false;
44076         LDKPublicKey node_id_ref;
44077         CHECK((*env)->GetArrayLength(env, node_id) == 33);
44078         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
44079         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
44080         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
44081         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
44082         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
44083         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
44084         *ret_conv = ChannelManager_send_spontaneous_preflight_probes(&this_arg_conv, node_id_ref, amount_msat, final_cltv_expiry_delta, liquidity_limit_multiplier_conv);
44085         return tag_ptr(ret_conv, true);
44086 }
44087
44088 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) {
44089         LDKChannelManager this_arg_conv;
44090         this_arg_conv.inner = untag_ptr(this_arg);
44091         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44093         this_arg_conv.is_owned = false;
44094         LDKRouteParameters route_params_conv;
44095         route_params_conv.inner = untag_ptr(route_params);
44096         route_params_conv.is_owned = ptr_is_owned(route_params);
44097         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
44098         route_params_conv = RouteParameters_clone(&route_params_conv);
44099         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
44100         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
44101         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
44102         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
44103         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
44104         *ret_conv = ChannelManager_send_preflight_probes(&this_arg_conv, route_params_conv, liquidity_limit_multiplier_conv);
44105         return tag_ptr(ret_conv, true);
44106 }
44107
44108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1funding_1transaction_1generated(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int8_tArray funding_transaction) {
44109         LDKChannelManager this_arg_conv;
44110         this_arg_conv.inner = untag_ptr(this_arg);
44111         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44113         this_arg_conv.is_owned = false;
44114         uint8_t temporary_channel_id_arr[32];
44115         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
44116         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
44117         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
44118         LDKPublicKey counterparty_node_id_ref;
44119         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
44120         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
44121         LDKTransaction funding_transaction_ref;
44122         funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
44123         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
44124         (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
44125         funding_transaction_ref.data_is_owned = true;
44126         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
44127         *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, funding_transaction_ref);
44128         return tag_ptr(ret_conv, true);
44129 }
44130
44131 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) {
44132         LDKChannelManager this_arg_conv;
44133         this_arg_conv.inner = untag_ptr(this_arg);
44134         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44136         this_arg_conv.is_owned = false;
44137         LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ temporary_channels_constr;
44138         temporary_channels_constr.datalen = (*env)->GetArrayLength(env, temporary_channels);
44139         if (temporary_channels_constr.datalen > 0)
44140                 temporary_channels_constr.data = MALLOC(temporary_channels_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ Elements");
44141         else
44142                 temporary_channels_constr.data = NULL;
44143         int64_t* temporary_channels_vals = (*env)->GetLongArrayElements (env, temporary_channels, NULL);
44144         for (size_t j = 0; j < temporary_channels_constr.datalen; j++) {
44145                 int64_t temporary_channels_conv_35 = temporary_channels_vals[j];
44146                 void* temporary_channels_conv_35_ptr = untag_ptr(temporary_channels_conv_35);
44147                 CHECK_ACCESS(temporary_channels_conv_35_ptr);
44148                 LDKC2Tuple_ThirtyTwoBytesPublicKeyZ temporary_channels_conv_35_conv = *(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)(temporary_channels_conv_35_ptr);
44149                 temporary_channels_conv_35_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone((LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(temporary_channels_conv_35));
44150                 temporary_channels_constr.data[j] = temporary_channels_conv_35_conv;
44151         }
44152         (*env)->ReleaseLongArrayElements(env, temporary_channels, temporary_channels_vals, 0);
44153         LDKTransaction funding_transaction_ref;
44154         funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
44155         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
44156         (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
44157         funding_transaction_ref.data_is_owned = true;
44158         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
44159         *ret_conv = ChannelManager_batch_funding_transaction_generated(&this_arg_conv, temporary_channels_constr, funding_transaction_ref);
44160         return tag_ptr(ret_conv, true);
44161 }
44162
44163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1update_1partial_1channel_1config(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray counterparty_node_id, jobjectArray channel_ids, int64_t config_update) {
44164         LDKChannelManager this_arg_conv;
44165         this_arg_conv.inner = untag_ptr(this_arg);
44166         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44168         this_arg_conv.is_owned = false;
44169         LDKPublicKey counterparty_node_id_ref;
44170         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
44171         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
44172         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
44173         channel_ids_constr.datalen = (*env)->GetArrayLength(env, channel_ids);
44174         if (channel_ids_constr.datalen > 0)
44175                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
44176         else
44177                 channel_ids_constr.data = NULL;
44178         for (size_t i = 0; i < channel_ids_constr.datalen; i++) {
44179                 int8_tArray channel_ids_conv_8 = (*env)->GetObjectArrayElement(env, channel_ids, i);
44180                 LDKThirtyTwoBytes channel_ids_conv_8_ref;
44181                 CHECK((*env)->GetArrayLength(env, channel_ids_conv_8) == 32);
44182                 (*env)->GetByteArrayRegion(env, channel_ids_conv_8, 0, 32, channel_ids_conv_8_ref.data);
44183                 channel_ids_constr.data[i] = channel_ids_conv_8_ref;
44184         }
44185         LDKChannelConfigUpdate config_update_conv;
44186         config_update_conv.inner = untag_ptr(config_update);
44187         config_update_conv.is_owned = ptr_is_owned(config_update);
44188         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_update_conv);
44189         config_update_conv.is_owned = false;
44190         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
44191         *ret_conv = ChannelManager_update_partial_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_update_conv);
44192         return tag_ptr(ret_conv, true);
44193 }
44194
44195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1update_1channel_1config(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray counterparty_node_id, jobjectArray channel_ids, int64_t config) {
44196         LDKChannelManager this_arg_conv;
44197         this_arg_conv.inner = untag_ptr(this_arg);
44198         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44200         this_arg_conv.is_owned = false;
44201         LDKPublicKey counterparty_node_id_ref;
44202         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
44203         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
44204         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
44205         channel_ids_constr.datalen = (*env)->GetArrayLength(env, channel_ids);
44206         if (channel_ids_constr.datalen > 0)
44207                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
44208         else
44209                 channel_ids_constr.data = NULL;
44210         for (size_t i = 0; i < channel_ids_constr.datalen; i++) {
44211                 int8_tArray channel_ids_conv_8 = (*env)->GetObjectArrayElement(env, channel_ids, i);
44212                 LDKThirtyTwoBytes channel_ids_conv_8_ref;
44213                 CHECK((*env)->GetArrayLength(env, channel_ids_conv_8) == 32);
44214                 (*env)->GetByteArrayRegion(env, channel_ids_conv_8, 0, 32, channel_ids_conv_8_ref.data);
44215                 channel_ids_constr.data[i] = channel_ids_conv_8_ref;
44216         }
44217         LDKChannelConfig config_conv;
44218         config_conv.inner = untag_ptr(config);
44219         config_conv.is_owned = ptr_is_owned(config);
44220         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
44221         config_conv.is_owned = false;
44222         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
44223         *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
44224         return tag_ptr(ret_conv, true);
44225 }
44226
44227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1forward_1intercepted_1htlc(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray intercept_id, int8_tArray next_hop_channel_id, int8_tArray next_node_id, int64_t amt_to_forward_msat) {
44228         LDKChannelManager this_arg_conv;
44229         this_arg_conv.inner = untag_ptr(this_arg);
44230         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44232         this_arg_conv.is_owned = false;
44233         LDKThirtyTwoBytes intercept_id_ref;
44234         CHECK((*env)->GetArrayLength(env, intercept_id) == 32);
44235         (*env)->GetByteArrayRegion(env, intercept_id, 0, 32, intercept_id_ref.data);
44236         uint8_t next_hop_channel_id_arr[32];
44237         CHECK((*env)->GetArrayLength(env, next_hop_channel_id) == 32);
44238         (*env)->GetByteArrayRegion(env, next_hop_channel_id, 0, 32, next_hop_channel_id_arr);
44239         uint8_t (*next_hop_channel_id_ref)[32] = &next_hop_channel_id_arr;
44240         LDKPublicKey next_node_id_ref;
44241         CHECK((*env)->GetArrayLength(env, next_node_id) == 33);
44242         (*env)->GetByteArrayRegion(env, next_node_id, 0, 33, next_node_id_ref.compressed_form);
44243         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
44244         *ret_conv = ChannelManager_forward_intercepted_htlc(&this_arg_conv, intercept_id_ref, next_hop_channel_id_ref, next_node_id_ref, amt_to_forward_msat);
44245         return tag_ptr(ret_conv, true);
44246 }
44247
44248 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) {
44249         LDKChannelManager this_arg_conv;
44250         this_arg_conv.inner = untag_ptr(this_arg);
44251         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44253         this_arg_conv.is_owned = false;
44254         LDKThirtyTwoBytes intercept_id_ref;
44255         CHECK((*env)->GetArrayLength(env, intercept_id) == 32);
44256         (*env)->GetByteArrayRegion(env, intercept_id, 0, 32, intercept_id_ref.data);
44257         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
44258         *ret_conv = ChannelManager_fail_intercepted_htlc(&this_arg_conv, intercept_id_ref);
44259         return tag_ptr(ret_conv, true);
44260 }
44261
44262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
44263         LDKChannelManager this_arg_conv;
44264         this_arg_conv.inner = untag_ptr(this_arg);
44265         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44267         this_arg_conv.is_owned = false;
44268         ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
44269 }
44270
44271 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
44272         LDKChannelManager this_arg_conv;
44273         this_arg_conv.inner = untag_ptr(this_arg);
44274         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44276         this_arg_conv.is_owned = false;
44277         ChannelManager_timer_tick_occurred(&this_arg_conv);
44278 }
44279
44280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
44281         LDKChannelManager this_arg_conv;
44282         this_arg_conv.inner = untag_ptr(this_arg);
44283         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44285         this_arg_conv.is_owned = false;
44286         uint8_t payment_hash_arr[32];
44287         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
44288         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
44289         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
44290         ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
44291 }
44292
44293 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) {
44294         LDKChannelManager this_arg_conv;
44295         this_arg_conv.inner = untag_ptr(this_arg);
44296         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44298         this_arg_conv.is_owned = false;
44299         uint8_t payment_hash_arr[32];
44300         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
44301         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
44302         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
44303         void* failure_code_ptr = untag_ptr(failure_code);
44304         CHECK_ACCESS(failure_code_ptr);
44305         LDKFailureCode failure_code_conv = *(LDKFailureCode*)(failure_code_ptr);
44306         failure_code_conv = FailureCode_clone((LDKFailureCode*)untag_ptr(failure_code));
44307         ChannelManager_fail_htlc_backwards_with_reason(&this_arg_conv, payment_hash_ref, failure_code_conv);
44308 }
44309
44310 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage) {
44311         LDKChannelManager this_arg_conv;
44312         this_arg_conv.inner = untag_ptr(this_arg);
44313         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44315         this_arg_conv.is_owned = false;
44316         LDKThirtyTwoBytes payment_preimage_ref;
44317         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
44318         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
44319         ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
44320 }
44321
44322 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) {
44323         LDKChannelManager this_arg_conv;
44324         this_arg_conv.inner = untag_ptr(this_arg);
44325         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44327         this_arg_conv.is_owned = false;
44328         LDKThirtyTwoBytes payment_preimage_ref;
44329         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
44330         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
44331         ChannelManager_claim_funds_with_known_custom_tlvs(&this_arg_conv, payment_preimage_ref);
44332 }
44333
44334 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
44335         LDKChannelManager this_arg_conv;
44336         this_arg_conv.inner = untag_ptr(this_arg);
44337         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44339         this_arg_conv.is_owned = false;
44340         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44341         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
44342         return ret_arr;
44343 }
44344
44345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1accept_1inbound_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int8_tArray user_channel_id) {
44346         LDKChannelManager this_arg_conv;
44347         this_arg_conv.inner = untag_ptr(this_arg);
44348         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44350         this_arg_conv.is_owned = false;
44351         uint8_t temporary_channel_id_arr[32];
44352         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
44353         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
44354         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
44355         LDKPublicKey counterparty_node_id_ref;
44356         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
44357         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
44358         LDKU128 user_channel_id_ref;
44359         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
44360         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
44361         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
44362         *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id_ref);
44363         return tag_ptr(ret_conv, true);
44364 }
44365
44366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1accept_1inbound_1channel_1from_1trusted_1peer_10conf(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int8_tArray user_channel_id) {
44367         LDKChannelManager this_arg_conv;
44368         this_arg_conv.inner = untag_ptr(this_arg);
44369         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44371         this_arg_conv.is_owned = false;
44372         uint8_t temporary_channel_id_arr[32];
44373         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
44374         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
44375         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
44376         LDKPublicKey counterparty_node_id_ref;
44377         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
44378         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
44379         LDKU128 user_channel_id_ref;
44380         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
44381         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
44382         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
44383         *ret_conv = ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id_ref);
44384         return tag_ptr(ret_conv, true);
44385 }
44386
44387 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) {
44388         LDKChannelManager this_arg_conv;
44389         this_arg_conv.inner = untag_ptr(this_arg);
44390         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44392         this_arg_conv.is_owned = false;
44393         LDKOffer offer_conv;
44394         offer_conv.inner = untag_ptr(offer);
44395         offer_conv.is_owned = ptr_is_owned(offer);
44396         CHECK_INNER_FIELD_ACCESS_OR_NULL(offer_conv);
44397         offer_conv.is_owned = false;
44398         void* quantity_ptr = untag_ptr(quantity);
44399         CHECK_ACCESS(quantity_ptr);
44400         LDKCOption_u64Z quantity_conv = *(LDKCOption_u64Z*)(quantity_ptr);
44401         quantity_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(quantity));
44402         void* amount_msats_ptr = untag_ptr(amount_msats);
44403         CHECK_ACCESS(amount_msats_ptr);
44404         LDKCOption_u64Z amount_msats_conv = *(LDKCOption_u64Z*)(amount_msats_ptr);
44405         amount_msats_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amount_msats));
44406         void* payer_note_ptr = untag_ptr(payer_note);
44407         CHECK_ACCESS(payer_note_ptr);
44408         LDKCOption_StrZ payer_note_conv = *(LDKCOption_StrZ*)(payer_note_ptr);
44409         payer_note_conv = COption_StrZ_clone((LDKCOption_StrZ*)untag_ptr(payer_note));
44410         LDKThirtyTwoBytes payment_id_ref;
44411         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
44412         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
44413         void* retry_strategy_ptr = untag_ptr(retry_strategy);
44414         CHECK_ACCESS(retry_strategy_ptr);
44415         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
44416         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
44417         void* max_total_routing_fee_msat_ptr = untag_ptr(max_total_routing_fee_msat);
44418         CHECK_ACCESS(max_total_routing_fee_msat_ptr);
44419         LDKCOption_u64Z max_total_routing_fee_msat_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_ptr);
44420         max_total_routing_fee_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat));
44421         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
44422         *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);
44423         return tag_ptr(ret_conv, true);
44424 }
44425
44426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1request_1refund_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t refund) {
44427         LDKChannelManager this_arg_conv;
44428         this_arg_conv.inner = untag_ptr(this_arg);
44429         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44431         this_arg_conv.is_owned = false;
44432         LDKRefund refund_conv;
44433         refund_conv.inner = untag_ptr(refund);
44434         refund_conv.is_owned = ptr_is_owned(refund);
44435         CHECK_INNER_FIELD_ACCESS_OR_NULL(refund_conv);
44436         refund_conv.is_owned = false;
44437         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
44438         *ret_conv = ChannelManager_request_refund_payment(&this_arg_conv, &refund_conv);
44439         return tag_ptr(ret_conv, true);
44440 }
44441
44442 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) {
44443         LDKChannelManager this_arg_conv;
44444         this_arg_conv.inner = untag_ptr(this_arg);
44445         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44447         this_arg_conv.is_owned = false;
44448         void* min_value_msat_ptr = untag_ptr(min_value_msat);
44449         CHECK_ACCESS(min_value_msat_ptr);
44450         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
44451         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
44452         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
44453         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
44454         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
44455         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
44456         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
44457         *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
44458         return tag_ptr(ret_conv, true);
44459 }
44460
44461 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) {
44462         LDKChannelManager 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         LDKThirtyTwoBytes payment_hash_ref;
44468         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
44469         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
44470         void* min_value_msat_ptr = untag_ptr(min_value_msat);
44471         CHECK_ACCESS(min_value_msat_ptr);
44472         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
44473         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
44474         void* min_final_cltv_expiry_ptr = untag_ptr(min_final_cltv_expiry);
44475         CHECK_ACCESS(min_final_cltv_expiry_ptr);
44476         LDKCOption_u16Z min_final_cltv_expiry_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_ptr);
44477         min_final_cltv_expiry_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry));
44478         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
44479         *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);
44480         return tag_ptr(ret_conv, true);
44481 }
44482
44483 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) {
44484         LDKChannelManager 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         LDKThirtyTwoBytes payment_hash_ref;
44490         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
44491         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
44492         LDKThirtyTwoBytes payment_secret_ref;
44493         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
44494         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
44495         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
44496         *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
44497         return tag_ptr(ret_conv, true);
44498 }
44499
44500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
44501         LDKChannelManager this_arg_conv;
44502         this_arg_conv.inner = untag_ptr(this_arg);
44503         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44505         this_arg_conv.is_owned = false;
44506         int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
44507         return ret_conv;
44508 }
44509
44510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
44511         LDKChannelManager this_arg_conv;
44512         this_arg_conv.inner = untag_ptr(this_arg);
44513         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44515         this_arg_conv.is_owned = false;
44516         LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
44517         int64_t ret_ref = 0;
44518         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44519         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44520         return ret_ref;
44521 }
44522
44523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1intercept_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
44524         LDKChannelManager this_arg_conv;
44525         this_arg_conv.inner = untag_ptr(this_arg);
44526         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44528         this_arg_conv.is_owned = false;
44529         int64_t ret_conv = ChannelManager_get_intercept_scid(&this_arg_conv);
44530         return ret_conv;
44531 }
44532
44533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1compute_1inflight_1htlcs(JNIEnv *env, jclass clz, int64_t this_arg) {
44534         LDKChannelManager this_arg_conv;
44535         this_arg_conv.inner = untag_ptr(this_arg);
44536         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44538         this_arg_conv.is_owned = false;
44539         LDKInFlightHtlcs ret_var = ChannelManager_compute_inflight_htlcs(&this_arg_conv);
44540         int64_t ret_ref = 0;
44541         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44542         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44543         return ret_ref;
44544 }
44545
44546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
44547         LDKChannelManager this_arg_conv;
44548         this_arg_conv.inner = untag_ptr(this_arg);
44549         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44551         this_arg_conv.is_owned = false;
44552         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
44553         *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
44554         return tag_ptr(ret_ret, true);
44555 }
44556
44557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
44558         LDKChannelManager this_arg_conv;
44559         this_arg_conv.inner = untag_ptr(this_arg);
44560         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44562         this_arg_conv.is_owned = false;
44563         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
44564         *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
44565         return tag_ptr(ret_ret, true);
44566 }
44567
44568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
44569         LDKChannelManager this_arg_conv;
44570         this_arg_conv.inner = untag_ptr(this_arg);
44571         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44573         this_arg_conv.is_owned = false;
44574         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
44575         *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
44576         return tag_ptr(ret_ret, true);
44577 }
44578
44579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
44580         LDKChannelManager this_arg_conv;
44581         this_arg_conv.inner = untag_ptr(this_arg);
44582         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44584         this_arg_conv.is_owned = false;
44585         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
44586         *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
44587         return tag_ptr(ret_ret, true);
44588 }
44589
44590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1event_1or_1persistence_1needed_1future(JNIEnv *env, jclass clz, int64_t this_arg) {
44591         LDKChannelManager this_arg_conv;
44592         this_arg_conv.inner = untag_ptr(this_arg);
44593         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44595         this_arg_conv.is_owned = false;
44596         LDKFuture ret_var = ChannelManager_get_event_or_persistence_needed_future(&this_arg_conv);
44597         int64_t ret_ref = 0;
44598         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44599         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44600         return ret_ref;
44601 }
44602
44603 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1and_1clear_1needs_1persistence(JNIEnv *env, jclass clz, int64_t this_arg) {
44604         LDKChannelManager this_arg_conv;
44605         this_arg_conv.inner = untag_ptr(this_arg);
44606         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44608         this_arg_conv.is_owned = false;
44609         jboolean ret_conv = ChannelManager_get_and_clear_needs_persistence(&this_arg_conv);
44610         return ret_conv;
44611 }
44612
44613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
44614         LDKChannelManager this_arg_conv;
44615         this_arg_conv.inner = untag_ptr(this_arg);
44616         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44618         this_arg_conv.is_owned = false;
44619         LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
44620         int64_t ret_ref = 0;
44621         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44622         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44623         return ret_ref;
44624 }
44625
44626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
44627         LDKChannelManager this_arg_conv;
44628         this_arg_conv.inner = untag_ptr(this_arg);
44629         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44631         this_arg_conv.is_owned = false;
44632         LDKNodeFeatures ret_var = ChannelManager_node_features(&this_arg_conv);
44633         int64_t ret_ref = 0;
44634         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44635         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44636         return ret_ref;
44637 }
44638
44639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1channel_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
44640         LDKChannelManager this_arg_conv;
44641         this_arg_conv.inner = untag_ptr(this_arg);
44642         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44644         this_arg_conv.is_owned = false;
44645         LDKChannelFeatures ret_var = ChannelManager_channel_features(&this_arg_conv);
44646         int64_t ret_ref = 0;
44647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44649         return ret_ref;
44650 }
44651
44652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
44653         LDKChannelManager this_arg_conv;
44654         this_arg_conv.inner = untag_ptr(this_arg);
44655         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44657         this_arg_conv.is_owned = false;
44658         LDKChannelTypeFeatures ret_var = ChannelManager_channel_type_features(&this_arg_conv);
44659         int64_t ret_ref = 0;
44660         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44661         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44662         return ret_ref;
44663 }
44664
44665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1init_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
44666         LDKChannelManager this_arg_conv;
44667         this_arg_conv.inner = untag_ptr(this_arg);
44668         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44670         this_arg_conv.is_owned = false;
44671         LDKInitFeatures ret_var = ChannelManager_init_features(&this_arg_conv);
44672         int64_t ret_ref = 0;
44673         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44674         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44675         return ret_ref;
44676 }
44677
44678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
44679         LDKChannelManager this_arg_conv;
44680         this_arg_conv.inner = untag_ptr(this_arg);
44681         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44683         this_arg_conv.is_owned = false;
44684         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
44685         *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
44686         return tag_ptr(ret_ret, true);
44687 }
44688
44689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1OffersMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
44690         LDKChannelManager this_arg_conv;
44691         this_arg_conv.inner = untag_ptr(this_arg);
44692         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44694         this_arg_conv.is_owned = false;
44695         LDKOffersMessageHandler* ret_ret = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
44696         *ret_ret = ChannelManager_as_OffersMessageHandler(&this_arg_conv);
44697         return tag_ptr(ret_ret, true);
44698 }
44699
44700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_provided_1init_1features(JNIEnv *env, jclass clz, int64_t config) {
44701         LDKUserConfig config_conv;
44702         config_conv.inner = untag_ptr(config);
44703         config_conv.is_owned = ptr_is_owned(config);
44704         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
44705         config_conv.is_owned = false;
44706         LDKInitFeatures ret_var = provided_init_features(&config_conv);
44707         int64_t ret_ref = 0;
44708         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44709         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44710         return ret_ref;
44711 }
44712
44713 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
44714         LDKCounterpartyForwardingInfo obj_conv;
44715         obj_conv.inner = untag_ptr(obj);
44716         obj_conv.is_owned = ptr_is_owned(obj);
44717         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44718         obj_conv.is_owned = false;
44719         LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
44720         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44721         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44722         CVec_u8Z_free(ret_var);
44723         return ret_arr;
44724 }
44725
44726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44727         LDKu8slice ser_ref;
44728         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44729         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44730         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
44731         *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
44732         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44733         return tag_ptr(ret_conv, true);
44734 }
44735
44736 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1write(JNIEnv *env, jclass clz, int64_t obj) {
44737         LDKChannelCounterparty obj_conv;
44738         obj_conv.inner = untag_ptr(obj);
44739         obj_conv.is_owned = ptr_is_owned(obj);
44740         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44741         obj_conv.is_owned = false;
44742         LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
44743         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44744         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44745         CVec_u8Z_free(ret_var);
44746         return ret_arr;
44747 }
44748
44749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44750         LDKu8slice ser_ref;
44751         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44752         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44753         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
44754         *ret_conv = ChannelCounterparty_read(ser_ref);
44755         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44756         return tag_ptr(ret_conv, true);
44757 }
44758
44759 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1write(JNIEnv *env, jclass clz, int64_t obj) {
44760         LDKChannelDetails obj_conv;
44761         obj_conv.inner = untag_ptr(obj);
44762         obj_conv.is_owned = ptr_is_owned(obj);
44763         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44764         obj_conv.is_owned = false;
44765         LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
44766         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44767         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44768         CVec_u8Z_free(ret_var);
44769         return ret_arr;
44770 }
44771
44772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44773         LDKu8slice ser_ref;
44774         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44775         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44776         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
44777         *ret_conv = ChannelDetails_read(ser_ref);
44778         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44779         return tag_ptr(ret_conv, true);
44780 }
44781
44782 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1write(JNIEnv *env, jclass clz, int64_t obj) {
44783         LDKPhantomRouteHints obj_conv;
44784         obj_conv.inner = untag_ptr(obj);
44785         obj_conv.is_owned = ptr_is_owned(obj);
44786         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44787         obj_conv.is_owned = false;
44788         LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
44789         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44790         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44791         CVec_u8Z_free(ret_var);
44792         return ret_arr;
44793 }
44794
44795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44796         LDKu8slice ser_ref;
44797         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44798         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44799         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
44800         *ret_conv = PhantomRouteHints_read(ser_ref);
44801         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44802         return tag_ptr(ret_conv, true);
44803 }
44804
44805 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedForward_1write(JNIEnv *env, jclass clz, int64_t obj) {
44806         LDKBlindedForward obj_conv;
44807         obj_conv.inner = untag_ptr(obj);
44808         obj_conv.is_owned = ptr_is_owned(obj);
44809         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44810         obj_conv.is_owned = false;
44811         LDKCVec_u8Z ret_var = BlindedForward_write(&obj_conv);
44812         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44813         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44814         CVec_u8Z_free(ret_var);
44815         return ret_arr;
44816 }
44817
44818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedForward_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44819         LDKu8slice ser_ref;
44820         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44821         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44822         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
44823         *ret_conv = BlindedForward_read(ser_ref);
44824         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44825         return tag_ptr(ret_conv, true);
44826 }
44827
44828 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PendingHTLCRouting_1write(JNIEnv *env, jclass clz, int64_t obj) {
44829         LDKPendingHTLCRouting* obj_conv = (LDKPendingHTLCRouting*)untag_ptr(obj);
44830         LDKCVec_u8Z ret_var = PendingHTLCRouting_write(obj_conv);
44831         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44832         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44833         CVec_u8Z_free(ret_var);
44834         return ret_arr;
44835 }
44836
44837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCRouting_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44838         LDKu8slice ser_ref;
44839         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44840         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44841         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
44842         *ret_conv = PendingHTLCRouting_read(ser_ref);
44843         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44844         return tag_ptr(ret_conv, true);
44845 }
44846
44847 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
44848         LDKPendingHTLCInfo obj_conv;
44849         obj_conv.inner = untag_ptr(obj);
44850         obj_conv.is_owned = ptr_is_owned(obj);
44851         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44852         obj_conv.is_owned = false;
44853         LDKCVec_u8Z ret_var = PendingHTLCInfo_write(&obj_conv);
44854         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44855         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44856         CVec_u8Z_free(ret_var);
44857         return ret_arr;
44858 }
44859
44860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44861         LDKu8slice ser_ref;
44862         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44863         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44864         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
44865         *ret_conv = PendingHTLCInfo_read(ser_ref);
44866         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44867         return tag_ptr(ret_conv, true);
44868 }
44869
44870 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedFailure_1write(JNIEnv *env, jclass clz, int64_t obj) {
44871         LDKBlindedFailure* obj_conv = (LDKBlindedFailure*)untag_ptr(obj);
44872         LDKCVec_u8Z ret_var = BlindedFailure_write(obj_conv);
44873         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44874         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44875         CVec_u8Z_free(ret_var);
44876         return ret_arr;
44877 }
44878
44879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedFailure_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44880         LDKu8slice ser_ref;
44881         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44882         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44883         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
44884         *ret_conv = BlindedFailure_read(ser_ref);
44885         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44886         return tag_ptr(ret_conv, true);
44887 }
44888
44889 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
44890         LDKChannelManager obj_conv;
44891         obj_conv.inner = untag_ptr(obj);
44892         obj_conv.is_owned = ptr_is_owned(obj);
44893         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44894         obj_conv.is_owned = false;
44895         LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
44896         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44897         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44898         CVec_u8Z_free(ret_var);
44899         return ret_arr;
44900 }
44901
44902 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1write(JNIEnv *env, jclass clz, int64_t obj) {
44903         LDKChannelShutdownState* obj_conv = (LDKChannelShutdownState*)untag_ptr(obj);
44904         LDKCVec_u8Z ret_var = ChannelShutdownState_write(obj_conv);
44905         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44906         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44907         CVec_u8Z_free(ret_var);
44908         return ret_arr;
44909 }
44910
44911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44912         LDKu8slice ser_ref;
44913         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44914         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44915         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
44916         *ret_conv = ChannelShutdownState_read(ser_ref);
44917         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44918         return tag_ptr(ret_conv, true);
44919 }
44920
44921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44922         LDKChannelManagerReadArgs this_obj_conv;
44923         this_obj_conv.inner = untag_ptr(this_obj);
44924         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44926         ChannelManagerReadArgs_free(this_obj_conv);
44927 }
44928
44929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1entropy_1source(JNIEnv *env, jclass clz, int64_t this_ptr) {
44930         LDKChannelManagerReadArgs this_ptr_conv;
44931         this_ptr_conv.inner = untag_ptr(this_ptr);
44932         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44934         this_ptr_conv.is_owned = false;
44935         // WARNING: This object doesn't live past this scope, needs clone!
44936         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_entropy_source(&this_ptr_conv), false);
44937         return ret_ret;
44938 }
44939
44940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1entropy_1source(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44941         LDKChannelManagerReadArgs this_ptr_conv;
44942         this_ptr_conv.inner = untag_ptr(this_ptr);
44943         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44945         this_ptr_conv.is_owned = false;
44946         void* val_ptr = untag_ptr(val);
44947         CHECK_ACCESS(val_ptr);
44948         LDKEntropySource val_conv = *(LDKEntropySource*)(val_ptr);
44949         if (val_conv.free == LDKEntropySource_JCalls_free) {
44950                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44951                 LDKEntropySource_JCalls_cloned(&val_conv);
44952         }
44953         ChannelManagerReadArgs_set_entropy_source(&this_ptr_conv, val_conv);
44954 }
44955
44956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1node_1signer(JNIEnv *env, jclass clz, int64_t this_ptr) {
44957         LDKChannelManagerReadArgs this_ptr_conv;
44958         this_ptr_conv.inner = untag_ptr(this_ptr);
44959         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44961         this_ptr_conv.is_owned = false;
44962         // WARNING: This object doesn't live past this scope, needs clone!
44963         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_node_signer(&this_ptr_conv), false);
44964         return ret_ret;
44965 }
44966
44967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1node_1signer(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44968         LDKChannelManagerReadArgs this_ptr_conv;
44969         this_ptr_conv.inner = untag_ptr(this_ptr);
44970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44972         this_ptr_conv.is_owned = false;
44973         void* val_ptr = untag_ptr(val);
44974         CHECK_ACCESS(val_ptr);
44975         LDKNodeSigner val_conv = *(LDKNodeSigner*)(val_ptr);
44976         if (val_conv.free == LDKNodeSigner_JCalls_free) {
44977                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44978                 LDKNodeSigner_JCalls_cloned(&val_conv);
44979         }
44980         ChannelManagerReadArgs_set_node_signer(&this_ptr_conv, val_conv);
44981 }
44982
44983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1signer_1provider(JNIEnv *env, jclass clz, int64_t this_ptr) {
44984         LDKChannelManagerReadArgs this_ptr_conv;
44985         this_ptr_conv.inner = untag_ptr(this_ptr);
44986         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44988         this_ptr_conv.is_owned = false;
44989         // WARNING: This object doesn't live past this scope, needs clone!
44990         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_signer_provider(&this_ptr_conv), false);
44991         return ret_ret;
44992 }
44993
44994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1signer_1provider(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44995         LDKChannelManagerReadArgs this_ptr_conv;
44996         this_ptr_conv.inner = untag_ptr(this_ptr);
44997         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44999         this_ptr_conv.is_owned = false;
45000         void* val_ptr = untag_ptr(val);
45001         CHECK_ACCESS(val_ptr);
45002         LDKSignerProvider val_conv = *(LDKSignerProvider*)(val_ptr);
45003         if (val_conv.free == LDKSignerProvider_JCalls_free) {
45004                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45005                 LDKSignerProvider_JCalls_cloned(&val_conv);
45006         }
45007         ChannelManagerReadArgs_set_signer_provider(&this_ptr_conv, val_conv);
45008 }
45009
45010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
45011         LDKChannelManagerReadArgs this_ptr_conv;
45012         this_ptr_conv.inner = untag_ptr(this_ptr);
45013         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45015         this_ptr_conv.is_owned = false;
45016         // WARNING: This object doesn't live past this scope, needs clone!
45017         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv), false);
45018         return ret_ret;
45019 }
45020
45021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45022         LDKChannelManagerReadArgs this_ptr_conv;
45023         this_ptr_conv.inner = untag_ptr(this_ptr);
45024         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45026         this_ptr_conv.is_owned = false;
45027         void* val_ptr = untag_ptr(val);
45028         CHECK_ACCESS(val_ptr);
45029         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
45030         if (val_conv.free == LDKFeeEstimator_JCalls_free) {
45031                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45032                 LDKFeeEstimator_JCalls_cloned(&val_conv);
45033         }
45034         ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
45035 }
45036
45037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
45038         LDKChannelManagerReadArgs this_ptr_conv;
45039         this_ptr_conv.inner = untag_ptr(this_ptr);
45040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45042         this_ptr_conv.is_owned = false;
45043         // WARNING: This object doesn't live past this scope, needs clone!
45044         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv), false);
45045         return ret_ret;
45046 }
45047
45048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45049         LDKChannelManagerReadArgs this_ptr_conv;
45050         this_ptr_conv.inner = untag_ptr(this_ptr);
45051         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45053         this_ptr_conv.is_owned = false;
45054         void* val_ptr = untag_ptr(val);
45055         CHECK_ACCESS(val_ptr);
45056         LDKWatch val_conv = *(LDKWatch*)(val_ptr);
45057         if (val_conv.free == LDKWatch_JCalls_free) {
45058                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45059                 LDKWatch_JCalls_cloned(&val_conv);
45060         }
45061         ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
45062 }
45063
45064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
45065         LDKChannelManagerReadArgs this_ptr_conv;
45066         this_ptr_conv.inner = untag_ptr(this_ptr);
45067         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45069         this_ptr_conv.is_owned = false;
45070         // WARNING: This object doesn't live past this scope, needs clone!
45071         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv), false);
45072         return ret_ret;
45073 }
45074
45075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45076         LDKChannelManagerReadArgs this_ptr_conv;
45077         this_ptr_conv.inner = untag_ptr(this_ptr);
45078         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45080         this_ptr_conv.is_owned = false;
45081         void* val_ptr = untag_ptr(val);
45082         CHECK_ACCESS(val_ptr);
45083         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
45084         if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
45085                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45086                 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
45087         }
45088         ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
45089 }
45090
45091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1router(JNIEnv *env, jclass clz, int64_t this_ptr) {
45092         LDKChannelManagerReadArgs this_ptr_conv;
45093         this_ptr_conv.inner = untag_ptr(this_ptr);
45094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45096         this_ptr_conv.is_owned = false;
45097         // WARNING: This object doesn't live past this scope, needs clone!
45098         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_router(&this_ptr_conv), false);
45099         return ret_ret;
45100 }
45101
45102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1router(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45103         LDKChannelManagerReadArgs this_ptr_conv;
45104         this_ptr_conv.inner = untag_ptr(this_ptr);
45105         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45107         this_ptr_conv.is_owned = false;
45108         void* val_ptr = untag_ptr(val);
45109         CHECK_ACCESS(val_ptr);
45110         LDKRouter val_conv = *(LDKRouter*)(val_ptr);
45111         if (val_conv.free == LDKRouter_JCalls_free) {
45112                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45113                 LDKRouter_JCalls_cloned(&val_conv);
45114         }
45115         ChannelManagerReadArgs_set_router(&this_ptr_conv, val_conv);
45116 }
45117
45118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
45119         LDKChannelManagerReadArgs this_ptr_conv;
45120         this_ptr_conv.inner = untag_ptr(this_ptr);
45121         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45123         this_ptr_conv.is_owned = false;
45124         // WARNING: This object doesn't live past this scope, needs clone!
45125         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_logger(&this_ptr_conv), false);
45126         return ret_ret;
45127 }
45128
45129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45130         LDKChannelManagerReadArgs this_ptr_conv;
45131         this_ptr_conv.inner = untag_ptr(this_ptr);
45132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45134         this_ptr_conv.is_owned = false;
45135         void* val_ptr = untag_ptr(val);
45136         CHECK_ACCESS(val_ptr);
45137         LDKLogger val_conv = *(LDKLogger*)(val_ptr);
45138         if (val_conv.free == LDKLogger_JCalls_free) {
45139                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45140                 LDKLogger_JCalls_cloned(&val_conv);
45141         }
45142         ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
45143 }
45144
45145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
45146         LDKChannelManagerReadArgs this_ptr_conv;
45147         this_ptr_conv.inner = untag_ptr(this_ptr);
45148         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45150         this_ptr_conv.is_owned = false;
45151         LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
45152         int64_t ret_ref = 0;
45153         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45154         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45155         return ret_ref;
45156 }
45157
45158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45159         LDKChannelManagerReadArgs this_ptr_conv;
45160         this_ptr_conv.inner = untag_ptr(this_ptr);
45161         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45163         this_ptr_conv.is_owned = false;
45164         LDKUserConfig val_conv;
45165         val_conv.inner = untag_ptr(val);
45166         val_conv.is_owned = ptr_is_owned(val);
45167         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45168         val_conv = UserConfig_clone(&val_conv);
45169         ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
45170 }
45171
45172 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) {
45173         void* entropy_source_ptr = untag_ptr(entropy_source);
45174         CHECK_ACCESS(entropy_source_ptr);
45175         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
45176         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
45177                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45178                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
45179         }
45180         void* node_signer_ptr = untag_ptr(node_signer);
45181         CHECK_ACCESS(node_signer_ptr);
45182         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
45183         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
45184                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45185                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
45186         }
45187         void* signer_provider_ptr = untag_ptr(signer_provider);
45188         CHECK_ACCESS(signer_provider_ptr);
45189         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
45190         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
45191                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45192                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
45193         }
45194         void* fee_estimator_ptr = untag_ptr(fee_estimator);
45195         CHECK_ACCESS(fee_estimator_ptr);
45196         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
45197         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
45198                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45199                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
45200         }
45201         void* chain_monitor_ptr = untag_ptr(chain_monitor);
45202         CHECK_ACCESS(chain_monitor_ptr);
45203         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
45204         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
45205                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45206                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
45207         }
45208         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
45209         CHECK_ACCESS(tx_broadcaster_ptr);
45210         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
45211         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
45212                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45213                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
45214         }
45215         void* router_ptr = untag_ptr(router);
45216         CHECK_ACCESS(router_ptr);
45217         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
45218         if (router_conv.free == LDKRouter_JCalls_free) {
45219                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45220                 LDKRouter_JCalls_cloned(&router_conv);
45221         }
45222         void* logger_ptr = untag_ptr(logger);
45223         CHECK_ACCESS(logger_ptr);
45224         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
45225         if (logger_conv.free == LDKLogger_JCalls_free) {
45226                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45227                 LDKLogger_JCalls_cloned(&logger_conv);
45228         }
45229         LDKUserConfig default_config_conv;
45230         default_config_conv.inner = untag_ptr(default_config);
45231         default_config_conv.is_owned = ptr_is_owned(default_config);
45232         CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
45233         default_config_conv = UserConfig_clone(&default_config_conv);
45234         LDKCVec_ChannelMonitorZ channel_monitors_constr;
45235         channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
45236         if (channel_monitors_constr.datalen > 0)
45237                 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
45238         else
45239                 channel_monitors_constr.data = NULL;
45240         int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
45241         for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
45242                 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
45243                 LDKChannelMonitor channel_monitors_conv_16_conv;
45244                 channel_monitors_conv_16_conv.inner = untag_ptr(channel_monitors_conv_16);
45245                 channel_monitors_conv_16_conv.is_owned = ptr_is_owned(channel_monitors_conv_16);
45246                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
45247                 channel_monitors_conv_16_conv.is_owned = false;
45248                 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
45249         }
45250         (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
45251         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);
45252         int64_t ret_ref = 0;
45253         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45254         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45255         return ret_ref;
45256 }
45257
45258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
45259         LDKu8slice ser_ref;
45260         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45261         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45262         LDKChannelManagerReadArgs arg_conv;
45263         arg_conv.inner = untag_ptr(arg);
45264         arg_conv.is_owned = ptr_is_owned(arg);
45265         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45266         // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
45267         
45268         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
45269         *ret_conv = C2Tuple_ThirtyTwoBytesChannelManagerZ_read(ser_ref, arg_conv);
45270         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45271         return tag_ptr(ret_conv, true);
45272 }
45273
45274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45275         LDKDelayedPaymentBasepoint this_obj_conv;
45276         this_obj_conv.inner = untag_ptr(this_obj);
45277         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45279         DelayedPaymentBasepoint_free(this_obj_conv);
45280 }
45281
45282 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
45283         LDKDelayedPaymentBasepoint this_ptr_conv;
45284         this_ptr_conv.inner = untag_ptr(this_ptr);
45285         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45287         this_ptr_conv.is_owned = false;
45288         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
45289         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentBasepoint_get_a(&this_ptr_conv).compressed_form);
45290         return ret_arr;
45291 }
45292
45293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45294         LDKDelayedPaymentBasepoint this_ptr_conv;
45295         this_ptr_conv.inner = untag_ptr(this_ptr);
45296         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45298         this_ptr_conv.is_owned = false;
45299         LDKPublicKey val_ref;
45300         CHECK((*env)->GetArrayLength(env, val) == 33);
45301         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
45302         DelayedPaymentBasepoint_set_a(&this_ptr_conv, val_ref);
45303 }
45304
45305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
45306         LDKPublicKey a_arg_ref;
45307         CHECK((*env)->GetArrayLength(env, a_arg) == 33);
45308         (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
45309         LDKDelayedPaymentBasepoint ret_var = DelayedPaymentBasepoint_new(a_arg_ref);
45310         int64_t ret_ref = 0;
45311         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45312         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45313         return ret_ref;
45314 }
45315
45316 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45317         LDKDelayedPaymentBasepoint a_conv;
45318         a_conv.inner = untag_ptr(a);
45319         a_conv.is_owned = ptr_is_owned(a);
45320         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45321         a_conv.is_owned = false;
45322         LDKDelayedPaymentBasepoint b_conv;
45323         b_conv.inner = untag_ptr(b);
45324         b_conv.is_owned = ptr_is_owned(b);
45325         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45326         b_conv.is_owned = false;
45327         jboolean ret_conv = DelayedPaymentBasepoint_eq(&a_conv, &b_conv);
45328         return ret_conv;
45329 }
45330
45331 static inline uint64_t DelayedPaymentBasepoint_clone_ptr(LDKDelayedPaymentBasepoint *NONNULL_PTR arg) {
45332         LDKDelayedPaymentBasepoint ret_var = DelayedPaymentBasepoint_clone(arg);
45333         int64_t ret_ref = 0;
45334         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45335         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45336         return ret_ref;
45337 }
45338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45339         LDKDelayedPaymentBasepoint arg_conv;
45340         arg_conv.inner = untag_ptr(arg);
45341         arg_conv.is_owned = ptr_is_owned(arg);
45342         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45343         arg_conv.is_owned = false;
45344         int64_t ret_conv = DelayedPaymentBasepoint_clone_ptr(&arg_conv);
45345         return ret_conv;
45346 }
45347
45348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45349         LDKDelayedPaymentBasepoint orig_conv;
45350         orig_conv.inner = untag_ptr(orig);
45351         orig_conv.is_owned = ptr_is_owned(orig);
45352         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45353         orig_conv.is_owned = false;
45354         LDKDelayedPaymentBasepoint ret_var = DelayedPaymentBasepoint_clone(&orig_conv);
45355         int64_t ret_ref = 0;
45356         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45357         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45358         return ret_ref;
45359 }
45360
45361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
45362         LDKDelayedPaymentBasepoint o_conv;
45363         o_conv.inner = untag_ptr(o);
45364         o_conv.is_owned = ptr_is_owned(o);
45365         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45366         o_conv.is_owned = false;
45367         int64_t ret_conv = DelayedPaymentBasepoint_hash(&o_conv);
45368         return ret_conv;
45369 }
45370
45371 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1to_1public_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
45372         LDKDelayedPaymentBasepoint this_arg_conv;
45373         this_arg_conv.inner = untag_ptr(this_arg);
45374         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45376         this_arg_conv.is_owned = false;
45377         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
45378         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentBasepoint_to_public_key(&this_arg_conv).compressed_form);
45379         return ret_arr;
45380 }
45381
45382 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
45383         LDKDelayedPaymentBasepoint obj_conv;
45384         obj_conv.inner = untag_ptr(obj);
45385         obj_conv.is_owned = ptr_is_owned(obj);
45386         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45387         obj_conv.is_owned = false;
45388         LDKCVec_u8Z ret_var = DelayedPaymentBasepoint_write(&obj_conv);
45389         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45390         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45391         CVec_u8Z_free(ret_var);
45392         return ret_arr;
45393 }
45394
45395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
45396         LDKu8slice ser_ref;
45397         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45398         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45399         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
45400         *ret_conv = DelayedPaymentBasepoint_read(ser_ref);
45401         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45402         return tag_ptr(ret_conv, true);
45403 }
45404
45405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45406         LDKDelayedPaymentKey this_obj_conv;
45407         this_obj_conv.inner = untag_ptr(this_obj);
45408         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45410         DelayedPaymentKey_free(this_obj_conv);
45411 }
45412
45413 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
45414         LDKDelayedPaymentKey this_ptr_conv;
45415         this_ptr_conv.inner = untag_ptr(this_ptr);
45416         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45418         this_ptr_conv.is_owned = false;
45419         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
45420         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentKey_get_a(&this_ptr_conv).compressed_form);
45421         return ret_arr;
45422 }
45423
45424 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45425         LDKDelayedPaymentKey this_ptr_conv;
45426         this_ptr_conv.inner = untag_ptr(this_ptr);
45427         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45429         this_ptr_conv.is_owned = false;
45430         LDKPublicKey val_ref;
45431         CHECK((*env)->GetArrayLength(env, val) == 33);
45432         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
45433         DelayedPaymentKey_set_a(&this_ptr_conv, val_ref);
45434 }
45435
45436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
45437         LDKPublicKey a_arg_ref;
45438         CHECK((*env)->GetArrayLength(env, a_arg) == 33);
45439         (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
45440         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_new(a_arg_ref);
45441         int64_t ret_ref = 0;
45442         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45443         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45444         return ret_ref;
45445 }
45446
45447 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45448         LDKDelayedPaymentKey a_conv;
45449         a_conv.inner = untag_ptr(a);
45450         a_conv.is_owned = ptr_is_owned(a);
45451         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45452         a_conv.is_owned = false;
45453         LDKDelayedPaymentKey b_conv;
45454         b_conv.inner = untag_ptr(b);
45455         b_conv.is_owned = ptr_is_owned(b);
45456         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45457         b_conv.is_owned = false;
45458         jboolean ret_conv = DelayedPaymentKey_eq(&a_conv, &b_conv);
45459         return ret_conv;
45460 }
45461
45462 static inline uint64_t DelayedPaymentKey_clone_ptr(LDKDelayedPaymentKey *NONNULL_PTR arg) {
45463         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_clone(arg);
45464         int64_t ret_ref = 0;
45465         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45466         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45467         return ret_ref;
45468 }
45469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45470         LDKDelayedPaymentKey arg_conv;
45471         arg_conv.inner = untag_ptr(arg);
45472         arg_conv.is_owned = ptr_is_owned(arg);
45473         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45474         arg_conv.is_owned = false;
45475         int64_t ret_conv = DelayedPaymentKey_clone_ptr(&arg_conv);
45476         return ret_conv;
45477 }
45478
45479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45480         LDKDelayedPaymentKey orig_conv;
45481         orig_conv.inner = untag_ptr(orig);
45482         orig_conv.is_owned = ptr_is_owned(orig);
45483         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45484         orig_conv.is_owned = false;
45485         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_clone(&orig_conv);
45486         int64_t ret_ref = 0;
45487         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45488         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45489         return ret_ref;
45490 }
45491
45492 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) {
45493         LDKDelayedPaymentBasepoint countersignatory_basepoint_conv;
45494         countersignatory_basepoint_conv.inner = untag_ptr(countersignatory_basepoint);
45495         countersignatory_basepoint_conv.is_owned = ptr_is_owned(countersignatory_basepoint);
45496         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_basepoint_conv);
45497         countersignatory_basepoint_conv.is_owned = false;
45498         LDKPublicKey per_commitment_point_ref;
45499         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
45500         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
45501         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_from_basepoint(&countersignatory_basepoint_conv, per_commitment_point_ref);
45502         int64_t ret_ref = 0;
45503         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45504         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45505         return ret_ref;
45506 }
45507
45508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1from_1secret_1key(JNIEnv *env, jclass clz, int8_tArray sk) {
45509         uint8_t sk_arr[32];
45510         CHECK((*env)->GetArrayLength(env, sk) == 32);
45511         (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr);
45512         uint8_t (*sk_ref)[32] = &sk_arr;
45513         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_from_secret_key(sk_ref);
45514         int64_t ret_ref = 0;
45515         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45516         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45517         return ret_ref;
45518 }
45519
45520 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1to_1public_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
45521         LDKDelayedPaymentKey this_arg_conv;
45522         this_arg_conv.inner = untag_ptr(this_arg);
45523         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45525         this_arg_conv.is_owned = false;
45526         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
45527         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentKey_to_public_key(&this_arg_conv).compressed_form);
45528         return ret_arr;
45529 }
45530
45531 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1write(JNIEnv *env, jclass clz, int64_t obj) {
45532         LDKDelayedPaymentKey obj_conv;
45533         obj_conv.inner = untag_ptr(obj);
45534         obj_conv.is_owned = ptr_is_owned(obj);
45535         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45536         obj_conv.is_owned = false;
45537         LDKCVec_u8Z ret_var = DelayedPaymentKey_write(&obj_conv);
45538         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45539         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45540         CVec_u8Z_free(ret_var);
45541         return ret_arr;
45542 }
45543
45544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
45545         LDKu8slice ser_ref;
45546         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45547         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45548         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
45549         *ret_conv = DelayedPaymentKey_read(ser_ref);
45550         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45551         return tag_ptr(ret_conv, true);
45552 }
45553
45554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45555         LDKHtlcBasepoint this_obj_conv;
45556         this_obj_conv.inner = untag_ptr(this_obj);
45557         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45559         HtlcBasepoint_free(this_obj_conv);
45560 }
45561
45562 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
45563         LDKHtlcBasepoint this_ptr_conv;
45564         this_ptr_conv.inner = untag_ptr(this_ptr);
45565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45567         this_ptr_conv.is_owned = false;
45568         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
45569         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, HtlcBasepoint_get_a(&this_ptr_conv).compressed_form);
45570         return ret_arr;
45571 }
45572
45573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45574         LDKHtlcBasepoint this_ptr_conv;
45575         this_ptr_conv.inner = untag_ptr(this_ptr);
45576         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45578         this_ptr_conv.is_owned = false;
45579         LDKPublicKey val_ref;
45580         CHECK((*env)->GetArrayLength(env, val) == 33);
45581         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
45582         HtlcBasepoint_set_a(&this_ptr_conv, val_ref);
45583 }
45584
45585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
45586         LDKPublicKey a_arg_ref;
45587         CHECK((*env)->GetArrayLength(env, a_arg) == 33);
45588         (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
45589         LDKHtlcBasepoint ret_var = HtlcBasepoint_new(a_arg_ref);
45590         int64_t ret_ref = 0;
45591         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45592         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45593         return ret_ref;
45594 }
45595
45596 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45597         LDKHtlcBasepoint a_conv;
45598         a_conv.inner = untag_ptr(a);
45599         a_conv.is_owned = ptr_is_owned(a);
45600         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45601         a_conv.is_owned = false;
45602         LDKHtlcBasepoint b_conv;
45603         b_conv.inner = untag_ptr(b);
45604         b_conv.is_owned = ptr_is_owned(b);
45605         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45606         b_conv.is_owned = false;
45607         jboolean ret_conv = HtlcBasepoint_eq(&a_conv, &b_conv);
45608         return ret_conv;
45609 }
45610
45611 static inline uint64_t HtlcBasepoint_clone_ptr(LDKHtlcBasepoint *NONNULL_PTR arg) {
45612         LDKHtlcBasepoint ret_var = HtlcBasepoint_clone(arg);
45613         int64_t ret_ref = 0;
45614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45616         return ret_ref;
45617 }
45618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45619         LDKHtlcBasepoint arg_conv;
45620         arg_conv.inner = untag_ptr(arg);
45621         arg_conv.is_owned = ptr_is_owned(arg);
45622         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45623         arg_conv.is_owned = false;
45624         int64_t ret_conv = HtlcBasepoint_clone_ptr(&arg_conv);
45625         return ret_conv;
45626 }
45627
45628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45629         LDKHtlcBasepoint orig_conv;
45630         orig_conv.inner = untag_ptr(orig);
45631         orig_conv.is_owned = ptr_is_owned(orig);
45632         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45633         orig_conv.is_owned = false;
45634         LDKHtlcBasepoint ret_var = HtlcBasepoint_clone(&orig_conv);
45635         int64_t ret_ref = 0;
45636         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45637         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45638         return ret_ref;
45639 }
45640
45641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
45642         LDKHtlcBasepoint o_conv;
45643         o_conv.inner = untag_ptr(o);
45644         o_conv.is_owned = ptr_is_owned(o);
45645         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45646         o_conv.is_owned = false;
45647         int64_t ret_conv = HtlcBasepoint_hash(&o_conv);
45648         return ret_conv;
45649 }
45650
45651 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1to_1public_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
45652         LDKHtlcBasepoint this_arg_conv;
45653         this_arg_conv.inner = untag_ptr(this_arg);
45654         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45656         this_arg_conv.is_owned = false;
45657         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
45658         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, HtlcBasepoint_to_public_key(&this_arg_conv).compressed_form);
45659         return ret_arr;
45660 }
45661
45662 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
45663         LDKHtlcBasepoint obj_conv;
45664         obj_conv.inner = untag_ptr(obj);
45665         obj_conv.is_owned = ptr_is_owned(obj);
45666         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45667         obj_conv.is_owned = false;
45668         LDKCVec_u8Z ret_var = HtlcBasepoint_write(&obj_conv);
45669         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45670         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45671         CVec_u8Z_free(ret_var);
45672         return ret_arr;
45673 }
45674
45675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
45676         LDKu8slice ser_ref;
45677         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45678         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45679         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
45680         *ret_conv = HtlcBasepoint_read(ser_ref);
45681         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45682         return tag_ptr(ret_conv, true);
45683 }
45684
45685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HtlcKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45686         LDKHtlcKey this_obj_conv;
45687         this_obj_conv.inner = untag_ptr(this_obj);
45688         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45690         HtlcKey_free(this_obj_conv);
45691 }
45692
45693 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HtlcKey_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
45694         LDKHtlcKey this_ptr_conv;
45695         this_ptr_conv.inner = untag_ptr(this_ptr);
45696         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45698         this_ptr_conv.is_owned = false;
45699         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
45700         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, HtlcKey_get_a(&this_ptr_conv).compressed_form);
45701         return ret_arr;
45702 }
45703
45704 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HtlcKey_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45705         LDKHtlcKey this_ptr_conv;
45706         this_ptr_conv.inner = untag_ptr(this_ptr);
45707         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45709         this_ptr_conv.is_owned = false;
45710         LDKPublicKey val_ref;
45711         CHECK((*env)->GetArrayLength(env, val) == 33);
45712         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
45713         HtlcKey_set_a(&this_ptr_conv, val_ref);
45714 }
45715
45716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcKey_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
45717         LDKPublicKey a_arg_ref;
45718         CHECK((*env)->GetArrayLength(env, a_arg) == 33);
45719         (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
45720         LDKHtlcKey ret_var = HtlcKey_new(a_arg_ref);
45721         int64_t ret_ref = 0;
45722         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45723         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45724         return ret_ref;
45725 }
45726
45727 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HtlcKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45728         LDKHtlcKey a_conv;
45729         a_conv.inner = untag_ptr(a);
45730         a_conv.is_owned = ptr_is_owned(a);
45731         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45732         a_conv.is_owned = false;
45733         LDKHtlcKey b_conv;
45734         b_conv.inner = untag_ptr(b);
45735         b_conv.is_owned = ptr_is_owned(b);
45736         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45737         b_conv.is_owned = false;
45738         jboolean ret_conv = HtlcKey_eq(&a_conv, &b_conv);
45739         return ret_conv;
45740 }
45741
45742 static inline uint64_t HtlcKey_clone_ptr(LDKHtlcKey *NONNULL_PTR arg) {
45743         LDKHtlcKey ret_var = HtlcKey_clone(arg);
45744         int64_t ret_ref = 0;
45745         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45746         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45747         return ret_ref;
45748 }
45749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcKey_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45750         LDKHtlcKey arg_conv;
45751         arg_conv.inner = untag_ptr(arg);
45752         arg_conv.is_owned = ptr_is_owned(arg);
45753         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45754         arg_conv.is_owned = false;
45755         int64_t ret_conv = HtlcKey_clone_ptr(&arg_conv);
45756         return ret_conv;
45757 }
45758
45759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45760         LDKHtlcKey orig_conv;
45761         orig_conv.inner = untag_ptr(orig);
45762         orig_conv.is_owned = ptr_is_owned(orig);
45763         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45764         orig_conv.is_owned = false;
45765         LDKHtlcKey ret_var = HtlcKey_clone(&orig_conv);
45766         int64_t ret_ref = 0;
45767         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45768         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45769         return ret_ref;
45770 }
45771
45772 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) {
45773         LDKHtlcBasepoint countersignatory_basepoint_conv;
45774         countersignatory_basepoint_conv.inner = untag_ptr(countersignatory_basepoint);
45775         countersignatory_basepoint_conv.is_owned = ptr_is_owned(countersignatory_basepoint);
45776         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_basepoint_conv);
45777         countersignatory_basepoint_conv.is_owned = false;
45778         LDKPublicKey per_commitment_point_ref;
45779         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
45780         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
45781         LDKHtlcKey ret_var = HtlcKey_from_basepoint(&countersignatory_basepoint_conv, per_commitment_point_ref);
45782         int64_t ret_ref = 0;
45783         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45784         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45785         return ret_ref;
45786 }
45787
45788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcKey_1from_1secret_1key(JNIEnv *env, jclass clz, int8_tArray sk) {
45789         uint8_t sk_arr[32];
45790         CHECK((*env)->GetArrayLength(env, sk) == 32);
45791         (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr);
45792         uint8_t (*sk_ref)[32] = &sk_arr;
45793         LDKHtlcKey ret_var = HtlcKey_from_secret_key(sk_ref);
45794         int64_t ret_ref = 0;
45795         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45796         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45797         return ret_ref;
45798 }
45799
45800 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HtlcKey_1to_1public_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
45801         LDKHtlcKey this_arg_conv;
45802         this_arg_conv.inner = untag_ptr(this_arg);
45803         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45805         this_arg_conv.is_owned = false;
45806         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
45807         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, HtlcKey_to_public_key(&this_arg_conv).compressed_form);
45808         return ret_arr;
45809 }
45810
45811 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HtlcKey_1write(JNIEnv *env, jclass clz, int64_t obj) {
45812         LDKHtlcKey obj_conv;
45813         obj_conv.inner = untag_ptr(obj);
45814         obj_conv.is_owned = ptr_is_owned(obj);
45815         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45816         obj_conv.is_owned = false;
45817         LDKCVec_u8Z ret_var = HtlcKey_write(&obj_conv);
45818         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45819         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45820         CVec_u8Z_free(ret_var);
45821         return ret_arr;
45822 }
45823
45824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcKey_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
45825         LDKu8slice ser_ref;
45826         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45827         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45828         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
45829         *ret_conv = HtlcKey_read(ser_ref);
45830         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45831         return tag_ptr(ret_conv, true);
45832 }
45833
45834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45835         LDKRevocationBasepoint this_obj_conv;
45836         this_obj_conv.inner = untag_ptr(this_obj);
45837         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45839         RevocationBasepoint_free(this_obj_conv);
45840 }
45841
45842 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
45843         LDKRevocationBasepoint this_ptr_conv;
45844         this_ptr_conv.inner = untag_ptr(this_ptr);
45845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45847         this_ptr_conv.is_owned = false;
45848         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
45849         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevocationBasepoint_get_a(&this_ptr_conv).compressed_form);
45850         return ret_arr;
45851 }
45852
45853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45854         LDKRevocationBasepoint this_ptr_conv;
45855         this_ptr_conv.inner = untag_ptr(this_ptr);
45856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45858         this_ptr_conv.is_owned = false;
45859         LDKPublicKey val_ref;
45860         CHECK((*env)->GetArrayLength(env, val) == 33);
45861         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
45862         RevocationBasepoint_set_a(&this_ptr_conv, val_ref);
45863 }
45864
45865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
45866         LDKPublicKey a_arg_ref;
45867         CHECK((*env)->GetArrayLength(env, a_arg) == 33);
45868         (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
45869         LDKRevocationBasepoint ret_var = RevocationBasepoint_new(a_arg_ref);
45870         int64_t ret_ref = 0;
45871         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45872         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45873         return ret_ref;
45874 }
45875
45876 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45877         LDKRevocationBasepoint a_conv;
45878         a_conv.inner = untag_ptr(a);
45879         a_conv.is_owned = ptr_is_owned(a);
45880         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45881         a_conv.is_owned = false;
45882         LDKRevocationBasepoint b_conv;
45883         b_conv.inner = untag_ptr(b);
45884         b_conv.is_owned = ptr_is_owned(b);
45885         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45886         b_conv.is_owned = false;
45887         jboolean ret_conv = RevocationBasepoint_eq(&a_conv, &b_conv);
45888         return ret_conv;
45889 }
45890
45891 static inline uint64_t RevocationBasepoint_clone_ptr(LDKRevocationBasepoint *NONNULL_PTR arg) {
45892         LDKRevocationBasepoint ret_var = RevocationBasepoint_clone(arg);
45893         int64_t ret_ref = 0;
45894         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45895         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45896         return ret_ref;
45897 }
45898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45899         LDKRevocationBasepoint arg_conv;
45900         arg_conv.inner = untag_ptr(arg);
45901         arg_conv.is_owned = ptr_is_owned(arg);
45902         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45903         arg_conv.is_owned = false;
45904         int64_t ret_conv = RevocationBasepoint_clone_ptr(&arg_conv);
45905         return ret_conv;
45906 }
45907
45908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45909         LDKRevocationBasepoint orig_conv;
45910         orig_conv.inner = untag_ptr(orig);
45911         orig_conv.is_owned = ptr_is_owned(orig);
45912         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45913         orig_conv.is_owned = false;
45914         LDKRevocationBasepoint ret_var = RevocationBasepoint_clone(&orig_conv);
45915         int64_t ret_ref = 0;
45916         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45917         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45918         return ret_ref;
45919 }
45920
45921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
45922         LDKRevocationBasepoint o_conv;
45923         o_conv.inner = untag_ptr(o);
45924         o_conv.is_owned = ptr_is_owned(o);
45925         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45926         o_conv.is_owned = false;
45927         int64_t ret_conv = RevocationBasepoint_hash(&o_conv);
45928         return ret_conv;
45929 }
45930
45931 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1to_1public_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
45932         LDKRevocationBasepoint this_arg_conv;
45933         this_arg_conv.inner = untag_ptr(this_arg);
45934         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45936         this_arg_conv.is_owned = false;
45937         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
45938         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevocationBasepoint_to_public_key(&this_arg_conv).compressed_form);
45939         return ret_arr;
45940 }
45941
45942 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
45943         LDKRevocationBasepoint obj_conv;
45944         obj_conv.inner = untag_ptr(obj);
45945         obj_conv.is_owned = ptr_is_owned(obj);
45946         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45947         obj_conv.is_owned = false;
45948         LDKCVec_u8Z ret_var = RevocationBasepoint_write(&obj_conv);
45949         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45950         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45951         CVec_u8Z_free(ret_var);
45952         return ret_arr;
45953 }
45954
45955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
45956         LDKu8slice ser_ref;
45957         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45958         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45959         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
45960         *ret_conv = RevocationBasepoint_read(ser_ref);
45961         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45962         return tag_ptr(ret_conv, true);
45963 }
45964
45965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevocationKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45966         LDKRevocationKey this_obj_conv;
45967         this_obj_conv.inner = untag_ptr(this_obj);
45968         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45970         RevocationKey_free(this_obj_conv);
45971 }
45972
45973 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevocationKey_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
45974         LDKRevocationKey this_ptr_conv;
45975         this_ptr_conv.inner = untag_ptr(this_ptr);
45976         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45978         this_ptr_conv.is_owned = false;
45979         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
45980         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevocationKey_get_a(&this_ptr_conv).compressed_form);
45981         return ret_arr;
45982 }
45983
45984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevocationKey_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45985         LDKRevocationKey this_ptr_conv;
45986         this_ptr_conv.inner = untag_ptr(this_ptr);
45987         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45989         this_ptr_conv.is_owned = false;
45990         LDKPublicKey val_ref;
45991         CHECK((*env)->GetArrayLength(env, val) == 33);
45992         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
45993         RevocationKey_set_a(&this_ptr_conv, val_ref);
45994 }
45995
45996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationKey_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
45997         LDKPublicKey a_arg_ref;
45998         CHECK((*env)->GetArrayLength(env, a_arg) == 33);
45999         (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
46000         LDKRevocationKey ret_var = RevocationKey_new(a_arg_ref);
46001         int64_t ret_ref = 0;
46002         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46003         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46004         return ret_ref;
46005 }
46006
46007 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RevocationKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46008         LDKRevocationKey a_conv;
46009         a_conv.inner = untag_ptr(a);
46010         a_conv.is_owned = ptr_is_owned(a);
46011         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46012         a_conv.is_owned = false;
46013         LDKRevocationKey b_conv;
46014         b_conv.inner = untag_ptr(b);
46015         b_conv.is_owned = ptr_is_owned(b);
46016         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46017         b_conv.is_owned = false;
46018         jboolean ret_conv = RevocationKey_eq(&a_conv, &b_conv);
46019         return ret_conv;
46020 }
46021
46022 static inline uint64_t RevocationKey_clone_ptr(LDKRevocationKey *NONNULL_PTR arg) {
46023         LDKRevocationKey ret_var = RevocationKey_clone(arg);
46024         int64_t ret_ref = 0;
46025         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46026         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46027         return ret_ref;
46028 }
46029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationKey_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46030         LDKRevocationKey arg_conv;
46031         arg_conv.inner = untag_ptr(arg);
46032         arg_conv.is_owned = ptr_is_owned(arg);
46033         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46034         arg_conv.is_owned = false;
46035         int64_t ret_conv = RevocationKey_clone_ptr(&arg_conv);
46036         return ret_conv;
46037 }
46038
46039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46040         LDKRevocationKey orig_conv;
46041         orig_conv.inner = untag_ptr(orig);
46042         orig_conv.is_owned = ptr_is_owned(orig);
46043         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46044         orig_conv.is_owned = false;
46045         LDKRevocationKey ret_var = RevocationKey_clone(&orig_conv);
46046         int64_t ret_ref = 0;
46047         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46048         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46049         return ret_ref;
46050 }
46051
46052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationKey_1hash(JNIEnv *env, jclass clz, int64_t o) {
46053         LDKRevocationKey o_conv;
46054         o_conv.inner = untag_ptr(o);
46055         o_conv.is_owned = ptr_is_owned(o);
46056         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46057         o_conv.is_owned = false;
46058         int64_t ret_conv = RevocationKey_hash(&o_conv);
46059         return ret_conv;
46060 }
46061
46062 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) {
46063         LDKRevocationBasepoint countersignatory_basepoint_conv;
46064         countersignatory_basepoint_conv.inner = untag_ptr(countersignatory_basepoint);
46065         countersignatory_basepoint_conv.is_owned = ptr_is_owned(countersignatory_basepoint);
46066         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_basepoint_conv);
46067         countersignatory_basepoint_conv.is_owned = false;
46068         LDKPublicKey per_commitment_point_ref;
46069         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
46070         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
46071         LDKRevocationKey ret_var = RevocationKey_from_basepoint(&countersignatory_basepoint_conv, per_commitment_point_ref);
46072         int64_t ret_ref = 0;
46073         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46074         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46075         return ret_ref;
46076 }
46077
46078 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevocationKey_1to_1public_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
46079         LDKRevocationKey this_arg_conv;
46080         this_arg_conv.inner = untag_ptr(this_arg);
46081         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46083         this_arg_conv.is_owned = false;
46084         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
46085         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevocationKey_to_public_key(&this_arg_conv).compressed_form);
46086         return ret_arr;
46087 }
46088
46089 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevocationKey_1write(JNIEnv *env, jclass clz, int64_t obj) {
46090         LDKRevocationKey obj_conv;
46091         obj_conv.inner = untag_ptr(obj);
46092         obj_conv.is_owned = ptr_is_owned(obj);
46093         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46094         obj_conv.is_owned = false;
46095         LDKCVec_u8Z ret_var = RevocationKey_write(&obj_conv);
46096         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
46097         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
46098         CVec_u8Z_free(ret_var);
46099         return ret_arr;
46100 }
46101
46102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationKey_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
46103         LDKu8slice ser_ref;
46104         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
46105         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
46106         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
46107         *ret_conv = RevocationKey_read(ser_ref);
46108         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
46109         return tag_ptr(ret_conv, true);
46110 }
46111
46112 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46113         LDKExpandedKey this_obj_conv;
46114         this_obj_conv.inner = untag_ptr(this_obj);
46115         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46117         ExpandedKey_free(this_obj_conv);
46118 }
46119
46120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1new(JNIEnv *env, jclass clz, int8_tArray key_material) {
46121         uint8_t key_material_arr[32];
46122         CHECK((*env)->GetArrayLength(env, key_material) == 32);
46123         (*env)->GetByteArrayRegion(env, key_material, 0, 32, key_material_arr);
46124         uint8_t (*key_material_ref)[32] = &key_material_arr;
46125         LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
46126         int64_t ret_ref = 0;
46127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46128         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46129         return ret_ref;
46130 }
46131
46132 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) {
46133         LDKExpandedKey keys_conv;
46134         keys_conv.inner = untag_ptr(keys);
46135         keys_conv.is_owned = ptr_is_owned(keys);
46136         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
46137         keys_conv.is_owned = false;
46138         void* min_value_msat_ptr = untag_ptr(min_value_msat);
46139         CHECK_ACCESS(min_value_msat_ptr);
46140         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
46141         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
46142         void* entropy_source_ptr = untag_ptr(entropy_source);
46143         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
46144         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
46145         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
46146         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
46147         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
46148         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
46149         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
46150         *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, entropy_source_conv, current_time, min_final_cltv_expiry_delta_conv);
46151         return tag_ptr(ret_conv, true);
46152 }
46153
46154 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) {
46155         LDKExpandedKey keys_conv;
46156         keys_conv.inner = untag_ptr(keys);
46157         keys_conv.is_owned = ptr_is_owned(keys);
46158         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
46159         keys_conv.is_owned = false;
46160         void* min_value_msat_ptr = untag_ptr(min_value_msat);
46161         CHECK_ACCESS(min_value_msat_ptr);
46162         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
46163         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
46164         LDKThirtyTwoBytes payment_hash_ref;
46165         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
46166         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
46167         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
46168         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
46169         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
46170         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
46171         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
46172         *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);
46173         return tag_ptr(ret_conv, true);
46174 }
46175
46176 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
46177         if (!ptr_is_owned(this_ptr)) return;
46178         void* this_ptr_ptr = untag_ptr(this_ptr);
46179         CHECK_ACCESS(this_ptr_ptr);
46180         LDKDecodeError this_ptr_conv = *(LDKDecodeError*)(this_ptr_ptr);
46181         FREE(untag_ptr(this_ptr));
46182         DecodeError_free(this_ptr_conv);
46183 }
46184
46185 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
46186         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
46187         *ret_copy = DecodeError_clone(arg);
46188         int64_t ret_ref = tag_ptr(ret_copy, true);
46189         return ret_ref;
46190 }
46191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46192         LDKDecodeError* arg_conv = (LDKDecodeError*)untag_ptr(arg);
46193         int64_t ret_conv = DecodeError_clone_ptr(arg_conv);
46194         return ret_conv;
46195 }
46196
46197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46198         LDKDecodeError* orig_conv = (LDKDecodeError*)untag_ptr(orig);
46199         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
46200         *ret_copy = DecodeError_clone(orig_conv);
46201         int64_t ret_ref = tag_ptr(ret_copy, true);
46202         return ret_ref;
46203 }
46204
46205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1unknown_1version(JNIEnv *env, jclass clz) {
46206         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
46207         *ret_copy = DecodeError_unknown_version();
46208         int64_t ret_ref = tag_ptr(ret_copy, true);
46209         return ret_ref;
46210 }
46211
46212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1unknown_1required_1feature(JNIEnv *env, jclass clz) {
46213         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
46214         *ret_copy = DecodeError_unknown_required_feature();
46215         int64_t ret_ref = tag_ptr(ret_copy, true);
46216         return ret_ref;
46217 }
46218
46219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1invalid_1value(JNIEnv *env, jclass clz) {
46220         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
46221         *ret_copy = DecodeError_invalid_value();
46222         int64_t ret_ref = tag_ptr(ret_copy, true);
46223         return ret_ref;
46224 }
46225
46226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1short_1read(JNIEnv *env, jclass clz) {
46227         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
46228         *ret_copy = DecodeError_short_read();
46229         int64_t ret_ref = tag_ptr(ret_copy, true);
46230         return ret_ref;
46231 }
46232
46233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1bad_1length_1descriptor(JNIEnv *env, jclass clz) {
46234         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
46235         *ret_copy = DecodeError_bad_length_descriptor();
46236         int64_t ret_ref = tag_ptr(ret_copy, true);
46237         return ret_ref;
46238 }
46239
46240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1io(JNIEnv *env, jclass clz, jclass a) {
46241         LDKIOError a_conv = LDKIOError_from_java(env, a);
46242         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
46243         *ret_copy = DecodeError_io(a_conv);
46244         int64_t ret_ref = tag_ptr(ret_copy, true);
46245         return ret_ref;
46246 }
46247
46248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1unsupported_1compression(JNIEnv *env, jclass clz) {
46249         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
46250         *ret_copy = DecodeError_unsupported_compression();
46251         int64_t ret_ref = tag_ptr(ret_copy, true);
46252         return ret_ref;
46253 }
46254
46255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1hash(JNIEnv *env, jclass clz, int64_t o) {
46256         LDKDecodeError* o_conv = (LDKDecodeError*)untag_ptr(o);
46257         int64_t ret_conv = DecodeError_hash(o_conv);
46258         return ret_conv;
46259 }
46260
46261 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DecodeError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46262         LDKDecodeError* a_conv = (LDKDecodeError*)untag_ptr(a);
46263         LDKDecodeError* b_conv = (LDKDecodeError*)untag_ptr(b);
46264         jboolean ret_conv = DecodeError_eq(a_conv, b_conv);
46265         return ret_conv;
46266 }
46267
46268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46269         LDKInit this_obj_conv;
46270         this_obj_conv.inner = untag_ptr(this_obj);
46271         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46273         Init_free(this_obj_conv);
46274 }
46275
46276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
46277         LDKInit this_ptr_conv;
46278         this_ptr_conv.inner = untag_ptr(this_ptr);
46279         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46281         this_ptr_conv.is_owned = false;
46282         LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
46283         int64_t ret_ref = 0;
46284         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46285         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46286         return ret_ref;
46287 }
46288
46289 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46290         LDKInit this_ptr_conv;
46291         this_ptr_conv.inner = untag_ptr(this_ptr);
46292         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46294         this_ptr_conv.is_owned = false;
46295         LDKInitFeatures val_conv;
46296         val_conv.inner = untag_ptr(val);
46297         val_conv.is_owned = ptr_is_owned(val);
46298         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46299         val_conv = InitFeatures_clone(&val_conv);
46300         Init_set_features(&this_ptr_conv, val_conv);
46301 }
46302
46303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1networks(JNIEnv *env, jclass clz, int64_t this_ptr) {
46304         LDKInit this_ptr_conv;
46305         this_ptr_conv.inner = untag_ptr(this_ptr);
46306         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46308         this_ptr_conv.is_owned = false;
46309         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
46310         *ret_copy = Init_get_networks(&this_ptr_conv);
46311         int64_t ret_ref = tag_ptr(ret_copy, true);
46312         return ret_ref;
46313 }
46314
46315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1networks(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46316         LDKInit this_ptr_conv;
46317         this_ptr_conv.inner = untag_ptr(this_ptr);
46318         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46320         this_ptr_conv.is_owned = false;
46321         void* val_ptr = untag_ptr(val);
46322         CHECK_ACCESS(val_ptr);
46323         LDKCOption_CVec_ThirtyTwoBytesZZ val_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(val_ptr);
46324         val_conv = COption_CVec_ThirtyTwoBytesZZ_clone((LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(val));
46325         Init_set_networks(&this_ptr_conv, val_conv);
46326 }
46327
46328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr) {
46329         LDKInit this_ptr_conv;
46330         this_ptr_conv.inner = untag_ptr(this_ptr);
46331         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46333         this_ptr_conv.is_owned = false;
46334         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
46335         *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
46336         int64_t ret_ref = tag_ptr(ret_copy, true);
46337         return ret_ref;
46338 }
46339
46340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46341         LDKInit this_ptr_conv;
46342         this_ptr_conv.inner = untag_ptr(this_ptr);
46343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46345         this_ptr_conv.is_owned = false;
46346         void* val_ptr = untag_ptr(val);
46347         CHECK_ACCESS(val_ptr);
46348         LDKCOption_SocketAddressZ val_conv = *(LDKCOption_SocketAddressZ*)(val_ptr);
46349         val_conv = COption_SocketAddressZ_clone((LDKCOption_SocketAddressZ*)untag_ptr(val));
46350         Init_set_remote_network_address(&this_ptr_conv, val_conv);
46351 }
46352
46353 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) {
46354         LDKInitFeatures features_arg_conv;
46355         features_arg_conv.inner = untag_ptr(features_arg);
46356         features_arg_conv.is_owned = ptr_is_owned(features_arg);
46357         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
46358         features_arg_conv = InitFeatures_clone(&features_arg_conv);
46359         void* networks_arg_ptr = untag_ptr(networks_arg);
46360         CHECK_ACCESS(networks_arg_ptr);
46361         LDKCOption_CVec_ThirtyTwoBytesZZ networks_arg_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(networks_arg_ptr);
46362         networks_arg_conv = COption_CVec_ThirtyTwoBytesZZ_clone((LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(networks_arg));
46363         void* remote_network_address_arg_ptr = untag_ptr(remote_network_address_arg);
46364         CHECK_ACCESS(remote_network_address_arg_ptr);
46365         LDKCOption_SocketAddressZ remote_network_address_arg_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_arg_ptr);
46366         LDKInit ret_var = Init_new(features_arg_conv, networks_arg_conv, remote_network_address_arg_conv);
46367         int64_t ret_ref = 0;
46368         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46369         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46370         return ret_ref;
46371 }
46372
46373 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
46374         LDKInit ret_var = Init_clone(arg);
46375         int64_t ret_ref = 0;
46376         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46377         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46378         return ret_ref;
46379 }
46380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46381         LDKInit arg_conv;
46382         arg_conv.inner = untag_ptr(arg);
46383         arg_conv.is_owned = ptr_is_owned(arg);
46384         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46385         arg_conv.is_owned = false;
46386         int64_t ret_conv = Init_clone_ptr(&arg_conv);
46387         return ret_conv;
46388 }
46389
46390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46391         LDKInit orig_conv;
46392         orig_conv.inner = untag_ptr(orig);
46393         orig_conv.is_owned = ptr_is_owned(orig);
46394         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46395         orig_conv.is_owned = false;
46396         LDKInit ret_var = Init_clone(&orig_conv);
46397         int64_t ret_ref = 0;
46398         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46399         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46400         return ret_ref;
46401 }
46402
46403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1hash(JNIEnv *env, jclass clz, int64_t o) {
46404         LDKInit o_conv;
46405         o_conv.inner = untag_ptr(o);
46406         o_conv.is_owned = ptr_is_owned(o);
46407         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46408         o_conv.is_owned = false;
46409         int64_t ret_conv = Init_hash(&o_conv);
46410         return ret_conv;
46411 }
46412
46413 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Init_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46414         LDKInit a_conv;
46415         a_conv.inner = untag_ptr(a);
46416         a_conv.is_owned = ptr_is_owned(a);
46417         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46418         a_conv.is_owned = false;
46419         LDKInit b_conv;
46420         b_conv.inner = untag_ptr(b);
46421         b_conv.is_owned = ptr_is_owned(b);
46422         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46423         b_conv.is_owned = false;
46424         jboolean ret_conv = Init_eq(&a_conv, &b_conv);
46425         return ret_conv;
46426 }
46427
46428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46429         LDKErrorMessage this_obj_conv;
46430         this_obj_conv.inner = untag_ptr(this_obj);
46431         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46433         ErrorMessage_free(this_obj_conv);
46434 }
46435
46436 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46437         LDKErrorMessage this_ptr_conv;
46438         this_ptr_conv.inner = untag_ptr(this_ptr);
46439         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46441         this_ptr_conv.is_owned = false;
46442         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46443         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
46444         return ret_arr;
46445 }
46446
46447 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46448         LDKErrorMessage this_ptr_conv;
46449         this_ptr_conv.inner = untag_ptr(this_ptr);
46450         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46452         this_ptr_conv.is_owned = false;
46453         LDKThirtyTwoBytes val_ref;
46454         CHECK((*env)->GetArrayLength(env, val) == 32);
46455         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46456         ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
46457 }
46458
46459 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
46460         LDKErrorMessage this_ptr_conv;
46461         this_ptr_conv.inner = untag_ptr(this_ptr);
46462         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46464         this_ptr_conv.is_owned = false;
46465         LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
46466         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
46467         Str_free(ret_str);
46468         return ret_conv;
46469 }
46470
46471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
46472         LDKErrorMessage this_ptr_conv;
46473         this_ptr_conv.inner = untag_ptr(this_ptr);
46474         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46476         this_ptr_conv.is_owned = false;
46477         LDKStr val_conv = java_to_owned_str(env, val);
46478         ErrorMessage_set_data(&this_ptr_conv, val_conv);
46479 }
46480
46481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
46482         LDKThirtyTwoBytes channel_id_arg_ref;
46483         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
46484         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
46485         LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
46486         LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
46487         int64_t ret_ref = 0;
46488         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46489         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46490         return ret_ref;
46491 }
46492
46493 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
46494         LDKErrorMessage ret_var = ErrorMessage_clone(arg);
46495         int64_t ret_ref = 0;
46496         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46497         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46498         return ret_ref;
46499 }
46500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46501         LDKErrorMessage arg_conv;
46502         arg_conv.inner = untag_ptr(arg);
46503         arg_conv.is_owned = ptr_is_owned(arg);
46504         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46505         arg_conv.is_owned = false;
46506         int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
46507         return ret_conv;
46508 }
46509
46510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46511         LDKErrorMessage orig_conv;
46512         orig_conv.inner = untag_ptr(orig);
46513         orig_conv.is_owned = ptr_is_owned(orig);
46514         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46515         orig_conv.is_owned = false;
46516         LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
46517         int64_t ret_ref = 0;
46518         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46519         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46520         return ret_ref;
46521 }
46522
46523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1hash(JNIEnv *env, jclass clz, int64_t o) {
46524         LDKErrorMessage o_conv;
46525         o_conv.inner = untag_ptr(o);
46526         o_conv.is_owned = ptr_is_owned(o);
46527         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46528         o_conv.is_owned = false;
46529         int64_t ret_conv = ErrorMessage_hash(&o_conv);
46530         return ret_conv;
46531 }
46532
46533 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46534         LDKErrorMessage a_conv;
46535         a_conv.inner = untag_ptr(a);
46536         a_conv.is_owned = ptr_is_owned(a);
46537         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46538         a_conv.is_owned = false;
46539         LDKErrorMessage b_conv;
46540         b_conv.inner = untag_ptr(b);
46541         b_conv.is_owned = ptr_is_owned(b);
46542         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46543         b_conv.is_owned = false;
46544         jboolean ret_conv = ErrorMessage_eq(&a_conv, &b_conv);
46545         return ret_conv;
46546 }
46547
46548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46549         LDKWarningMessage this_obj_conv;
46550         this_obj_conv.inner = untag_ptr(this_obj);
46551         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46553         WarningMessage_free(this_obj_conv);
46554 }
46555
46556 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46557         LDKWarningMessage this_ptr_conv;
46558         this_ptr_conv.inner = untag_ptr(this_ptr);
46559         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46561         this_ptr_conv.is_owned = false;
46562         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46563         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *WarningMessage_get_channel_id(&this_ptr_conv));
46564         return ret_arr;
46565 }
46566
46567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46568         LDKWarningMessage this_ptr_conv;
46569         this_ptr_conv.inner = untag_ptr(this_ptr);
46570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46572         this_ptr_conv.is_owned = false;
46573         LDKThirtyTwoBytes val_ref;
46574         CHECK((*env)->GetArrayLength(env, val) == 32);
46575         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46576         WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
46577 }
46578
46579 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
46580         LDKWarningMessage this_ptr_conv;
46581         this_ptr_conv.inner = untag_ptr(this_ptr);
46582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46584         this_ptr_conv.is_owned = false;
46585         LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
46586         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
46587         Str_free(ret_str);
46588         return ret_conv;
46589 }
46590
46591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
46592         LDKWarningMessage this_ptr_conv;
46593         this_ptr_conv.inner = untag_ptr(this_ptr);
46594         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46596         this_ptr_conv.is_owned = false;
46597         LDKStr val_conv = java_to_owned_str(env, val);
46598         WarningMessage_set_data(&this_ptr_conv, val_conv);
46599 }
46600
46601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
46602         LDKThirtyTwoBytes channel_id_arg_ref;
46603         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
46604         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
46605         LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
46606         LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
46607         int64_t ret_ref = 0;
46608         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46609         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46610         return ret_ref;
46611 }
46612
46613 static inline uint64_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
46614         LDKWarningMessage ret_var = WarningMessage_clone(arg);
46615         int64_t ret_ref = 0;
46616         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46617         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46618         return ret_ref;
46619 }
46620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46621         LDKWarningMessage arg_conv;
46622         arg_conv.inner = untag_ptr(arg);
46623         arg_conv.is_owned = ptr_is_owned(arg);
46624         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46625         arg_conv.is_owned = false;
46626         int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
46627         return ret_conv;
46628 }
46629
46630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46631         LDKWarningMessage orig_conv;
46632         orig_conv.inner = untag_ptr(orig);
46633         orig_conv.is_owned = ptr_is_owned(orig);
46634         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46635         orig_conv.is_owned = false;
46636         LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
46637         int64_t ret_ref = 0;
46638         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46639         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46640         return ret_ref;
46641 }
46642
46643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1hash(JNIEnv *env, jclass clz, int64_t o) {
46644         LDKWarningMessage o_conv;
46645         o_conv.inner = untag_ptr(o);
46646         o_conv.is_owned = ptr_is_owned(o);
46647         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46648         o_conv.is_owned = false;
46649         int64_t ret_conv = WarningMessage_hash(&o_conv);
46650         return ret_conv;
46651 }
46652
46653 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_WarningMessage_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46654         LDKWarningMessage a_conv;
46655         a_conv.inner = untag_ptr(a);
46656         a_conv.is_owned = ptr_is_owned(a);
46657         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46658         a_conv.is_owned = false;
46659         LDKWarningMessage b_conv;
46660         b_conv.inner = untag_ptr(b);
46661         b_conv.is_owned = ptr_is_owned(b);
46662         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46663         b_conv.is_owned = false;
46664         jboolean ret_conv = WarningMessage_eq(&a_conv, &b_conv);
46665         return ret_conv;
46666 }
46667
46668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46669         LDKPing this_obj_conv;
46670         this_obj_conv.inner = untag_ptr(this_obj);
46671         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46673         Ping_free(this_obj_conv);
46674 }
46675
46676 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
46677         LDKPing this_ptr_conv;
46678         this_ptr_conv.inner = untag_ptr(this_ptr);
46679         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46681         this_ptr_conv.is_owned = false;
46682         int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
46683         return ret_conv;
46684 }
46685
46686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
46687         LDKPing this_ptr_conv;
46688         this_ptr_conv.inner = untag_ptr(this_ptr);
46689         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46691         this_ptr_conv.is_owned = false;
46692         Ping_set_ponglen(&this_ptr_conv, val);
46693 }
46694
46695 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
46696         LDKPing this_ptr_conv;
46697         this_ptr_conv.inner = untag_ptr(this_ptr);
46698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46700         this_ptr_conv.is_owned = false;
46701         int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
46702         return ret_conv;
46703 }
46704
46705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
46706         LDKPing 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         Ping_set_byteslen(&this_ptr_conv, val);
46712 }
46713
46714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
46715         LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
46716         int64_t ret_ref = 0;
46717         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46718         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46719         return ret_ref;
46720 }
46721
46722 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
46723         LDKPing ret_var = Ping_clone(arg);
46724         int64_t ret_ref = 0;
46725         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46726         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46727         return ret_ref;
46728 }
46729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46730         LDKPing arg_conv;
46731         arg_conv.inner = untag_ptr(arg);
46732         arg_conv.is_owned = ptr_is_owned(arg);
46733         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46734         arg_conv.is_owned = false;
46735         int64_t ret_conv = Ping_clone_ptr(&arg_conv);
46736         return ret_conv;
46737 }
46738
46739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46740         LDKPing orig_conv;
46741         orig_conv.inner = untag_ptr(orig);
46742         orig_conv.is_owned = ptr_is_owned(orig);
46743         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46744         orig_conv.is_owned = false;
46745         LDKPing ret_var = Ping_clone(&orig_conv);
46746         int64_t ret_ref = 0;
46747         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46748         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46749         return ret_ref;
46750 }
46751
46752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1hash(JNIEnv *env, jclass clz, int64_t o) {
46753         LDKPing o_conv;
46754         o_conv.inner = untag_ptr(o);
46755         o_conv.is_owned = ptr_is_owned(o);
46756         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46757         o_conv.is_owned = false;
46758         int64_t ret_conv = Ping_hash(&o_conv);
46759         return ret_conv;
46760 }
46761
46762 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Ping_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46763         LDKPing a_conv;
46764         a_conv.inner = untag_ptr(a);
46765         a_conv.is_owned = ptr_is_owned(a);
46766         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46767         a_conv.is_owned = false;
46768         LDKPing b_conv;
46769         b_conv.inner = untag_ptr(b);
46770         b_conv.is_owned = ptr_is_owned(b);
46771         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46772         b_conv.is_owned = false;
46773         jboolean ret_conv = Ping_eq(&a_conv, &b_conv);
46774         return ret_conv;
46775 }
46776
46777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46778         LDKPong this_obj_conv;
46779         this_obj_conv.inner = untag_ptr(this_obj);
46780         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46782         Pong_free(this_obj_conv);
46783 }
46784
46785 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
46786         LDKPong this_ptr_conv;
46787         this_ptr_conv.inner = untag_ptr(this_ptr);
46788         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46790         this_ptr_conv.is_owned = false;
46791         int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
46792         return ret_conv;
46793 }
46794
46795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
46796         LDKPong this_ptr_conv;
46797         this_ptr_conv.inner = untag_ptr(this_ptr);
46798         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46800         this_ptr_conv.is_owned = false;
46801         Pong_set_byteslen(&this_ptr_conv, val);
46802 }
46803
46804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
46805         LDKPong ret_var = Pong_new(byteslen_arg);
46806         int64_t ret_ref = 0;
46807         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46808         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46809         return ret_ref;
46810 }
46811
46812 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
46813         LDKPong ret_var = Pong_clone(arg);
46814         int64_t ret_ref = 0;
46815         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46816         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46817         return ret_ref;
46818 }
46819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46820         LDKPong arg_conv;
46821         arg_conv.inner = untag_ptr(arg);
46822         arg_conv.is_owned = ptr_is_owned(arg);
46823         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46824         arg_conv.is_owned = false;
46825         int64_t ret_conv = Pong_clone_ptr(&arg_conv);
46826         return ret_conv;
46827 }
46828
46829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46830         LDKPong orig_conv;
46831         orig_conv.inner = untag_ptr(orig);
46832         orig_conv.is_owned = ptr_is_owned(orig);
46833         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46834         orig_conv.is_owned = false;
46835         LDKPong ret_var = Pong_clone(&orig_conv);
46836         int64_t ret_ref = 0;
46837         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46838         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46839         return ret_ref;
46840 }
46841
46842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1hash(JNIEnv *env, jclass clz, int64_t o) {
46843         LDKPong o_conv;
46844         o_conv.inner = untag_ptr(o);
46845         o_conv.is_owned = ptr_is_owned(o);
46846         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46847         o_conv.is_owned = false;
46848         int64_t ret_conv = Pong_hash(&o_conv);
46849         return ret_conv;
46850 }
46851
46852 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Pong_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46853         LDKPong a_conv;
46854         a_conv.inner = untag_ptr(a);
46855         a_conv.is_owned = ptr_is_owned(a);
46856         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46857         a_conv.is_owned = false;
46858         LDKPong b_conv;
46859         b_conv.inner = untag_ptr(b);
46860         b_conv.is_owned = ptr_is_owned(b);
46861         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46862         b_conv.is_owned = false;
46863         jboolean ret_conv = Pong_eq(&a_conv, &b_conv);
46864         return ret_conv;
46865 }
46866
46867 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46868         LDKOpenChannel this_obj_conv;
46869         this_obj_conv.inner = untag_ptr(this_obj);
46870         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46872         OpenChannel_free(this_obj_conv);
46873 }
46874
46875 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
46876         LDKOpenChannel this_ptr_conv;
46877         this_ptr_conv.inner = untag_ptr(this_ptr);
46878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46880         this_ptr_conv.is_owned = false;
46881         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46882         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
46883         return ret_arr;
46884 }
46885
46886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46887         LDKOpenChannel this_ptr_conv;
46888         this_ptr_conv.inner = untag_ptr(this_ptr);
46889         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46891         this_ptr_conv.is_owned = false;
46892         LDKThirtyTwoBytes val_ref;
46893         CHECK((*env)->GetArrayLength(env, val) == 32);
46894         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46895         OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
46896 }
46897
46898 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46899         LDKOpenChannel this_ptr_conv;
46900         this_ptr_conv.inner = untag_ptr(this_ptr);
46901         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46903         this_ptr_conv.is_owned = false;
46904         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46905         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
46906         return ret_arr;
46907 }
46908
46909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46910         LDKOpenChannel this_ptr_conv;
46911         this_ptr_conv.inner = untag_ptr(this_ptr);
46912         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46914         this_ptr_conv.is_owned = false;
46915         LDKThirtyTwoBytes val_ref;
46916         CHECK((*env)->GetArrayLength(env, val) == 32);
46917         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46918         OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
46919 }
46920
46921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
46922         LDKOpenChannel this_ptr_conv;
46923         this_ptr_conv.inner = untag_ptr(this_ptr);
46924         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46926         this_ptr_conv.is_owned = false;
46927         int64_t ret_conv = OpenChannel_get_funding_satoshis(&this_ptr_conv);
46928         return ret_conv;
46929 }
46930
46931 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46932         LDKOpenChannel this_ptr_conv;
46933         this_ptr_conv.inner = untag_ptr(this_ptr);
46934         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46936         this_ptr_conv.is_owned = false;
46937         OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
46938 }
46939
46940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46941         LDKOpenChannel this_ptr_conv;
46942         this_ptr_conv.inner = untag_ptr(this_ptr);
46943         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46945         this_ptr_conv.is_owned = false;
46946         int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
46947         return ret_conv;
46948 }
46949
46950 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46951         LDKOpenChannel this_ptr_conv;
46952         this_ptr_conv.inner = untag_ptr(this_ptr);
46953         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46955         this_ptr_conv.is_owned = false;
46956         OpenChannel_set_push_msat(&this_ptr_conv, val);
46957 }
46958
46959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
46960         LDKOpenChannel this_ptr_conv;
46961         this_ptr_conv.inner = untag_ptr(this_ptr);
46962         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46964         this_ptr_conv.is_owned = false;
46965         int64_t ret_conv = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
46966         return ret_conv;
46967 }
46968
46969 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46970         LDKOpenChannel 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         OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
46976 }
46977
46978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46979         LDKOpenChannel this_ptr_conv;
46980         this_ptr_conv.inner = untag_ptr(this_ptr);
46981         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46983         this_ptr_conv.is_owned = false;
46984         int64_t ret_conv = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
46985         return ret_conv;
46986 }
46987
46988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46989         LDKOpenChannel this_ptr_conv;
46990         this_ptr_conv.inner = untag_ptr(this_ptr);
46991         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46993         this_ptr_conv.is_owned = false;
46994         OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
46995 }
46996
46997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
46998         LDKOpenChannel this_ptr_conv;
46999         this_ptr_conv.inner = untag_ptr(this_ptr);
47000         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47002         this_ptr_conv.is_owned = false;
47003         int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
47004         return ret_conv;
47005 }
47006
47007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47008         LDKOpenChannel this_ptr_conv;
47009         this_ptr_conv.inner = untag_ptr(this_ptr);
47010         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47012         this_ptr_conv.is_owned = false;
47013         OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
47014 }
47015
47016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
47017         LDKOpenChannel this_ptr_conv;
47018         this_ptr_conv.inner = untag_ptr(this_ptr);
47019         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47021         this_ptr_conv.is_owned = false;
47022         int64_t ret_conv = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
47023         return ret_conv;
47024 }
47025
47026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47027         LDKOpenChannel this_ptr_conv;
47028         this_ptr_conv.inner = untag_ptr(this_ptr);
47029         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47031         this_ptr_conv.is_owned = false;
47032         OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
47033 }
47034
47035 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
47036         LDKOpenChannel this_ptr_conv;
47037         this_ptr_conv.inner = untag_ptr(this_ptr);
47038         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47040         this_ptr_conv.is_owned = false;
47041         int32_t ret_conv = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
47042         return ret_conv;
47043 }
47044
47045 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
47046         LDKOpenChannel this_ptr_conv;
47047         this_ptr_conv.inner = untag_ptr(this_ptr);
47048         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47050         this_ptr_conv.is_owned = false;
47051         OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
47052 }
47053
47054 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
47055         LDKOpenChannel this_ptr_conv;
47056         this_ptr_conv.inner = untag_ptr(this_ptr);
47057         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47059         this_ptr_conv.is_owned = false;
47060         int16_t ret_conv = OpenChannel_get_to_self_delay(&this_ptr_conv);
47061         return ret_conv;
47062 }
47063
47064 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
47065         LDKOpenChannel this_ptr_conv;
47066         this_ptr_conv.inner = untag_ptr(this_ptr);
47067         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47069         this_ptr_conv.is_owned = false;
47070         OpenChannel_set_to_self_delay(&this_ptr_conv, val);
47071 }
47072
47073 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
47074         LDKOpenChannel this_ptr_conv;
47075         this_ptr_conv.inner = untag_ptr(this_ptr);
47076         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47078         this_ptr_conv.is_owned = false;
47079         int16_t ret_conv = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
47080         return ret_conv;
47081 }
47082
47083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
47084         LDKOpenChannel this_ptr_conv;
47085         this_ptr_conv.inner = untag_ptr(this_ptr);
47086         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47088         this_ptr_conv.is_owned = false;
47089         OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
47090 }
47091
47092 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
47093         LDKOpenChannel this_ptr_conv;
47094         this_ptr_conv.inner = untag_ptr(this_ptr);
47095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47097         this_ptr_conv.is_owned = false;
47098         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
47099         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
47100         return ret_arr;
47101 }
47102
47103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47104         LDKOpenChannel this_ptr_conv;
47105         this_ptr_conv.inner = untag_ptr(this_ptr);
47106         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47108         this_ptr_conv.is_owned = false;
47109         LDKPublicKey val_ref;
47110         CHECK((*env)->GetArrayLength(env, val) == 33);
47111         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
47112         OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
47113 }
47114
47115 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
47116         LDKOpenChannel this_ptr_conv;
47117         this_ptr_conv.inner = untag_ptr(this_ptr);
47118         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47120         this_ptr_conv.is_owned = false;
47121         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
47122         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
47123         return ret_arr;
47124 }
47125
47126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47127         LDKOpenChannel this_ptr_conv;
47128         this_ptr_conv.inner = untag_ptr(this_ptr);
47129         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47131         this_ptr_conv.is_owned = false;
47132         LDKPublicKey val_ref;
47133         CHECK((*env)->GetArrayLength(env, val) == 33);
47134         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
47135         OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
47136 }
47137
47138 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
47139         LDKOpenChannel this_ptr_conv;
47140         this_ptr_conv.inner = untag_ptr(this_ptr);
47141         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47143         this_ptr_conv.is_owned = false;
47144         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
47145         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
47146         return ret_arr;
47147 }
47148
47149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47150         LDKOpenChannel 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         LDKPublicKey val_ref;
47156         CHECK((*env)->GetArrayLength(env, val) == 33);
47157         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
47158         OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
47159 }
47160
47161 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
47162         LDKOpenChannel this_ptr_conv;
47163         this_ptr_conv.inner = untag_ptr(this_ptr);
47164         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47166         this_ptr_conv.is_owned = false;
47167         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
47168         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
47169         return ret_arr;
47170 }
47171
47172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47173         LDKOpenChannel this_ptr_conv;
47174         this_ptr_conv.inner = untag_ptr(this_ptr);
47175         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47177         this_ptr_conv.is_owned = false;
47178         LDKPublicKey val_ref;
47179         CHECK((*env)->GetArrayLength(env, val) == 33);
47180         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
47181         OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
47182 }
47183
47184 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
47185         LDKOpenChannel this_ptr_conv;
47186         this_ptr_conv.inner = untag_ptr(this_ptr);
47187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47189         this_ptr_conv.is_owned = false;
47190         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
47191         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
47192         return ret_arr;
47193 }
47194
47195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47196         LDKOpenChannel this_ptr_conv;
47197         this_ptr_conv.inner = untag_ptr(this_ptr);
47198         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47200         this_ptr_conv.is_owned = false;
47201         LDKPublicKey val_ref;
47202         CHECK((*env)->GetArrayLength(env, val) == 33);
47203         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
47204         OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
47205 }
47206
47207 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
47208         LDKOpenChannel this_ptr_conv;
47209         this_ptr_conv.inner = untag_ptr(this_ptr);
47210         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47212         this_ptr_conv.is_owned = false;
47213         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
47214         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
47215         return ret_arr;
47216 }
47217
47218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47219         LDKOpenChannel 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         LDKPublicKey val_ref;
47225         CHECK((*env)->GetArrayLength(env, val) == 33);
47226         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
47227         OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
47228 }
47229
47230 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
47231         LDKOpenChannel this_ptr_conv;
47232         this_ptr_conv.inner = untag_ptr(this_ptr);
47233         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47235         this_ptr_conv.is_owned = false;
47236         int8_t ret_conv = OpenChannel_get_channel_flags(&this_ptr_conv);
47237         return ret_conv;
47238 }
47239
47240 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
47241         LDKOpenChannel this_ptr_conv;
47242         this_ptr_conv.inner = untag_ptr(this_ptr);
47243         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47245         this_ptr_conv.is_owned = false;
47246         OpenChannel_set_channel_flags(&this_ptr_conv, val);
47247 }
47248
47249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
47250         LDKOpenChannel this_ptr_conv;
47251         this_ptr_conv.inner = untag_ptr(this_ptr);
47252         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47254         this_ptr_conv.is_owned = false;
47255         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
47256         *ret_copy = OpenChannel_get_shutdown_scriptpubkey(&this_ptr_conv);
47257         int64_t ret_ref = tag_ptr(ret_copy, true);
47258         return ret_ref;
47259 }
47260
47261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47262         LDKOpenChannel this_ptr_conv;
47263         this_ptr_conv.inner = untag_ptr(this_ptr);
47264         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47266         this_ptr_conv.is_owned = false;
47267         void* val_ptr = untag_ptr(val);
47268         CHECK_ACCESS(val_ptr);
47269         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
47270         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
47271         OpenChannel_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
47272 }
47273
47274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
47275         LDKOpenChannel this_ptr_conv;
47276         this_ptr_conv.inner = untag_ptr(this_ptr);
47277         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47279         this_ptr_conv.is_owned = false;
47280         LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
47281         int64_t ret_ref = 0;
47282         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47283         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47284         return ret_ref;
47285 }
47286
47287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47288         LDKOpenChannel this_ptr_conv;
47289         this_ptr_conv.inner = untag_ptr(this_ptr);
47290         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47292         this_ptr_conv.is_owned = false;
47293         LDKChannelTypeFeatures val_conv;
47294         val_conv.inner = untag_ptr(val);
47295         val_conv.is_owned = ptr_is_owned(val);
47296         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47297         val_conv = ChannelTypeFeatures_clone(&val_conv);
47298         OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
47299 }
47300
47301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, int8_tArray temporary_channel_id_arg, int64_t funding_satoshis_arg, int64_t push_msat_arg, int64_t dust_limit_satoshis_arg, int64_t max_htlc_value_in_flight_msat_arg, int64_t channel_reserve_satoshis_arg, int64_t htlc_minimum_msat_arg, int32_t feerate_per_kw_arg, int16_t to_self_delay_arg, int16_t max_accepted_htlcs_arg, int8_tArray funding_pubkey_arg, int8_tArray revocation_basepoint_arg, int8_tArray payment_point_arg, int8_tArray delayed_payment_basepoint_arg, int8_tArray htlc_basepoint_arg, int8_tArray first_per_commitment_point_arg, int8_t channel_flags_arg, int64_t shutdown_scriptpubkey_arg, int64_t channel_type_arg) {
47302         LDKThirtyTwoBytes chain_hash_arg_ref;
47303         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
47304         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
47305         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
47306         CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
47307         (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
47308         LDKPublicKey funding_pubkey_arg_ref;
47309         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
47310         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
47311         LDKPublicKey revocation_basepoint_arg_ref;
47312         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
47313         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
47314         LDKPublicKey payment_point_arg_ref;
47315         CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
47316         (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
47317         LDKPublicKey delayed_payment_basepoint_arg_ref;
47318         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
47319         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
47320         LDKPublicKey htlc_basepoint_arg_ref;
47321         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
47322         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
47323         LDKPublicKey first_per_commitment_point_arg_ref;
47324         CHECK((*env)->GetArrayLength(env, first_per_commitment_point_arg) == 33);
47325         (*env)->GetByteArrayRegion(env, first_per_commitment_point_arg, 0, 33, first_per_commitment_point_arg_ref.compressed_form);
47326         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
47327         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
47328         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
47329         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
47330         LDKChannelTypeFeatures channel_type_arg_conv;
47331         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
47332         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
47333         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
47334         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
47335         LDKOpenChannel ret_var = OpenChannel_new(chain_hash_arg_ref, temporary_channel_id_arg_ref, funding_satoshis_arg, push_msat_arg, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, channel_reserve_satoshis_arg, htlc_minimum_msat_arg, feerate_per_kw_arg, to_self_delay_arg, max_accepted_htlcs_arg, funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_point_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref, first_per_commitment_point_arg_ref, channel_flags_arg, shutdown_scriptpubkey_arg_conv, channel_type_arg_conv);
47336         int64_t ret_ref = 0;
47337         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47338         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47339         return ret_ref;
47340 }
47341
47342 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
47343         LDKOpenChannel ret_var = OpenChannel_clone(arg);
47344         int64_t ret_ref = 0;
47345         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47346         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47347         return ret_ref;
47348 }
47349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47350         LDKOpenChannel arg_conv;
47351         arg_conv.inner = untag_ptr(arg);
47352         arg_conv.is_owned = ptr_is_owned(arg);
47353         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47354         arg_conv.is_owned = false;
47355         int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
47356         return ret_conv;
47357 }
47358
47359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47360         LDKOpenChannel orig_conv;
47361         orig_conv.inner = untag_ptr(orig);
47362         orig_conv.is_owned = ptr_is_owned(orig);
47363         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47364         orig_conv.is_owned = false;
47365         LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
47366         int64_t ret_ref = 0;
47367         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47368         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47369         return ret_ref;
47370 }
47371
47372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1hash(JNIEnv *env, jclass clz, int64_t o) {
47373         LDKOpenChannel o_conv;
47374         o_conv.inner = untag_ptr(o);
47375         o_conv.is_owned = ptr_is_owned(o);
47376         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47377         o_conv.is_owned = false;
47378         int64_t ret_conv = OpenChannel_hash(&o_conv);
47379         return ret_conv;
47380 }
47381
47382 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OpenChannel_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47383         LDKOpenChannel a_conv;
47384         a_conv.inner = untag_ptr(a);
47385         a_conv.is_owned = ptr_is_owned(a);
47386         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47387         a_conv.is_owned = false;
47388         LDKOpenChannel b_conv;
47389         b_conv.inner = untag_ptr(b);
47390         b_conv.is_owned = ptr_is_owned(b);
47391         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47392         b_conv.is_owned = false;
47393         jboolean ret_conv = OpenChannel_eq(&a_conv, &b_conv);
47394         return ret_conv;
47395 }
47396
47397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47398         LDKOpenChannelV2 this_obj_conv;
47399         this_obj_conv.inner = untag_ptr(this_obj);
47400         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47402         OpenChannelV2_free(this_obj_conv);
47403 }
47404
47405 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
47406         LDKOpenChannelV2 this_ptr_conv;
47407         this_ptr_conv.inner = untag_ptr(this_ptr);
47408         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47410         this_ptr_conv.is_owned = false;
47411         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47412         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannelV2_get_chain_hash(&this_ptr_conv));
47413         return ret_arr;
47414 }
47415
47416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47417         LDKOpenChannelV2 this_ptr_conv;
47418         this_ptr_conv.inner = untag_ptr(this_ptr);
47419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47421         this_ptr_conv.is_owned = false;
47422         LDKThirtyTwoBytes val_ref;
47423         CHECK((*env)->GetArrayLength(env, val) == 32);
47424         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
47425         OpenChannelV2_set_chain_hash(&this_ptr_conv, val_ref);
47426 }
47427
47428 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
47429         LDKOpenChannelV2 this_ptr_conv;
47430         this_ptr_conv.inner = untag_ptr(this_ptr);
47431         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47433         this_ptr_conv.is_owned = false;
47434         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47435         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannelV2_get_temporary_channel_id(&this_ptr_conv));
47436         return ret_arr;
47437 }
47438
47439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47440         LDKOpenChannelV2 this_ptr_conv;
47441         this_ptr_conv.inner = untag_ptr(this_ptr);
47442         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47444         this_ptr_conv.is_owned = false;
47445         LDKThirtyTwoBytes val_ref;
47446         CHECK((*env)->GetArrayLength(env, val) == 32);
47447         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
47448         OpenChannelV2_set_temporary_channel_id(&this_ptr_conv, val_ref);
47449 }
47450
47451 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) {
47452         LDKOpenChannelV2 this_ptr_conv;
47453         this_ptr_conv.inner = untag_ptr(this_ptr);
47454         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47456         this_ptr_conv.is_owned = false;
47457         int32_t ret_conv = OpenChannelV2_get_funding_feerate_sat_per_1000_weight(&this_ptr_conv);
47458         return ret_conv;
47459 }
47460
47461 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) {
47462         LDKOpenChannelV2 this_ptr_conv;
47463         this_ptr_conv.inner = untag_ptr(this_ptr);
47464         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47466         this_ptr_conv.is_owned = false;
47467         OpenChannelV2_set_funding_feerate_sat_per_1000_weight(&this_ptr_conv, val);
47468 }
47469
47470 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1commitment_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
47471         LDKOpenChannelV2 this_ptr_conv;
47472         this_ptr_conv.inner = untag_ptr(this_ptr);
47473         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47475         this_ptr_conv.is_owned = false;
47476         int32_t ret_conv = OpenChannelV2_get_commitment_feerate_sat_per_1000_weight(&this_ptr_conv);
47477         return ret_conv;
47478 }
47479
47480 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1commitment_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
47481         LDKOpenChannelV2 this_ptr_conv;
47482         this_ptr_conv.inner = untag_ptr(this_ptr);
47483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47485         this_ptr_conv.is_owned = false;
47486         OpenChannelV2_set_commitment_feerate_sat_per_1000_weight(&this_ptr_conv, val);
47487 }
47488
47489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
47490         LDKOpenChannelV2 this_ptr_conv;
47491         this_ptr_conv.inner = untag_ptr(this_ptr);
47492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47494         this_ptr_conv.is_owned = false;
47495         int64_t ret_conv = OpenChannelV2_get_funding_satoshis(&this_ptr_conv);
47496         return ret_conv;
47497 }
47498
47499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47500         LDKOpenChannelV2 this_ptr_conv;
47501         this_ptr_conv.inner = untag_ptr(this_ptr);
47502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47504         this_ptr_conv.is_owned = false;
47505         OpenChannelV2_set_funding_satoshis(&this_ptr_conv, val);
47506 }
47507
47508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
47509         LDKOpenChannelV2 this_ptr_conv;
47510         this_ptr_conv.inner = untag_ptr(this_ptr);
47511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47513         this_ptr_conv.is_owned = false;
47514         int64_t ret_conv = OpenChannelV2_get_dust_limit_satoshis(&this_ptr_conv);
47515         return ret_conv;
47516 }
47517
47518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47519         LDKOpenChannelV2 this_ptr_conv;
47520         this_ptr_conv.inner = untag_ptr(this_ptr);
47521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47523         this_ptr_conv.is_owned = false;
47524         OpenChannelV2_set_dust_limit_satoshis(&this_ptr_conv, val);
47525 }
47526
47527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
47528         LDKOpenChannelV2 this_ptr_conv;
47529         this_ptr_conv.inner = untag_ptr(this_ptr);
47530         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47532         this_ptr_conv.is_owned = false;
47533         int64_t ret_conv = OpenChannelV2_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
47534         return ret_conv;
47535 }
47536
47537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47538         LDKOpenChannelV2 this_ptr_conv;
47539         this_ptr_conv.inner = untag_ptr(this_ptr);
47540         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47542         this_ptr_conv.is_owned = false;
47543         OpenChannelV2_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
47544 }
47545
47546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
47547         LDKOpenChannelV2 this_ptr_conv;
47548         this_ptr_conv.inner = untag_ptr(this_ptr);
47549         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47551         this_ptr_conv.is_owned = false;
47552         int64_t ret_conv = OpenChannelV2_get_htlc_minimum_msat(&this_ptr_conv);
47553         return ret_conv;
47554 }
47555
47556 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47557         LDKOpenChannelV2 this_ptr_conv;
47558         this_ptr_conv.inner = untag_ptr(this_ptr);
47559         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47561         this_ptr_conv.is_owned = false;
47562         OpenChannelV2_set_htlc_minimum_msat(&this_ptr_conv, val);
47563 }
47564
47565 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
47566         LDKOpenChannelV2 this_ptr_conv;
47567         this_ptr_conv.inner = untag_ptr(this_ptr);
47568         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47570         this_ptr_conv.is_owned = false;
47571         int16_t ret_conv = OpenChannelV2_get_to_self_delay(&this_ptr_conv);
47572         return ret_conv;
47573 }
47574
47575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
47576         LDKOpenChannelV2 this_ptr_conv;
47577         this_ptr_conv.inner = untag_ptr(this_ptr);
47578         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47580         this_ptr_conv.is_owned = false;
47581         OpenChannelV2_set_to_self_delay(&this_ptr_conv, val);
47582 }
47583
47584 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
47585         LDKOpenChannelV2 this_ptr_conv;
47586         this_ptr_conv.inner = untag_ptr(this_ptr);
47587         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47589         this_ptr_conv.is_owned = false;
47590         int16_t ret_conv = OpenChannelV2_get_max_accepted_htlcs(&this_ptr_conv);
47591         return ret_conv;
47592 }
47593
47594 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
47595         LDKOpenChannelV2 this_ptr_conv;
47596         this_ptr_conv.inner = untag_ptr(this_ptr);
47597         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47599         this_ptr_conv.is_owned = false;
47600         OpenChannelV2_set_max_accepted_htlcs(&this_ptr_conv, val);
47601 }
47602
47603 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr) {
47604         LDKOpenChannelV2 this_ptr_conv;
47605         this_ptr_conv.inner = untag_ptr(this_ptr);
47606         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47608         this_ptr_conv.is_owned = false;
47609         int32_t ret_conv = OpenChannelV2_get_locktime(&this_ptr_conv);
47610         return ret_conv;
47611 }
47612
47613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
47614         LDKOpenChannelV2 this_ptr_conv;
47615         this_ptr_conv.inner = untag_ptr(this_ptr);
47616         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47618         this_ptr_conv.is_owned = false;
47619         OpenChannelV2_set_locktime(&this_ptr_conv, val);
47620 }
47621
47622 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
47623         LDKOpenChannelV2 this_ptr_conv;
47624         this_ptr_conv.inner = untag_ptr(this_ptr);
47625         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47627         this_ptr_conv.is_owned = false;
47628         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
47629         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_funding_pubkey(&this_ptr_conv).compressed_form);
47630         return ret_arr;
47631 }
47632
47633 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47634         LDKOpenChannelV2 this_ptr_conv;
47635         this_ptr_conv.inner = untag_ptr(this_ptr);
47636         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47638         this_ptr_conv.is_owned = false;
47639         LDKPublicKey val_ref;
47640         CHECK((*env)->GetArrayLength(env, val) == 33);
47641         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
47642         OpenChannelV2_set_funding_pubkey(&this_ptr_conv, val_ref);
47643 }
47644
47645 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
47646         LDKOpenChannelV2 this_ptr_conv;
47647         this_ptr_conv.inner = untag_ptr(this_ptr);
47648         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47650         this_ptr_conv.is_owned = false;
47651         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
47652         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_revocation_basepoint(&this_ptr_conv).compressed_form);
47653         return ret_arr;
47654 }
47655
47656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47657         LDKOpenChannelV2 this_ptr_conv;
47658         this_ptr_conv.inner = untag_ptr(this_ptr);
47659         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47661         this_ptr_conv.is_owned = false;
47662         LDKPublicKey val_ref;
47663         CHECK((*env)->GetArrayLength(env, val) == 33);
47664         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
47665         OpenChannelV2_set_revocation_basepoint(&this_ptr_conv, val_ref);
47666 }
47667
47668 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
47669         LDKOpenChannelV2 this_ptr_conv;
47670         this_ptr_conv.inner = untag_ptr(this_ptr);
47671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47673         this_ptr_conv.is_owned = false;
47674         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
47675         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_payment_basepoint(&this_ptr_conv).compressed_form);
47676         return ret_arr;
47677 }
47678
47679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47680         LDKOpenChannelV2 this_ptr_conv;
47681         this_ptr_conv.inner = untag_ptr(this_ptr);
47682         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47684         this_ptr_conv.is_owned = false;
47685         LDKPublicKey val_ref;
47686         CHECK((*env)->GetArrayLength(env, val) == 33);
47687         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
47688         OpenChannelV2_set_payment_basepoint(&this_ptr_conv, val_ref);
47689 }
47690
47691 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
47692         LDKOpenChannelV2 this_ptr_conv;
47693         this_ptr_conv.inner = untag_ptr(this_ptr);
47694         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47696         this_ptr_conv.is_owned = false;
47697         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
47698         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
47699         return ret_arr;
47700 }
47701
47702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47703         LDKOpenChannelV2 this_ptr_conv;
47704         this_ptr_conv.inner = untag_ptr(this_ptr);
47705         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47707         this_ptr_conv.is_owned = false;
47708         LDKPublicKey val_ref;
47709         CHECK((*env)->GetArrayLength(env, val) == 33);
47710         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
47711         OpenChannelV2_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
47712 }
47713
47714 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
47715         LDKOpenChannelV2 this_ptr_conv;
47716         this_ptr_conv.inner = untag_ptr(this_ptr);
47717         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47719         this_ptr_conv.is_owned = false;
47720         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
47721         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_htlc_basepoint(&this_ptr_conv).compressed_form);
47722         return ret_arr;
47723 }
47724
47725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47726         LDKOpenChannelV2 this_ptr_conv;
47727         this_ptr_conv.inner = untag_ptr(this_ptr);
47728         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47730         this_ptr_conv.is_owned = false;
47731         LDKPublicKey val_ref;
47732         CHECK((*env)->GetArrayLength(env, val) == 33);
47733         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
47734         OpenChannelV2_set_htlc_basepoint(&this_ptr_conv, val_ref);
47735 }
47736
47737 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
47738         LDKOpenChannelV2 this_ptr_conv;
47739         this_ptr_conv.inner = untag_ptr(this_ptr);
47740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47742         this_ptr_conv.is_owned = false;
47743         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
47744         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
47745         return ret_arr;
47746 }
47747
47748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47749         LDKOpenChannelV2 this_ptr_conv;
47750         this_ptr_conv.inner = untag_ptr(this_ptr);
47751         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47753         this_ptr_conv.is_owned = false;
47754         LDKPublicKey val_ref;
47755         CHECK((*env)->GetArrayLength(env, val) == 33);
47756         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
47757         OpenChannelV2_set_first_per_commitment_point(&this_ptr_conv, val_ref);
47758 }
47759
47760 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1second_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
47761         LDKOpenChannelV2 this_ptr_conv;
47762         this_ptr_conv.inner = untag_ptr(this_ptr);
47763         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47765         this_ptr_conv.is_owned = false;
47766         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
47767         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form);
47768         return ret_arr;
47769 }
47770
47771 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) {
47772         LDKOpenChannelV2 this_ptr_conv;
47773         this_ptr_conv.inner = untag_ptr(this_ptr);
47774         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47776         this_ptr_conv.is_owned = false;
47777         LDKPublicKey val_ref;
47778         CHECK((*env)->GetArrayLength(env, val) == 33);
47779         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
47780         OpenChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
47781 }
47782
47783 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
47784         LDKOpenChannelV2 this_ptr_conv;
47785         this_ptr_conv.inner = untag_ptr(this_ptr);
47786         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47788         this_ptr_conv.is_owned = false;
47789         int8_t ret_conv = OpenChannelV2_get_channel_flags(&this_ptr_conv);
47790         return ret_conv;
47791 }
47792
47793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
47794         LDKOpenChannelV2 this_ptr_conv;
47795         this_ptr_conv.inner = untag_ptr(this_ptr);
47796         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47798         this_ptr_conv.is_owned = false;
47799         OpenChannelV2_set_channel_flags(&this_ptr_conv, val);
47800 }
47801
47802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
47803         LDKOpenChannelV2 this_ptr_conv;
47804         this_ptr_conv.inner = untag_ptr(this_ptr);
47805         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47807         this_ptr_conv.is_owned = false;
47808         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
47809         *ret_copy = OpenChannelV2_get_shutdown_scriptpubkey(&this_ptr_conv);
47810         int64_t ret_ref = tag_ptr(ret_copy, true);
47811         return ret_ref;
47812 }
47813
47814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47815         LDKOpenChannelV2 this_ptr_conv;
47816         this_ptr_conv.inner = untag_ptr(this_ptr);
47817         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47819         this_ptr_conv.is_owned = false;
47820         void* val_ptr = untag_ptr(val);
47821         CHECK_ACCESS(val_ptr);
47822         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
47823         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
47824         OpenChannelV2_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
47825 }
47826
47827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
47828         LDKOpenChannelV2 this_ptr_conv;
47829         this_ptr_conv.inner = untag_ptr(this_ptr);
47830         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47832         this_ptr_conv.is_owned = false;
47833         LDKChannelTypeFeatures ret_var = OpenChannelV2_get_channel_type(&this_ptr_conv);
47834         int64_t ret_ref = 0;
47835         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47836         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47837         return ret_ref;
47838 }
47839
47840 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47841         LDKOpenChannelV2 this_ptr_conv;
47842         this_ptr_conv.inner = untag_ptr(this_ptr);
47843         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47845         this_ptr_conv.is_owned = false;
47846         LDKChannelTypeFeatures val_conv;
47847         val_conv.inner = untag_ptr(val);
47848         val_conv.is_owned = ptr_is_owned(val);
47849         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47850         val_conv = ChannelTypeFeatures_clone(&val_conv);
47851         OpenChannelV2_set_channel_type(&this_ptr_conv, val_conv);
47852 }
47853
47854 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1require_1confirmed_1inputs(JNIEnv *env, jclass clz, int64_t this_ptr) {
47855         LDKOpenChannelV2 this_ptr_conv;
47856         this_ptr_conv.inner = untag_ptr(this_ptr);
47857         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47859         this_ptr_conv.is_owned = false;
47860         jclass ret_conv = LDKCOption_NoneZ_to_java(env, OpenChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
47861         return ret_conv;
47862 }
47863
47864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1require_1confirmed_1inputs(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
47865         LDKOpenChannelV2 this_ptr_conv;
47866         this_ptr_conv.inner = untag_ptr(this_ptr);
47867         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47869         this_ptr_conv.is_owned = false;
47870         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_java(env, val);
47871         OpenChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
47872 }
47873
47874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, int8_tArray temporary_channel_id_arg, int32_t funding_feerate_sat_per_1000_weight_arg, int32_t commitment_feerate_sat_per_1000_weight_arg, int64_t funding_satoshis_arg, int64_t dust_limit_satoshis_arg, int64_t max_htlc_value_in_flight_msat_arg, int64_t htlc_minimum_msat_arg, int16_t to_self_delay_arg, int16_t max_accepted_htlcs_arg, int32_t locktime_arg, int8_tArray funding_pubkey_arg, int8_tArray revocation_basepoint_arg, int8_tArray payment_basepoint_arg, int8_tArray delayed_payment_basepoint_arg, int8_tArray htlc_basepoint_arg, int8_tArray first_per_commitment_point_arg, int8_tArray second_per_commitment_point_arg, int8_t channel_flags_arg, int64_t shutdown_scriptpubkey_arg, int64_t channel_type_arg, jclass require_confirmed_inputs_arg) {
47875         LDKThirtyTwoBytes chain_hash_arg_ref;
47876         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
47877         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
47878         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
47879         CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
47880         (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
47881         LDKPublicKey funding_pubkey_arg_ref;
47882         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
47883         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
47884         LDKPublicKey revocation_basepoint_arg_ref;
47885         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
47886         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
47887         LDKPublicKey payment_basepoint_arg_ref;
47888         CHECK((*env)->GetArrayLength(env, payment_basepoint_arg) == 33);
47889         (*env)->GetByteArrayRegion(env, payment_basepoint_arg, 0, 33, payment_basepoint_arg_ref.compressed_form);
47890         LDKPublicKey delayed_payment_basepoint_arg_ref;
47891         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
47892         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
47893         LDKPublicKey htlc_basepoint_arg_ref;
47894         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
47895         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
47896         LDKPublicKey first_per_commitment_point_arg_ref;
47897         CHECK((*env)->GetArrayLength(env, first_per_commitment_point_arg) == 33);
47898         (*env)->GetByteArrayRegion(env, first_per_commitment_point_arg, 0, 33, first_per_commitment_point_arg_ref.compressed_form);
47899         LDKPublicKey second_per_commitment_point_arg_ref;
47900         CHECK((*env)->GetArrayLength(env, second_per_commitment_point_arg) == 33);
47901         (*env)->GetByteArrayRegion(env, second_per_commitment_point_arg, 0, 33, second_per_commitment_point_arg_ref.compressed_form);
47902         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
47903         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
47904         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
47905         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
47906         LDKChannelTypeFeatures channel_type_arg_conv;
47907         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
47908         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
47909         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
47910         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
47911         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_java(env, require_confirmed_inputs_arg);
47912         LDKOpenChannelV2 ret_var = OpenChannelV2_new(chain_hash_arg_ref, temporary_channel_id_arg_ref, funding_feerate_sat_per_1000_weight_arg, commitment_feerate_sat_per_1000_weight_arg, funding_satoshis_arg, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, htlc_minimum_msat_arg, to_self_delay_arg, max_accepted_htlcs_arg, locktime_arg, funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_basepoint_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref, first_per_commitment_point_arg_ref, second_per_commitment_point_arg_ref, channel_flags_arg, shutdown_scriptpubkey_arg_conv, channel_type_arg_conv, require_confirmed_inputs_arg_conv);
47913         int64_t ret_ref = 0;
47914         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47915         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47916         return ret_ref;
47917 }
47918
47919 static inline uint64_t OpenChannelV2_clone_ptr(LDKOpenChannelV2 *NONNULL_PTR arg) {
47920         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(arg);
47921         int64_t ret_ref = 0;
47922         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47923         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47924         return ret_ref;
47925 }
47926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47927         LDKOpenChannelV2 arg_conv;
47928         arg_conv.inner = untag_ptr(arg);
47929         arg_conv.is_owned = ptr_is_owned(arg);
47930         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47931         arg_conv.is_owned = false;
47932         int64_t ret_conv = OpenChannelV2_clone_ptr(&arg_conv);
47933         return ret_conv;
47934 }
47935
47936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47937         LDKOpenChannelV2 orig_conv;
47938         orig_conv.inner = untag_ptr(orig);
47939         orig_conv.is_owned = ptr_is_owned(orig);
47940         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47941         orig_conv.is_owned = false;
47942         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(&orig_conv);
47943         int64_t ret_ref = 0;
47944         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47945         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47946         return ret_ref;
47947 }
47948
47949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1hash(JNIEnv *env, jclass clz, int64_t o) {
47950         LDKOpenChannelV2 o_conv;
47951         o_conv.inner = untag_ptr(o);
47952         o_conv.is_owned = ptr_is_owned(o);
47953         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47954         o_conv.is_owned = false;
47955         int64_t ret_conv = OpenChannelV2_hash(&o_conv);
47956         return ret_conv;
47957 }
47958
47959 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47960         LDKOpenChannelV2 a_conv;
47961         a_conv.inner = untag_ptr(a);
47962         a_conv.is_owned = ptr_is_owned(a);
47963         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47964         a_conv.is_owned = false;
47965         LDKOpenChannelV2 b_conv;
47966         b_conv.inner = untag_ptr(b);
47967         b_conv.is_owned = ptr_is_owned(b);
47968         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47969         b_conv.is_owned = false;
47970         jboolean ret_conv = OpenChannelV2_eq(&a_conv, &b_conv);
47971         return ret_conv;
47972 }
47973
47974 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47975         LDKAcceptChannel this_obj_conv;
47976         this_obj_conv.inner = untag_ptr(this_obj);
47977         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47979         AcceptChannel_free(this_obj_conv);
47980 }
47981
47982 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
47983         LDKAcceptChannel this_ptr_conv;
47984         this_ptr_conv.inner = untag_ptr(this_ptr);
47985         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47987         this_ptr_conv.is_owned = false;
47988         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47989         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
47990         return ret_arr;
47991 }
47992
47993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47994         LDKAcceptChannel this_ptr_conv;
47995         this_ptr_conv.inner = untag_ptr(this_ptr);
47996         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47998         this_ptr_conv.is_owned = false;
47999         LDKThirtyTwoBytes val_ref;
48000         CHECK((*env)->GetArrayLength(env, val) == 32);
48001         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
48002         AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
48003 }
48004
48005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
48006         LDKAcceptChannel this_ptr_conv;
48007         this_ptr_conv.inner = untag_ptr(this_ptr);
48008         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48010         this_ptr_conv.is_owned = false;
48011         int64_t ret_conv = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
48012         return ret_conv;
48013 }
48014
48015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48016         LDKAcceptChannel this_ptr_conv;
48017         this_ptr_conv.inner = untag_ptr(this_ptr);
48018         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48020         this_ptr_conv.is_owned = false;
48021         AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
48022 }
48023
48024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
48025         LDKAcceptChannel this_ptr_conv;
48026         this_ptr_conv.inner = untag_ptr(this_ptr);
48027         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48029         this_ptr_conv.is_owned = false;
48030         int64_t ret_conv = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
48031         return ret_conv;
48032 }
48033
48034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48035         LDKAcceptChannel this_ptr_conv;
48036         this_ptr_conv.inner = untag_ptr(this_ptr);
48037         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48039         this_ptr_conv.is_owned = false;
48040         AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
48041 }
48042
48043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
48044         LDKAcceptChannel this_ptr_conv;
48045         this_ptr_conv.inner = untag_ptr(this_ptr);
48046         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48048         this_ptr_conv.is_owned = false;
48049         int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
48050         return ret_conv;
48051 }
48052
48053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48054         LDKAcceptChannel this_ptr_conv;
48055         this_ptr_conv.inner = untag_ptr(this_ptr);
48056         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48058         this_ptr_conv.is_owned = false;
48059         AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
48060 }
48061
48062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
48063         LDKAcceptChannel this_ptr_conv;
48064         this_ptr_conv.inner = untag_ptr(this_ptr);
48065         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48067         this_ptr_conv.is_owned = false;
48068         int64_t ret_conv = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
48069         return ret_conv;
48070 }
48071
48072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48073         LDKAcceptChannel this_ptr_conv;
48074         this_ptr_conv.inner = untag_ptr(this_ptr);
48075         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48077         this_ptr_conv.is_owned = false;
48078         AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
48079 }
48080
48081 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
48082         LDKAcceptChannel this_ptr_conv;
48083         this_ptr_conv.inner = untag_ptr(this_ptr);
48084         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48086         this_ptr_conv.is_owned = false;
48087         int32_t ret_conv = AcceptChannel_get_minimum_depth(&this_ptr_conv);
48088         return ret_conv;
48089 }
48090
48091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
48092         LDKAcceptChannel this_ptr_conv;
48093         this_ptr_conv.inner = untag_ptr(this_ptr);
48094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48096         this_ptr_conv.is_owned = false;
48097         AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
48098 }
48099
48100 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
48101         LDKAcceptChannel this_ptr_conv;
48102         this_ptr_conv.inner = untag_ptr(this_ptr);
48103         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48105         this_ptr_conv.is_owned = false;
48106         int16_t ret_conv = AcceptChannel_get_to_self_delay(&this_ptr_conv);
48107         return ret_conv;
48108 }
48109
48110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
48111         LDKAcceptChannel this_ptr_conv;
48112         this_ptr_conv.inner = untag_ptr(this_ptr);
48113         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48115         this_ptr_conv.is_owned = false;
48116         AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
48117 }
48118
48119 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
48120         LDKAcceptChannel this_ptr_conv;
48121         this_ptr_conv.inner = untag_ptr(this_ptr);
48122         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48124         this_ptr_conv.is_owned = false;
48125         int16_t ret_conv = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
48126         return ret_conv;
48127 }
48128
48129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
48130         LDKAcceptChannel this_ptr_conv;
48131         this_ptr_conv.inner = untag_ptr(this_ptr);
48132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48134         this_ptr_conv.is_owned = false;
48135         AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
48136 }
48137
48138 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
48139         LDKAcceptChannel this_ptr_conv;
48140         this_ptr_conv.inner = untag_ptr(this_ptr);
48141         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48143         this_ptr_conv.is_owned = false;
48144         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
48145         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
48146         return ret_arr;
48147 }
48148
48149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48150         LDKAcceptChannel this_ptr_conv;
48151         this_ptr_conv.inner = untag_ptr(this_ptr);
48152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48154         this_ptr_conv.is_owned = false;
48155         LDKPublicKey val_ref;
48156         CHECK((*env)->GetArrayLength(env, val) == 33);
48157         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
48158         AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
48159 }
48160
48161 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
48162         LDKAcceptChannel this_ptr_conv;
48163         this_ptr_conv.inner = untag_ptr(this_ptr);
48164         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48166         this_ptr_conv.is_owned = false;
48167         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
48168         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
48169         return ret_arr;
48170 }
48171
48172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48173         LDKAcceptChannel this_ptr_conv;
48174         this_ptr_conv.inner = untag_ptr(this_ptr);
48175         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48177         this_ptr_conv.is_owned = false;
48178         LDKPublicKey val_ref;
48179         CHECK((*env)->GetArrayLength(env, val) == 33);
48180         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
48181         AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
48182 }
48183
48184 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
48185         LDKAcceptChannel this_ptr_conv;
48186         this_ptr_conv.inner = untag_ptr(this_ptr);
48187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48189         this_ptr_conv.is_owned = false;
48190         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
48191         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
48192         return ret_arr;
48193 }
48194
48195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48196         LDKAcceptChannel this_ptr_conv;
48197         this_ptr_conv.inner = untag_ptr(this_ptr);
48198         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48200         this_ptr_conv.is_owned = false;
48201         LDKPublicKey val_ref;
48202         CHECK((*env)->GetArrayLength(env, val) == 33);
48203         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
48204         AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
48205 }
48206
48207 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
48208         LDKAcceptChannel this_ptr_conv;
48209         this_ptr_conv.inner = untag_ptr(this_ptr);
48210         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48212         this_ptr_conv.is_owned = false;
48213         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
48214         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
48215         return ret_arr;
48216 }
48217
48218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48219         LDKAcceptChannel this_ptr_conv;
48220         this_ptr_conv.inner = untag_ptr(this_ptr);
48221         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48223         this_ptr_conv.is_owned = false;
48224         LDKPublicKey val_ref;
48225         CHECK((*env)->GetArrayLength(env, val) == 33);
48226         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
48227         AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
48228 }
48229
48230 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
48231         LDKAcceptChannel this_ptr_conv;
48232         this_ptr_conv.inner = untag_ptr(this_ptr);
48233         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48235         this_ptr_conv.is_owned = false;
48236         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
48237         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
48238         return ret_arr;
48239 }
48240
48241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48242         LDKAcceptChannel this_ptr_conv;
48243         this_ptr_conv.inner = untag_ptr(this_ptr);
48244         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48246         this_ptr_conv.is_owned = false;
48247         LDKPublicKey val_ref;
48248         CHECK((*env)->GetArrayLength(env, val) == 33);
48249         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
48250         AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
48251 }
48252
48253 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
48254         LDKAcceptChannel this_ptr_conv;
48255         this_ptr_conv.inner = untag_ptr(this_ptr);
48256         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48258         this_ptr_conv.is_owned = false;
48259         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
48260         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
48261         return ret_arr;
48262 }
48263
48264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48265         LDKAcceptChannel this_ptr_conv;
48266         this_ptr_conv.inner = untag_ptr(this_ptr);
48267         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48269         this_ptr_conv.is_owned = false;
48270         LDKPublicKey val_ref;
48271         CHECK((*env)->GetArrayLength(env, val) == 33);
48272         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
48273         AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
48274 }
48275
48276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
48277         LDKAcceptChannel this_ptr_conv;
48278         this_ptr_conv.inner = untag_ptr(this_ptr);
48279         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48281         this_ptr_conv.is_owned = false;
48282         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
48283         *ret_copy = AcceptChannel_get_shutdown_scriptpubkey(&this_ptr_conv);
48284         int64_t ret_ref = tag_ptr(ret_copy, true);
48285         return ret_ref;
48286 }
48287
48288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48289         LDKAcceptChannel this_ptr_conv;
48290         this_ptr_conv.inner = untag_ptr(this_ptr);
48291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48293         this_ptr_conv.is_owned = false;
48294         void* val_ptr = untag_ptr(val);
48295         CHECK_ACCESS(val_ptr);
48296         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
48297         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
48298         AcceptChannel_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
48299 }
48300
48301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
48302         LDKAcceptChannel this_ptr_conv;
48303         this_ptr_conv.inner = untag_ptr(this_ptr);
48304         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48306         this_ptr_conv.is_owned = false;
48307         LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
48308         int64_t ret_ref = 0;
48309         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48310         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48311         return ret_ref;
48312 }
48313
48314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48315         LDKAcceptChannel this_ptr_conv;
48316         this_ptr_conv.inner = untag_ptr(this_ptr);
48317         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48319         this_ptr_conv.is_owned = false;
48320         LDKChannelTypeFeatures val_conv;
48321         val_conv.inner = untag_ptr(val);
48322         val_conv.is_owned = ptr_is_owned(val);
48323         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48324         val_conv = ChannelTypeFeatures_clone(&val_conv);
48325         AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
48326 }
48327
48328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1new(JNIEnv *env, jclass clz, int8_tArray temporary_channel_id_arg, int64_t dust_limit_satoshis_arg, int64_t max_htlc_value_in_flight_msat_arg, int64_t channel_reserve_satoshis_arg, int64_t htlc_minimum_msat_arg, int32_t minimum_depth_arg, int16_t to_self_delay_arg, int16_t max_accepted_htlcs_arg, int8_tArray funding_pubkey_arg, int8_tArray revocation_basepoint_arg, int8_tArray payment_point_arg, int8_tArray delayed_payment_basepoint_arg, int8_tArray htlc_basepoint_arg, int8_tArray first_per_commitment_point_arg, int64_t shutdown_scriptpubkey_arg, int64_t channel_type_arg) {
48329         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
48330         CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
48331         (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
48332         LDKPublicKey funding_pubkey_arg_ref;
48333         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
48334         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
48335         LDKPublicKey revocation_basepoint_arg_ref;
48336         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
48337         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
48338         LDKPublicKey payment_point_arg_ref;
48339         CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
48340         (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
48341         LDKPublicKey delayed_payment_basepoint_arg_ref;
48342         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
48343         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
48344         LDKPublicKey htlc_basepoint_arg_ref;
48345         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
48346         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
48347         LDKPublicKey first_per_commitment_point_arg_ref;
48348         CHECK((*env)->GetArrayLength(env, first_per_commitment_point_arg) == 33);
48349         (*env)->GetByteArrayRegion(env, first_per_commitment_point_arg, 0, 33, first_per_commitment_point_arg_ref.compressed_form);
48350         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
48351         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
48352         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
48353         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
48354         LDKChannelTypeFeatures channel_type_arg_conv;
48355         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
48356         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
48357         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
48358         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
48359         LDKAcceptChannel ret_var = AcceptChannel_new(temporary_channel_id_arg_ref, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, channel_reserve_satoshis_arg, htlc_minimum_msat_arg, minimum_depth_arg, to_self_delay_arg, max_accepted_htlcs_arg, funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_point_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref, first_per_commitment_point_arg_ref, shutdown_scriptpubkey_arg_conv, channel_type_arg_conv);
48360         int64_t ret_ref = 0;
48361         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48362         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48363         return ret_ref;
48364 }
48365
48366 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
48367         LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
48368         int64_t ret_ref = 0;
48369         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48370         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48371         return ret_ref;
48372 }
48373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48374         LDKAcceptChannel arg_conv;
48375         arg_conv.inner = untag_ptr(arg);
48376         arg_conv.is_owned = ptr_is_owned(arg);
48377         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48378         arg_conv.is_owned = false;
48379         int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
48380         return ret_conv;
48381 }
48382
48383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48384         LDKAcceptChannel orig_conv;
48385         orig_conv.inner = untag_ptr(orig);
48386         orig_conv.is_owned = ptr_is_owned(orig);
48387         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48388         orig_conv.is_owned = false;
48389         LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
48390         int64_t ret_ref = 0;
48391         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48392         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48393         return ret_ref;
48394 }
48395
48396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1hash(JNIEnv *env, jclass clz, int64_t o) {
48397         LDKAcceptChannel o_conv;
48398         o_conv.inner = untag_ptr(o);
48399         o_conv.is_owned = ptr_is_owned(o);
48400         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48401         o_conv.is_owned = false;
48402         int64_t ret_conv = AcceptChannel_hash(&o_conv);
48403         return ret_conv;
48404 }
48405
48406 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48407         LDKAcceptChannel a_conv;
48408         a_conv.inner = untag_ptr(a);
48409         a_conv.is_owned = ptr_is_owned(a);
48410         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48411         a_conv.is_owned = false;
48412         LDKAcceptChannel b_conv;
48413         b_conv.inner = untag_ptr(b);
48414         b_conv.is_owned = ptr_is_owned(b);
48415         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48416         b_conv.is_owned = false;
48417         jboolean ret_conv = AcceptChannel_eq(&a_conv, &b_conv);
48418         return ret_conv;
48419 }
48420
48421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48422         LDKAcceptChannelV2 this_obj_conv;
48423         this_obj_conv.inner = untag_ptr(this_obj);
48424         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48426         AcceptChannelV2_free(this_obj_conv);
48427 }
48428
48429 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
48430         LDKAcceptChannelV2 this_ptr_conv;
48431         this_ptr_conv.inner = untag_ptr(this_ptr);
48432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48434         this_ptr_conv.is_owned = false;
48435         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
48436         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannelV2_get_temporary_channel_id(&this_ptr_conv));
48437         return ret_arr;
48438 }
48439
48440 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48441         LDKAcceptChannelV2 this_ptr_conv;
48442         this_ptr_conv.inner = untag_ptr(this_ptr);
48443         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48445         this_ptr_conv.is_owned = false;
48446         LDKThirtyTwoBytes val_ref;
48447         CHECK((*env)->GetArrayLength(env, val) == 32);
48448         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
48449         AcceptChannelV2_set_temporary_channel_id(&this_ptr_conv, val_ref);
48450 }
48451
48452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
48453         LDKAcceptChannelV2 this_ptr_conv;
48454         this_ptr_conv.inner = untag_ptr(this_ptr);
48455         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48457         this_ptr_conv.is_owned = false;
48458         int64_t ret_conv = AcceptChannelV2_get_funding_satoshis(&this_ptr_conv);
48459         return ret_conv;
48460 }
48461
48462 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48463         LDKAcceptChannelV2 this_ptr_conv;
48464         this_ptr_conv.inner = untag_ptr(this_ptr);
48465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48467         this_ptr_conv.is_owned = false;
48468         AcceptChannelV2_set_funding_satoshis(&this_ptr_conv, val);
48469 }
48470
48471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
48472         LDKAcceptChannelV2 this_ptr_conv;
48473         this_ptr_conv.inner = untag_ptr(this_ptr);
48474         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48476         this_ptr_conv.is_owned = false;
48477         int64_t ret_conv = AcceptChannelV2_get_dust_limit_satoshis(&this_ptr_conv);
48478         return ret_conv;
48479 }
48480
48481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48482         LDKAcceptChannelV2 this_ptr_conv;
48483         this_ptr_conv.inner = untag_ptr(this_ptr);
48484         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48486         this_ptr_conv.is_owned = false;
48487         AcceptChannelV2_set_dust_limit_satoshis(&this_ptr_conv, val);
48488 }
48489
48490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
48491         LDKAcceptChannelV2 this_ptr_conv;
48492         this_ptr_conv.inner = untag_ptr(this_ptr);
48493         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48495         this_ptr_conv.is_owned = false;
48496         int64_t ret_conv = AcceptChannelV2_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
48497         return ret_conv;
48498 }
48499
48500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48501         LDKAcceptChannelV2 this_ptr_conv;
48502         this_ptr_conv.inner = untag_ptr(this_ptr);
48503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48505         this_ptr_conv.is_owned = false;
48506         AcceptChannelV2_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
48507 }
48508
48509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
48510         LDKAcceptChannelV2 this_ptr_conv;
48511         this_ptr_conv.inner = untag_ptr(this_ptr);
48512         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48514         this_ptr_conv.is_owned = false;
48515         int64_t ret_conv = AcceptChannelV2_get_htlc_minimum_msat(&this_ptr_conv);
48516         return ret_conv;
48517 }
48518
48519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48520         LDKAcceptChannelV2 this_ptr_conv;
48521         this_ptr_conv.inner = untag_ptr(this_ptr);
48522         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48524         this_ptr_conv.is_owned = false;
48525         AcceptChannelV2_set_htlc_minimum_msat(&this_ptr_conv, val);
48526 }
48527
48528 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
48529         LDKAcceptChannelV2 this_ptr_conv;
48530         this_ptr_conv.inner = untag_ptr(this_ptr);
48531         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48533         this_ptr_conv.is_owned = false;
48534         int32_t ret_conv = AcceptChannelV2_get_minimum_depth(&this_ptr_conv);
48535         return ret_conv;
48536 }
48537
48538 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
48539         LDKAcceptChannelV2 this_ptr_conv;
48540         this_ptr_conv.inner = untag_ptr(this_ptr);
48541         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48543         this_ptr_conv.is_owned = false;
48544         AcceptChannelV2_set_minimum_depth(&this_ptr_conv, val);
48545 }
48546
48547 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
48548         LDKAcceptChannelV2 this_ptr_conv;
48549         this_ptr_conv.inner = untag_ptr(this_ptr);
48550         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48552         this_ptr_conv.is_owned = false;
48553         int16_t ret_conv = AcceptChannelV2_get_to_self_delay(&this_ptr_conv);
48554         return ret_conv;
48555 }
48556
48557 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
48558         LDKAcceptChannelV2 this_ptr_conv;
48559         this_ptr_conv.inner = untag_ptr(this_ptr);
48560         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48562         this_ptr_conv.is_owned = false;
48563         AcceptChannelV2_set_to_self_delay(&this_ptr_conv, val);
48564 }
48565
48566 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
48567         LDKAcceptChannelV2 this_ptr_conv;
48568         this_ptr_conv.inner = untag_ptr(this_ptr);
48569         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48571         this_ptr_conv.is_owned = false;
48572         int16_t ret_conv = AcceptChannelV2_get_max_accepted_htlcs(&this_ptr_conv);
48573         return ret_conv;
48574 }
48575
48576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
48577         LDKAcceptChannelV2 this_ptr_conv;
48578         this_ptr_conv.inner = untag_ptr(this_ptr);
48579         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48581         this_ptr_conv.is_owned = false;
48582         AcceptChannelV2_set_max_accepted_htlcs(&this_ptr_conv, val);
48583 }
48584
48585 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
48586         LDKAcceptChannelV2 this_ptr_conv;
48587         this_ptr_conv.inner = untag_ptr(this_ptr);
48588         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48590         this_ptr_conv.is_owned = false;
48591         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
48592         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_funding_pubkey(&this_ptr_conv).compressed_form);
48593         return ret_arr;
48594 }
48595
48596 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48597         LDKAcceptChannelV2 this_ptr_conv;
48598         this_ptr_conv.inner = untag_ptr(this_ptr);
48599         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48601         this_ptr_conv.is_owned = false;
48602         LDKPublicKey val_ref;
48603         CHECK((*env)->GetArrayLength(env, val) == 33);
48604         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
48605         AcceptChannelV2_set_funding_pubkey(&this_ptr_conv, val_ref);
48606 }
48607
48608 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
48609         LDKAcceptChannelV2 this_ptr_conv;
48610         this_ptr_conv.inner = untag_ptr(this_ptr);
48611         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48613         this_ptr_conv.is_owned = false;
48614         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
48615         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_revocation_basepoint(&this_ptr_conv).compressed_form);
48616         return ret_arr;
48617 }
48618
48619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48620         LDKAcceptChannelV2 this_ptr_conv;
48621         this_ptr_conv.inner = untag_ptr(this_ptr);
48622         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48624         this_ptr_conv.is_owned = false;
48625         LDKPublicKey val_ref;
48626         CHECK((*env)->GetArrayLength(env, val) == 33);
48627         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
48628         AcceptChannelV2_set_revocation_basepoint(&this_ptr_conv, val_ref);
48629 }
48630
48631 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
48632         LDKAcceptChannelV2 this_ptr_conv;
48633         this_ptr_conv.inner = untag_ptr(this_ptr);
48634         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48636         this_ptr_conv.is_owned = false;
48637         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
48638         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_payment_basepoint(&this_ptr_conv).compressed_form);
48639         return ret_arr;
48640 }
48641
48642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48643         LDKAcceptChannelV2 this_ptr_conv;
48644         this_ptr_conv.inner = untag_ptr(this_ptr);
48645         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48647         this_ptr_conv.is_owned = false;
48648         LDKPublicKey val_ref;
48649         CHECK((*env)->GetArrayLength(env, val) == 33);
48650         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
48651         AcceptChannelV2_set_payment_basepoint(&this_ptr_conv, val_ref);
48652 }
48653
48654 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
48655         LDKAcceptChannelV2 this_ptr_conv;
48656         this_ptr_conv.inner = untag_ptr(this_ptr);
48657         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48659         this_ptr_conv.is_owned = false;
48660         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
48661         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
48662         return ret_arr;
48663 }
48664
48665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48666         LDKAcceptChannelV2 this_ptr_conv;
48667         this_ptr_conv.inner = untag_ptr(this_ptr);
48668         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48670         this_ptr_conv.is_owned = false;
48671         LDKPublicKey val_ref;
48672         CHECK((*env)->GetArrayLength(env, val) == 33);
48673         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
48674         AcceptChannelV2_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
48675 }
48676
48677 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
48678         LDKAcceptChannelV2 this_ptr_conv;
48679         this_ptr_conv.inner = untag_ptr(this_ptr);
48680         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48682         this_ptr_conv.is_owned = false;
48683         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
48684         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_htlc_basepoint(&this_ptr_conv).compressed_form);
48685         return ret_arr;
48686 }
48687
48688 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48689         LDKAcceptChannelV2 this_ptr_conv;
48690         this_ptr_conv.inner = untag_ptr(this_ptr);
48691         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48693         this_ptr_conv.is_owned = false;
48694         LDKPublicKey val_ref;
48695         CHECK((*env)->GetArrayLength(env, val) == 33);
48696         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
48697         AcceptChannelV2_set_htlc_basepoint(&this_ptr_conv, val_ref);
48698 }
48699
48700 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
48701         LDKAcceptChannelV2 this_ptr_conv;
48702         this_ptr_conv.inner = untag_ptr(this_ptr);
48703         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48705         this_ptr_conv.is_owned = false;
48706         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
48707         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
48708         return ret_arr;
48709 }
48710
48711 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48712         LDKAcceptChannelV2 this_ptr_conv;
48713         this_ptr_conv.inner = untag_ptr(this_ptr);
48714         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48716         this_ptr_conv.is_owned = false;
48717         LDKPublicKey val_ref;
48718         CHECK((*env)->GetArrayLength(env, val) == 33);
48719         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
48720         AcceptChannelV2_set_first_per_commitment_point(&this_ptr_conv, val_ref);
48721 }
48722
48723 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1second_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
48724         LDKAcceptChannelV2 this_ptr_conv;
48725         this_ptr_conv.inner = untag_ptr(this_ptr);
48726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48728         this_ptr_conv.is_owned = false;
48729         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
48730         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form);
48731         return ret_arr;
48732 }
48733
48734 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) {
48735         LDKAcceptChannelV2 this_ptr_conv;
48736         this_ptr_conv.inner = untag_ptr(this_ptr);
48737         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48739         this_ptr_conv.is_owned = false;
48740         LDKPublicKey val_ref;
48741         CHECK((*env)->GetArrayLength(env, val) == 33);
48742         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
48743         AcceptChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
48744 }
48745
48746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
48747         LDKAcceptChannelV2 this_ptr_conv;
48748         this_ptr_conv.inner = untag_ptr(this_ptr);
48749         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48751         this_ptr_conv.is_owned = false;
48752         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
48753         *ret_copy = AcceptChannelV2_get_shutdown_scriptpubkey(&this_ptr_conv);
48754         int64_t ret_ref = tag_ptr(ret_copy, true);
48755         return ret_ref;
48756 }
48757
48758 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48759         LDKAcceptChannelV2 this_ptr_conv;
48760         this_ptr_conv.inner = untag_ptr(this_ptr);
48761         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48763         this_ptr_conv.is_owned = false;
48764         void* val_ptr = untag_ptr(val);
48765         CHECK_ACCESS(val_ptr);
48766         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
48767         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
48768         AcceptChannelV2_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
48769 }
48770
48771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
48772         LDKAcceptChannelV2 this_ptr_conv;
48773         this_ptr_conv.inner = untag_ptr(this_ptr);
48774         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48776         this_ptr_conv.is_owned = false;
48777         LDKChannelTypeFeatures ret_var = AcceptChannelV2_get_channel_type(&this_ptr_conv);
48778         int64_t ret_ref = 0;
48779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48781         return ret_ref;
48782 }
48783
48784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48785         LDKAcceptChannelV2 this_ptr_conv;
48786         this_ptr_conv.inner = untag_ptr(this_ptr);
48787         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48789         this_ptr_conv.is_owned = false;
48790         LDKChannelTypeFeatures val_conv;
48791         val_conv.inner = untag_ptr(val);
48792         val_conv.is_owned = ptr_is_owned(val);
48793         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48794         val_conv = ChannelTypeFeatures_clone(&val_conv);
48795         AcceptChannelV2_set_channel_type(&this_ptr_conv, val_conv);
48796 }
48797
48798 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1require_1confirmed_1inputs(JNIEnv *env, jclass clz, int64_t this_ptr) {
48799         LDKAcceptChannelV2 this_ptr_conv;
48800         this_ptr_conv.inner = untag_ptr(this_ptr);
48801         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48803         this_ptr_conv.is_owned = false;
48804         jclass ret_conv = LDKCOption_NoneZ_to_java(env, AcceptChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
48805         return ret_conv;
48806 }
48807
48808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1require_1confirmed_1inputs(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
48809         LDKAcceptChannelV2 this_ptr_conv;
48810         this_ptr_conv.inner = untag_ptr(this_ptr);
48811         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48813         this_ptr_conv.is_owned = false;
48814         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_java(env, val);
48815         AcceptChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
48816 }
48817
48818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1new(JNIEnv *env, jclass clz, int8_tArray temporary_channel_id_arg, int64_t funding_satoshis_arg, int64_t dust_limit_satoshis_arg, int64_t max_htlc_value_in_flight_msat_arg, int64_t htlc_minimum_msat_arg, int32_t minimum_depth_arg, int16_t to_self_delay_arg, int16_t max_accepted_htlcs_arg, int8_tArray funding_pubkey_arg, int8_tArray revocation_basepoint_arg, int8_tArray payment_basepoint_arg, int8_tArray delayed_payment_basepoint_arg, int8_tArray htlc_basepoint_arg, int8_tArray first_per_commitment_point_arg, int8_tArray second_per_commitment_point_arg, int64_t shutdown_scriptpubkey_arg, int64_t channel_type_arg, jclass require_confirmed_inputs_arg) {
48819         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
48820         CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
48821         (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
48822         LDKPublicKey funding_pubkey_arg_ref;
48823         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
48824         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
48825         LDKPublicKey revocation_basepoint_arg_ref;
48826         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
48827         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
48828         LDKPublicKey payment_basepoint_arg_ref;
48829         CHECK((*env)->GetArrayLength(env, payment_basepoint_arg) == 33);
48830         (*env)->GetByteArrayRegion(env, payment_basepoint_arg, 0, 33, payment_basepoint_arg_ref.compressed_form);
48831         LDKPublicKey delayed_payment_basepoint_arg_ref;
48832         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
48833         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
48834         LDKPublicKey htlc_basepoint_arg_ref;
48835         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
48836         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
48837         LDKPublicKey first_per_commitment_point_arg_ref;
48838         CHECK((*env)->GetArrayLength(env, first_per_commitment_point_arg) == 33);
48839         (*env)->GetByteArrayRegion(env, first_per_commitment_point_arg, 0, 33, first_per_commitment_point_arg_ref.compressed_form);
48840         LDKPublicKey second_per_commitment_point_arg_ref;
48841         CHECK((*env)->GetArrayLength(env, second_per_commitment_point_arg) == 33);
48842         (*env)->GetByteArrayRegion(env, second_per_commitment_point_arg, 0, 33, second_per_commitment_point_arg_ref.compressed_form);
48843         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
48844         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
48845         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
48846         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
48847         LDKChannelTypeFeatures channel_type_arg_conv;
48848         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
48849         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
48850         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
48851         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
48852         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_java(env, require_confirmed_inputs_arg);
48853         LDKAcceptChannelV2 ret_var = AcceptChannelV2_new(temporary_channel_id_arg_ref, funding_satoshis_arg, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, htlc_minimum_msat_arg, minimum_depth_arg, to_self_delay_arg, max_accepted_htlcs_arg, funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_basepoint_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref, first_per_commitment_point_arg_ref, second_per_commitment_point_arg_ref, shutdown_scriptpubkey_arg_conv, channel_type_arg_conv, require_confirmed_inputs_arg_conv);
48854         int64_t ret_ref = 0;
48855         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48856         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48857         return ret_ref;
48858 }
48859
48860 static inline uint64_t AcceptChannelV2_clone_ptr(LDKAcceptChannelV2 *NONNULL_PTR arg) {
48861         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(arg);
48862         int64_t ret_ref = 0;
48863         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48864         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48865         return ret_ref;
48866 }
48867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48868         LDKAcceptChannelV2 arg_conv;
48869         arg_conv.inner = untag_ptr(arg);
48870         arg_conv.is_owned = ptr_is_owned(arg);
48871         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48872         arg_conv.is_owned = false;
48873         int64_t ret_conv = AcceptChannelV2_clone_ptr(&arg_conv);
48874         return ret_conv;
48875 }
48876
48877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48878         LDKAcceptChannelV2 orig_conv;
48879         orig_conv.inner = untag_ptr(orig);
48880         orig_conv.is_owned = ptr_is_owned(orig);
48881         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48882         orig_conv.is_owned = false;
48883         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(&orig_conv);
48884         int64_t ret_ref = 0;
48885         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48886         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48887         return ret_ref;
48888 }
48889
48890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1hash(JNIEnv *env, jclass clz, int64_t o) {
48891         LDKAcceptChannelV2 o_conv;
48892         o_conv.inner = untag_ptr(o);
48893         o_conv.is_owned = ptr_is_owned(o);
48894         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48895         o_conv.is_owned = false;
48896         int64_t ret_conv = AcceptChannelV2_hash(&o_conv);
48897         return ret_conv;
48898 }
48899
48900 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48901         LDKAcceptChannelV2 a_conv;
48902         a_conv.inner = untag_ptr(a);
48903         a_conv.is_owned = ptr_is_owned(a);
48904         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48905         a_conv.is_owned = false;
48906         LDKAcceptChannelV2 b_conv;
48907         b_conv.inner = untag_ptr(b);
48908         b_conv.is_owned = ptr_is_owned(b);
48909         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48910         b_conv.is_owned = false;
48911         jboolean ret_conv = AcceptChannelV2_eq(&a_conv, &b_conv);
48912         return ret_conv;
48913 }
48914
48915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48916         LDKFundingCreated this_obj_conv;
48917         this_obj_conv.inner = untag_ptr(this_obj);
48918         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48920         FundingCreated_free(this_obj_conv);
48921 }
48922
48923 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
48924         LDKFundingCreated this_ptr_conv;
48925         this_ptr_conv.inner = untag_ptr(this_ptr);
48926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48928         this_ptr_conv.is_owned = false;
48929         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
48930         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
48931         return ret_arr;
48932 }
48933
48934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48935         LDKFundingCreated this_ptr_conv;
48936         this_ptr_conv.inner = untag_ptr(this_ptr);
48937         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48939         this_ptr_conv.is_owned = false;
48940         LDKThirtyTwoBytes val_ref;
48941         CHECK((*env)->GetArrayLength(env, val) == 32);
48942         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
48943         FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
48944 }
48945
48946 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
48947         LDKFundingCreated this_ptr_conv;
48948         this_ptr_conv.inner = untag_ptr(this_ptr);
48949         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48951         this_ptr_conv.is_owned = false;
48952         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
48953         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
48954         return ret_arr;
48955 }
48956
48957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48958         LDKFundingCreated this_ptr_conv;
48959         this_ptr_conv.inner = untag_ptr(this_ptr);
48960         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48962         this_ptr_conv.is_owned = false;
48963         LDKThirtyTwoBytes val_ref;
48964         CHECK((*env)->GetArrayLength(env, val) == 32);
48965         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
48966         FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
48967 }
48968
48969 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
48970         LDKFundingCreated this_ptr_conv;
48971         this_ptr_conv.inner = untag_ptr(this_ptr);
48972         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48974         this_ptr_conv.is_owned = false;
48975         int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
48976         return ret_conv;
48977 }
48978
48979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
48980         LDKFundingCreated this_ptr_conv;
48981         this_ptr_conv.inner = untag_ptr(this_ptr);
48982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48984         this_ptr_conv.is_owned = false;
48985         FundingCreated_set_funding_output_index(&this_ptr_conv, val);
48986 }
48987
48988 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
48989         LDKFundingCreated this_ptr_conv;
48990         this_ptr_conv.inner = untag_ptr(this_ptr);
48991         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48993         this_ptr_conv.is_owned = false;
48994         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
48995         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
48996         return ret_arr;
48997 }
48998
48999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49000         LDKFundingCreated this_ptr_conv;
49001         this_ptr_conv.inner = untag_ptr(this_ptr);
49002         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49004         this_ptr_conv.is_owned = false;
49005         LDKECDSASignature val_ref;
49006         CHECK((*env)->GetArrayLength(env, val) == 64);
49007         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
49008         FundingCreated_set_signature(&this_ptr_conv, val_ref);
49009 }
49010
49011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1new(JNIEnv *env, jclass clz, int8_tArray temporary_channel_id_arg, int8_tArray funding_txid_arg, int16_t funding_output_index_arg, int8_tArray signature_arg) {
49012         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
49013         CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
49014         (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
49015         LDKThirtyTwoBytes funding_txid_arg_ref;
49016         CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
49017         (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
49018         LDKECDSASignature signature_arg_ref;
49019         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
49020         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
49021         LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
49022         int64_t ret_ref = 0;
49023         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49024         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49025         return ret_ref;
49026 }
49027
49028 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
49029         LDKFundingCreated ret_var = FundingCreated_clone(arg);
49030         int64_t ret_ref = 0;
49031         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49032         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49033         return ret_ref;
49034 }
49035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49036         LDKFundingCreated arg_conv;
49037         arg_conv.inner = untag_ptr(arg);
49038         arg_conv.is_owned = ptr_is_owned(arg);
49039         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49040         arg_conv.is_owned = false;
49041         int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
49042         return ret_conv;
49043 }
49044
49045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49046         LDKFundingCreated orig_conv;
49047         orig_conv.inner = untag_ptr(orig);
49048         orig_conv.is_owned = ptr_is_owned(orig);
49049         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49050         orig_conv.is_owned = false;
49051         LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
49052         int64_t ret_ref = 0;
49053         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49054         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49055         return ret_ref;
49056 }
49057
49058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1hash(JNIEnv *env, jclass clz, int64_t o) {
49059         LDKFundingCreated o_conv;
49060         o_conv.inner = untag_ptr(o);
49061         o_conv.is_owned = ptr_is_owned(o);
49062         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49063         o_conv.is_owned = false;
49064         int64_t ret_conv = FundingCreated_hash(&o_conv);
49065         return ret_conv;
49066 }
49067
49068 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_FundingCreated_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49069         LDKFundingCreated a_conv;
49070         a_conv.inner = untag_ptr(a);
49071         a_conv.is_owned = ptr_is_owned(a);
49072         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49073         a_conv.is_owned = false;
49074         LDKFundingCreated b_conv;
49075         b_conv.inner = untag_ptr(b);
49076         b_conv.is_owned = ptr_is_owned(b);
49077         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49078         b_conv.is_owned = false;
49079         jboolean ret_conv = FundingCreated_eq(&a_conv, &b_conv);
49080         return ret_conv;
49081 }
49082
49083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49084         LDKFundingSigned this_obj_conv;
49085         this_obj_conv.inner = untag_ptr(this_obj);
49086         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49088         FundingSigned_free(this_obj_conv);
49089 }
49090
49091 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
49092         LDKFundingSigned this_ptr_conv;
49093         this_ptr_conv.inner = untag_ptr(this_ptr);
49094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49096         this_ptr_conv.is_owned = false;
49097         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49098         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
49099         return ret_arr;
49100 }
49101
49102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49103         LDKFundingSigned this_ptr_conv;
49104         this_ptr_conv.inner = untag_ptr(this_ptr);
49105         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49107         this_ptr_conv.is_owned = false;
49108         LDKThirtyTwoBytes val_ref;
49109         CHECK((*env)->GetArrayLength(env, val) == 32);
49110         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
49111         FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
49112 }
49113
49114 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
49115         LDKFundingSigned this_ptr_conv;
49116         this_ptr_conv.inner = untag_ptr(this_ptr);
49117         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49119         this_ptr_conv.is_owned = false;
49120         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
49121         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
49122         return ret_arr;
49123 }
49124
49125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49126         LDKFundingSigned this_ptr_conv;
49127         this_ptr_conv.inner = untag_ptr(this_ptr);
49128         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49130         this_ptr_conv.is_owned = false;
49131         LDKECDSASignature val_ref;
49132         CHECK((*env)->GetArrayLength(env, val) == 64);
49133         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
49134         FundingSigned_set_signature(&this_ptr_conv, val_ref);
49135 }
49136
49137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg) {
49138         LDKThirtyTwoBytes channel_id_arg_ref;
49139         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
49140         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
49141         LDKECDSASignature signature_arg_ref;
49142         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
49143         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
49144         LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
49145         int64_t ret_ref = 0;
49146         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49147         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49148         return ret_ref;
49149 }
49150
49151 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
49152         LDKFundingSigned ret_var = FundingSigned_clone(arg);
49153         int64_t ret_ref = 0;
49154         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49155         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49156         return ret_ref;
49157 }
49158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49159         LDKFundingSigned arg_conv;
49160         arg_conv.inner = untag_ptr(arg);
49161         arg_conv.is_owned = ptr_is_owned(arg);
49162         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49163         arg_conv.is_owned = false;
49164         int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
49165         return ret_conv;
49166 }
49167
49168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49169         LDKFundingSigned orig_conv;
49170         orig_conv.inner = untag_ptr(orig);
49171         orig_conv.is_owned = ptr_is_owned(orig);
49172         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49173         orig_conv.is_owned = false;
49174         LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
49175         int64_t ret_ref = 0;
49176         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49177         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49178         return ret_ref;
49179 }
49180
49181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1hash(JNIEnv *env, jclass clz, int64_t o) {
49182         LDKFundingSigned o_conv;
49183         o_conv.inner = untag_ptr(o);
49184         o_conv.is_owned = ptr_is_owned(o);
49185         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49186         o_conv.is_owned = false;
49187         int64_t ret_conv = FundingSigned_hash(&o_conv);
49188         return ret_conv;
49189 }
49190
49191 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_FundingSigned_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49192         LDKFundingSigned a_conv;
49193         a_conv.inner = untag_ptr(a);
49194         a_conv.is_owned = ptr_is_owned(a);
49195         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49196         a_conv.is_owned = false;
49197         LDKFundingSigned b_conv;
49198         b_conv.inner = untag_ptr(b);
49199         b_conv.is_owned = ptr_is_owned(b);
49200         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49201         b_conv.is_owned = false;
49202         jboolean ret_conv = FundingSigned_eq(&a_conv, &b_conv);
49203         return ret_conv;
49204 }
49205
49206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49207         LDKChannelReady this_obj_conv;
49208         this_obj_conv.inner = untag_ptr(this_obj);
49209         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49211         ChannelReady_free(this_obj_conv);
49212 }
49213
49214 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
49215         LDKChannelReady this_ptr_conv;
49216         this_ptr_conv.inner = untag_ptr(this_ptr);
49217         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49219         this_ptr_conv.is_owned = false;
49220         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49221         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReady_get_channel_id(&this_ptr_conv));
49222         return ret_arr;
49223 }
49224
49225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49226         LDKChannelReady this_ptr_conv;
49227         this_ptr_conv.inner = untag_ptr(this_ptr);
49228         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49230         this_ptr_conv.is_owned = false;
49231         LDKThirtyTwoBytes val_ref;
49232         CHECK((*env)->GetArrayLength(env, val) == 32);
49233         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
49234         ChannelReady_set_channel_id(&this_ptr_conv, val_ref);
49235 }
49236
49237 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
49238         LDKChannelReady this_ptr_conv;
49239         this_ptr_conv.inner = untag_ptr(this_ptr);
49240         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49242         this_ptr_conv.is_owned = false;
49243         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
49244         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
49245         return ret_arr;
49246 }
49247
49248 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) {
49249         LDKChannelReady this_ptr_conv;
49250         this_ptr_conv.inner = untag_ptr(this_ptr);
49251         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49253         this_ptr_conv.is_owned = false;
49254         LDKPublicKey val_ref;
49255         CHECK((*env)->GetArrayLength(env, val) == 33);
49256         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
49257         ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
49258 }
49259
49260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1short_1channel_1id_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
49261         LDKChannelReady this_ptr_conv;
49262         this_ptr_conv.inner = untag_ptr(this_ptr);
49263         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49265         this_ptr_conv.is_owned = false;
49266         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
49267         *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
49268         int64_t ret_ref = tag_ptr(ret_copy, true);
49269         return ret_ref;
49270 }
49271
49272 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) {
49273         LDKChannelReady this_ptr_conv;
49274         this_ptr_conv.inner = untag_ptr(this_ptr);
49275         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49277         this_ptr_conv.is_owned = false;
49278         void* val_ptr = untag_ptr(val);
49279         CHECK_ACCESS(val_ptr);
49280         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
49281         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
49282         ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
49283 }
49284
49285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg, int64_t short_channel_id_alias_arg) {
49286         LDKThirtyTwoBytes channel_id_arg_ref;
49287         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
49288         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
49289         LDKPublicKey next_per_commitment_point_arg_ref;
49290         CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
49291         (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
49292         void* short_channel_id_alias_arg_ptr = untag_ptr(short_channel_id_alias_arg);
49293         CHECK_ACCESS(short_channel_id_alias_arg_ptr);
49294         LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
49295         short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_alias_arg));
49296         LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
49297         int64_t ret_ref = 0;
49298         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49299         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49300         return ret_ref;
49301 }
49302
49303 static inline uint64_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
49304         LDKChannelReady ret_var = ChannelReady_clone(arg);
49305         int64_t ret_ref = 0;
49306         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49307         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49308         return ret_ref;
49309 }
49310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49311         LDKChannelReady arg_conv;
49312         arg_conv.inner = untag_ptr(arg);
49313         arg_conv.is_owned = ptr_is_owned(arg);
49314         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49315         arg_conv.is_owned = false;
49316         int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
49317         return ret_conv;
49318 }
49319
49320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49321         LDKChannelReady orig_conv;
49322         orig_conv.inner = untag_ptr(orig);
49323         orig_conv.is_owned = ptr_is_owned(orig);
49324         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49325         orig_conv.is_owned = false;
49326         LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
49327         int64_t ret_ref = 0;
49328         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49329         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49330         return ret_ref;
49331 }
49332
49333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1hash(JNIEnv *env, jclass clz, int64_t o) {
49334         LDKChannelReady o_conv;
49335         o_conv.inner = untag_ptr(o);
49336         o_conv.is_owned = ptr_is_owned(o);
49337         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49338         o_conv.is_owned = false;
49339         int64_t ret_conv = ChannelReady_hash(&o_conv);
49340         return ret_conv;
49341 }
49342
49343 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelReady_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49344         LDKChannelReady a_conv;
49345         a_conv.inner = untag_ptr(a);
49346         a_conv.is_owned = ptr_is_owned(a);
49347         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49348         a_conv.is_owned = false;
49349         LDKChannelReady b_conv;
49350         b_conv.inner = untag_ptr(b);
49351         b_conv.is_owned = ptr_is_owned(b);
49352         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49353         b_conv.is_owned = false;
49354         jboolean ret_conv = ChannelReady_eq(&a_conv, &b_conv);
49355         return ret_conv;
49356 }
49357
49358 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Stfu_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49359         LDKStfu this_obj_conv;
49360         this_obj_conv.inner = untag_ptr(this_obj);
49361         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49363         Stfu_free(this_obj_conv);
49364 }
49365
49366 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Stfu_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
49367         LDKStfu this_ptr_conv;
49368         this_ptr_conv.inner = untag_ptr(this_ptr);
49369         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49371         this_ptr_conv.is_owned = false;
49372         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49373         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Stfu_get_channel_id(&this_ptr_conv));
49374         return ret_arr;
49375 }
49376
49377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Stfu_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49378         LDKStfu this_ptr_conv;
49379         this_ptr_conv.inner = untag_ptr(this_ptr);
49380         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49382         this_ptr_conv.is_owned = false;
49383         LDKThirtyTwoBytes val_ref;
49384         CHECK((*env)->GetArrayLength(env, val) == 32);
49385         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
49386         Stfu_set_channel_id(&this_ptr_conv, val_ref);
49387 }
49388
49389 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_Stfu_1get_1initiator(JNIEnv *env, jclass clz, int64_t this_ptr) {
49390         LDKStfu this_ptr_conv;
49391         this_ptr_conv.inner = untag_ptr(this_ptr);
49392         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49394         this_ptr_conv.is_owned = false;
49395         int8_t ret_conv = Stfu_get_initiator(&this_ptr_conv);
49396         return ret_conv;
49397 }
49398
49399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Stfu_1set_1initiator(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
49400         LDKStfu this_ptr_conv;
49401         this_ptr_conv.inner = untag_ptr(this_ptr);
49402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49404         this_ptr_conv.is_owned = false;
49405         Stfu_set_initiator(&this_ptr_conv, val);
49406 }
49407
49408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Stfu_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_t initiator_arg) {
49409         LDKThirtyTwoBytes channel_id_arg_ref;
49410         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
49411         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
49412         LDKStfu ret_var = Stfu_new(channel_id_arg_ref, initiator_arg);
49413         int64_t ret_ref = 0;
49414         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49415         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49416         return ret_ref;
49417 }
49418
49419 static inline uint64_t Stfu_clone_ptr(LDKStfu *NONNULL_PTR arg) {
49420         LDKStfu ret_var = Stfu_clone(arg);
49421         int64_t ret_ref = 0;
49422         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49423         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49424         return ret_ref;
49425 }
49426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Stfu_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49427         LDKStfu arg_conv;
49428         arg_conv.inner = untag_ptr(arg);
49429         arg_conv.is_owned = ptr_is_owned(arg);
49430         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49431         arg_conv.is_owned = false;
49432         int64_t ret_conv = Stfu_clone_ptr(&arg_conv);
49433         return ret_conv;
49434 }
49435
49436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Stfu_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49437         LDKStfu orig_conv;
49438         orig_conv.inner = untag_ptr(orig);
49439         orig_conv.is_owned = ptr_is_owned(orig);
49440         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49441         orig_conv.is_owned = false;
49442         LDKStfu ret_var = Stfu_clone(&orig_conv);
49443         int64_t ret_ref = 0;
49444         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49445         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49446         return ret_ref;
49447 }
49448
49449 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Stfu_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49450         LDKStfu a_conv;
49451         a_conv.inner = untag_ptr(a);
49452         a_conv.is_owned = ptr_is_owned(a);
49453         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49454         a_conv.is_owned = false;
49455         LDKStfu b_conv;
49456         b_conv.inner = untag_ptr(b);
49457         b_conv.is_owned = ptr_is_owned(b);
49458         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49459         b_conv.is_owned = false;
49460         jboolean ret_conv = Stfu_eq(&a_conv, &b_conv);
49461         return ret_conv;
49462 }
49463
49464 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Splice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49465         LDKSplice this_obj_conv;
49466         this_obj_conv.inner = untag_ptr(this_obj);
49467         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49469         Splice_free(this_obj_conv);
49470 }
49471
49472 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Splice_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
49473         LDKSplice this_ptr_conv;
49474         this_ptr_conv.inner = untag_ptr(this_ptr);
49475         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49477         this_ptr_conv.is_owned = false;
49478         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49479         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Splice_get_channel_id(&this_ptr_conv));
49480         return ret_arr;
49481 }
49482
49483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Splice_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49484         LDKSplice this_ptr_conv;
49485         this_ptr_conv.inner = untag_ptr(this_ptr);
49486         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49488         this_ptr_conv.is_owned = false;
49489         LDKThirtyTwoBytes val_ref;
49490         CHECK((*env)->GetArrayLength(env, val) == 32);
49491         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
49492         Splice_set_channel_id(&this_ptr_conv, val_ref);
49493 }
49494
49495 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Splice_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
49496         LDKSplice this_ptr_conv;
49497         this_ptr_conv.inner = untag_ptr(this_ptr);
49498         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49500         this_ptr_conv.is_owned = false;
49501         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49502         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Splice_get_chain_hash(&this_ptr_conv));
49503         return ret_arr;
49504 }
49505
49506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Splice_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49507         LDKSplice this_ptr_conv;
49508         this_ptr_conv.inner = untag_ptr(this_ptr);
49509         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49511         this_ptr_conv.is_owned = false;
49512         LDKThirtyTwoBytes val_ref;
49513         CHECK((*env)->GetArrayLength(env, val) == 32);
49514         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
49515         Splice_set_chain_hash(&this_ptr_conv, val_ref);
49516 }
49517
49518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Splice_1get_1relative_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
49519         LDKSplice 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         int64_t ret_conv = Splice_get_relative_satoshis(&this_ptr_conv);
49525         return ret_conv;
49526 }
49527
49528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Splice_1set_1relative_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49529         LDKSplice this_ptr_conv;
49530         this_ptr_conv.inner = untag_ptr(this_ptr);
49531         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49533         this_ptr_conv.is_owned = false;
49534         Splice_set_relative_satoshis(&this_ptr_conv, val);
49535 }
49536
49537 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_Splice_1get_1funding_1feerate_1perkw(JNIEnv *env, jclass clz, int64_t this_ptr) {
49538         LDKSplice this_ptr_conv;
49539         this_ptr_conv.inner = untag_ptr(this_ptr);
49540         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49542         this_ptr_conv.is_owned = false;
49543         int32_t ret_conv = Splice_get_funding_feerate_perkw(&this_ptr_conv);
49544         return ret_conv;
49545 }
49546
49547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Splice_1set_1funding_1feerate_1perkw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
49548         LDKSplice this_ptr_conv;
49549         this_ptr_conv.inner = untag_ptr(this_ptr);
49550         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49552         this_ptr_conv.is_owned = false;
49553         Splice_set_funding_feerate_perkw(&this_ptr_conv, val);
49554 }
49555
49556 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_Splice_1get_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr) {
49557         LDKSplice this_ptr_conv;
49558         this_ptr_conv.inner = untag_ptr(this_ptr);
49559         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49561         this_ptr_conv.is_owned = false;
49562         int32_t ret_conv = Splice_get_locktime(&this_ptr_conv);
49563         return ret_conv;
49564 }
49565
49566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Splice_1set_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
49567         LDKSplice this_ptr_conv;
49568         this_ptr_conv.inner = untag_ptr(this_ptr);
49569         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49571         this_ptr_conv.is_owned = false;
49572         Splice_set_locktime(&this_ptr_conv, val);
49573 }
49574
49575 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Splice_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
49576         LDKSplice this_ptr_conv;
49577         this_ptr_conv.inner = untag_ptr(this_ptr);
49578         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49580         this_ptr_conv.is_owned = false;
49581         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
49582         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Splice_get_funding_pubkey(&this_ptr_conv).compressed_form);
49583         return ret_arr;
49584 }
49585
49586 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Splice_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49587         LDKSplice this_ptr_conv;
49588         this_ptr_conv.inner = untag_ptr(this_ptr);
49589         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49591         this_ptr_conv.is_owned = false;
49592         LDKPublicKey val_ref;
49593         CHECK((*env)->GetArrayLength(env, val) == 33);
49594         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
49595         Splice_set_funding_pubkey(&this_ptr_conv, val_ref);
49596 }
49597
49598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Splice_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray chain_hash_arg, int64_t relative_satoshis_arg, int32_t funding_feerate_perkw_arg, int32_t locktime_arg, int8_tArray funding_pubkey_arg) {
49599         LDKThirtyTwoBytes channel_id_arg_ref;
49600         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
49601         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
49602         LDKThirtyTwoBytes chain_hash_arg_ref;
49603         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
49604         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
49605         LDKPublicKey funding_pubkey_arg_ref;
49606         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
49607         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
49608         LDKSplice ret_var = Splice_new(channel_id_arg_ref, chain_hash_arg_ref, relative_satoshis_arg, funding_feerate_perkw_arg, locktime_arg, funding_pubkey_arg_ref);
49609         int64_t ret_ref = 0;
49610         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49611         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49612         return ret_ref;
49613 }
49614
49615 static inline uint64_t Splice_clone_ptr(LDKSplice *NONNULL_PTR arg) {
49616         LDKSplice ret_var = Splice_clone(arg);
49617         int64_t ret_ref = 0;
49618         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49619         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49620         return ret_ref;
49621 }
49622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Splice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49623         LDKSplice arg_conv;
49624         arg_conv.inner = untag_ptr(arg);
49625         arg_conv.is_owned = ptr_is_owned(arg);
49626         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49627         arg_conv.is_owned = false;
49628         int64_t ret_conv = Splice_clone_ptr(&arg_conv);
49629         return ret_conv;
49630 }
49631
49632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Splice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49633         LDKSplice orig_conv;
49634         orig_conv.inner = untag_ptr(orig);
49635         orig_conv.is_owned = ptr_is_owned(orig);
49636         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49637         orig_conv.is_owned = false;
49638         LDKSplice ret_var = Splice_clone(&orig_conv);
49639         int64_t ret_ref = 0;
49640         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49641         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49642         return ret_ref;
49643 }
49644
49645 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Splice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49646         LDKSplice a_conv;
49647         a_conv.inner = untag_ptr(a);
49648         a_conv.is_owned = ptr_is_owned(a);
49649         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49650         a_conv.is_owned = false;
49651         LDKSplice b_conv;
49652         b_conv.inner = untag_ptr(b);
49653         b_conv.is_owned = ptr_is_owned(b);
49654         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49655         b_conv.is_owned = false;
49656         jboolean ret_conv = Splice_eq(&a_conv, &b_conv);
49657         return ret_conv;
49658 }
49659
49660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpliceAck_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49661         LDKSpliceAck this_obj_conv;
49662         this_obj_conv.inner = untag_ptr(this_obj);
49663         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49665         SpliceAck_free(this_obj_conv);
49666 }
49667
49668 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpliceAck_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
49669         LDKSpliceAck this_ptr_conv;
49670         this_ptr_conv.inner = untag_ptr(this_ptr);
49671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49673         this_ptr_conv.is_owned = false;
49674         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49675         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SpliceAck_get_channel_id(&this_ptr_conv));
49676         return ret_arr;
49677 }
49678
49679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpliceAck_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49680         LDKSpliceAck this_ptr_conv;
49681         this_ptr_conv.inner = untag_ptr(this_ptr);
49682         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49684         this_ptr_conv.is_owned = false;
49685         LDKThirtyTwoBytes val_ref;
49686         CHECK((*env)->GetArrayLength(env, val) == 32);
49687         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
49688         SpliceAck_set_channel_id(&this_ptr_conv, val_ref);
49689 }
49690
49691 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpliceAck_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
49692         LDKSpliceAck this_ptr_conv;
49693         this_ptr_conv.inner = untag_ptr(this_ptr);
49694         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49696         this_ptr_conv.is_owned = false;
49697         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49698         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SpliceAck_get_chain_hash(&this_ptr_conv));
49699         return ret_arr;
49700 }
49701
49702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpliceAck_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49703         LDKSpliceAck this_ptr_conv;
49704         this_ptr_conv.inner = untag_ptr(this_ptr);
49705         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49707         this_ptr_conv.is_owned = false;
49708         LDKThirtyTwoBytes val_ref;
49709         CHECK((*env)->GetArrayLength(env, val) == 32);
49710         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
49711         SpliceAck_set_chain_hash(&this_ptr_conv, val_ref);
49712 }
49713
49714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceAck_1get_1relative_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
49715         LDKSpliceAck this_ptr_conv;
49716         this_ptr_conv.inner = untag_ptr(this_ptr);
49717         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49719         this_ptr_conv.is_owned = false;
49720         int64_t ret_conv = SpliceAck_get_relative_satoshis(&this_ptr_conv);
49721         return ret_conv;
49722 }
49723
49724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpliceAck_1set_1relative_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49725         LDKSpliceAck this_ptr_conv;
49726         this_ptr_conv.inner = untag_ptr(this_ptr);
49727         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49729         this_ptr_conv.is_owned = false;
49730         SpliceAck_set_relative_satoshis(&this_ptr_conv, val);
49731 }
49732
49733 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpliceAck_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
49734         LDKSpliceAck this_ptr_conv;
49735         this_ptr_conv.inner = untag_ptr(this_ptr);
49736         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49738         this_ptr_conv.is_owned = false;
49739         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
49740         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, SpliceAck_get_funding_pubkey(&this_ptr_conv).compressed_form);
49741         return ret_arr;
49742 }
49743
49744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpliceAck_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49745         LDKSpliceAck this_ptr_conv;
49746         this_ptr_conv.inner = untag_ptr(this_ptr);
49747         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49749         this_ptr_conv.is_owned = false;
49750         LDKPublicKey val_ref;
49751         CHECK((*env)->GetArrayLength(env, val) == 33);
49752         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
49753         SpliceAck_set_funding_pubkey(&this_ptr_conv, val_ref);
49754 }
49755
49756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceAck_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray chain_hash_arg, int64_t relative_satoshis_arg, int8_tArray funding_pubkey_arg) {
49757         LDKThirtyTwoBytes channel_id_arg_ref;
49758         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
49759         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
49760         LDKThirtyTwoBytes chain_hash_arg_ref;
49761         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
49762         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
49763         LDKPublicKey funding_pubkey_arg_ref;
49764         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
49765         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
49766         LDKSpliceAck ret_var = SpliceAck_new(channel_id_arg_ref, chain_hash_arg_ref, relative_satoshis_arg, funding_pubkey_arg_ref);
49767         int64_t ret_ref = 0;
49768         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49769         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49770         return ret_ref;
49771 }
49772
49773 static inline uint64_t SpliceAck_clone_ptr(LDKSpliceAck *NONNULL_PTR arg) {
49774         LDKSpliceAck ret_var = SpliceAck_clone(arg);
49775         int64_t ret_ref = 0;
49776         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49777         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49778         return ret_ref;
49779 }
49780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceAck_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49781         LDKSpliceAck arg_conv;
49782         arg_conv.inner = untag_ptr(arg);
49783         arg_conv.is_owned = ptr_is_owned(arg);
49784         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49785         arg_conv.is_owned = false;
49786         int64_t ret_conv = SpliceAck_clone_ptr(&arg_conv);
49787         return ret_conv;
49788 }
49789
49790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceAck_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49791         LDKSpliceAck orig_conv;
49792         orig_conv.inner = untag_ptr(orig);
49793         orig_conv.is_owned = ptr_is_owned(orig);
49794         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49795         orig_conv.is_owned = false;
49796         LDKSpliceAck ret_var = SpliceAck_clone(&orig_conv);
49797         int64_t ret_ref = 0;
49798         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49799         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49800         return ret_ref;
49801 }
49802
49803 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SpliceAck_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49804         LDKSpliceAck a_conv;
49805         a_conv.inner = untag_ptr(a);
49806         a_conv.is_owned = ptr_is_owned(a);
49807         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49808         a_conv.is_owned = false;
49809         LDKSpliceAck b_conv;
49810         b_conv.inner = untag_ptr(b);
49811         b_conv.is_owned = ptr_is_owned(b);
49812         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49813         b_conv.is_owned = false;
49814         jboolean ret_conv = SpliceAck_eq(&a_conv, &b_conv);
49815         return ret_conv;
49816 }
49817
49818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpliceLocked_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49819         LDKSpliceLocked this_obj_conv;
49820         this_obj_conv.inner = untag_ptr(this_obj);
49821         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49823         SpliceLocked_free(this_obj_conv);
49824 }
49825
49826 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpliceLocked_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
49827         LDKSpliceLocked this_ptr_conv;
49828         this_ptr_conv.inner = untag_ptr(this_ptr);
49829         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49831         this_ptr_conv.is_owned = false;
49832         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49833         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SpliceLocked_get_channel_id(&this_ptr_conv));
49834         return ret_arr;
49835 }
49836
49837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpliceLocked_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49838         LDKSpliceLocked this_ptr_conv;
49839         this_ptr_conv.inner = untag_ptr(this_ptr);
49840         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49842         this_ptr_conv.is_owned = false;
49843         LDKThirtyTwoBytes val_ref;
49844         CHECK((*env)->GetArrayLength(env, val) == 32);
49845         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
49846         SpliceLocked_set_channel_id(&this_ptr_conv, val_ref);
49847 }
49848
49849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceLocked_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg) {
49850         LDKThirtyTwoBytes channel_id_arg_ref;
49851         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
49852         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
49853         LDKSpliceLocked ret_var = SpliceLocked_new(channel_id_arg_ref);
49854         int64_t ret_ref = 0;
49855         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49856         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49857         return ret_ref;
49858 }
49859
49860 static inline uint64_t SpliceLocked_clone_ptr(LDKSpliceLocked *NONNULL_PTR arg) {
49861         LDKSpliceLocked ret_var = SpliceLocked_clone(arg);
49862         int64_t ret_ref = 0;
49863         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49864         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49865         return ret_ref;
49866 }
49867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceLocked_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49868         LDKSpliceLocked arg_conv;
49869         arg_conv.inner = untag_ptr(arg);
49870         arg_conv.is_owned = ptr_is_owned(arg);
49871         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49872         arg_conv.is_owned = false;
49873         int64_t ret_conv = SpliceLocked_clone_ptr(&arg_conv);
49874         return ret_conv;
49875 }
49876
49877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceLocked_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49878         LDKSpliceLocked orig_conv;
49879         orig_conv.inner = untag_ptr(orig);
49880         orig_conv.is_owned = ptr_is_owned(orig);
49881         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49882         orig_conv.is_owned = false;
49883         LDKSpliceLocked ret_var = SpliceLocked_clone(&orig_conv);
49884         int64_t ret_ref = 0;
49885         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49886         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49887         return ret_ref;
49888 }
49889
49890 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SpliceLocked_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49891         LDKSpliceLocked a_conv;
49892         a_conv.inner = untag_ptr(a);
49893         a_conv.is_owned = ptr_is_owned(a);
49894         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49895         a_conv.is_owned = false;
49896         LDKSpliceLocked b_conv;
49897         b_conv.inner = untag_ptr(b);
49898         b_conv.is_owned = ptr_is_owned(b);
49899         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49900         b_conv.is_owned = false;
49901         jboolean ret_conv = SpliceLocked_eq(&a_conv, &b_conv);
49902         return ret_conv;
49903 }
49904
49905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49906         LDKTxAddInput this_obj_conv;
49907         this_obj_conv.inner = untag_ptr(this_obj);
49908         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49910         TxAddInput_free(this_obj_conv);
49911 }
49912
49913 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
49914         LDKTxAddInput this_ptr_conv;
49915         this_ptr_conv.inner = untag_ptr(this_ptr);
49916         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49918         this_ptr_conv.is_owned = false;
49919         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49920         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxAddInput_get_channel_id(&this_ptr_conv));
49921         return ret_arr;
49922 }
49923
49924 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49925         LDKTxAddInput this_ptr_conv;
49926         this_ptr_conv.inner = untag_ptr(this_ptr);
49927         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49929         this_ptr_conv.is_owned = false;
49930         LDKThirtyTwoBytes val_ref;
49931         CHECK((*env)->GetArrayLength(env, val) == 32);
49932         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
49933         TxAddInput_set_channel_id(&this_ptr_conv, val_ref);
49934 }
49935
49936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
49937         LDKTxAddInput this_ptr_conv;
49938         this_ptr_conv.inner = untag_ptr(this_ptr);
49939         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49941         this_ptr_conv.is_owned = false;
49942         int64_t ret_conv = TxAddInput_get_serial_id(&this_ptr_conv);
49943         return ret_conv;
49944 }
49945
49946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49947         LDKTxAddInput 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         TxAddInput_set_serial_id(&this_ptr_conv, val);
49953 }
49954
49955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1prevtx(JNIEnv *env, jclass clz, int64_t this_ptr) {
49956         LDKTxAddInput this_ptr_conv;
49957         this_ptr_conv.inner = untag_ptr(this_ptr);
49958         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49960         this_ptr_conv.is_owned = false;
49961         LDKTransactionU16LenLimited ret_var = TxAddInput_get_prevtx(&this_ptr_conv);
49962         int64_t ret_ref = 0;
49963         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49964         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49965         return ret_ref;
49966 }
49967
49968 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1prevtx(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49969         LDKTxAddInput this_ptr_conv;
49970         this_ptr_conv.inner = untag_ptr(this_ptr);
49971         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49973         this_ptr_conv.is_owned = false;
49974         LDKTransactionU16LenLimited val_conv;
49975         val_conv.inner = untag_ptr(val);
49976         val_conv.is_owned = ptr_is_owned(val);
49977         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49978         val_conv = TransactionU16LenLimited_clone(&val_conv);
49979         TxAddInput_set_prevtx(&this_ptr_conv, val_conv);
49980 }
49981
49982 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1prevtx_1out(JNIEnv *env, jclass clz, int64_t this_ptr) {
49983         LDKTxAddInput this_ptr_conv;
49984         this_ptr_conv.inner = untag_ptr(this_ptr);
49985         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49987         this_ptr_conv.is_owned = false;
49988         int32_t ret_conv = TxAddInput_get_prevtx_out(&this_ptr_conv);
49989         return ret_conv;
49990 }
49991
49992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1prevtx_1out(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
49993         LDKTxAddInput this_ptr_conv;
49994         this_ptr_conv.inner = untag_ptr(this_ptr);
49995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49997         this_ptr_conv.is_owned = false;
49998         TxAddInput_set_prevtx_out(&this_ptr_conv, val);
49999 }
50000
50001 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1sequence(JNIEnv *env, jclass clz, int64_t this_ptr) {
50002         LDKTxAddInput this_ptr_conv;
50003         this_ptr_conv.inner = untag_ptr(this_ptr);
50004         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50006         this_ptr_conv.is_owned = false;
50007         int32_t ret_conv = TxAddInput_get_sequence(&this_ptr_conv);
50008         return ret_conv;
50009 }
50010
50011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1sequence(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
50012         LDKTxAddInput this_ptr_conv;
50013         this_ptr_conv.inner = untag_ptr(this_ptr);
50014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50016         this_ptr_conv.is_owned = false;
50017         TxAddInput_set_sequence(&this_ptr_conv, val);
50018 }
50019
50020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t serial_id_arg, int64_t prevtx_arg, int32_t prevtx_out_arg, int32_t sequence_arg) {
50021         LDKThirtyTwoBytes channel_id_arg_ref;
50022         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
50023         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
50024         LDKTransactionU16LenLimited prevtx_arg_conv;
50025         prevtx_arg_conv.inner = untag_ptr(prevtx_arg);
50026         prevtx_arg_conv.is_owned = ptr_is_owned(prevtx_arg);
50027         CHECK_INNER_FIELD_ACCESS_OR_NULL(prevtx_arg_conv);
50028         prevtx_arg_conv = TransactionU16LenLimited_clone(&prevtx_arg_conv);
50029         LDKTxAddInput ret_var = TxAddInput_new(channel_id_arg_ref, serial_id_arg, prevtx_arg_conv, prevtx_out_arg, sequence_arg);
50030         int64_t ret_ref = 0;
50031         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50032         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50033         return ret_ref;
50034 }
50035
50036 static inline uint64_t TxAddInput_clone_ptr(LDKTxAddInput *NONNULL_PTR arg) {
50037         LDKTxAddInput ret_var = TxAddInput_clone(arg);
50038         int64_t ret_ref = 0;
50039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50041         return ret_ref;
50042 }
50043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50044         LDKTxAddInput arg_conv;
50045         arg_conv.inner = untag_ptr(arg);
50046         arg_conv.is_owned = ptr_is_owned(arg);
50047         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50048         arg_conv.is_owned = false;
50049         int64_t ret_conv = TxAddInput_clone_ptr(&arg_conv);
50050         return ret_conv;
50051 }
50052
50053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50054         LDKTxAddInput orig_conv;
50055         orig_conv.inner = untag_ptr(orig);
50056         orig_conv.is_owned = ptr_is_owned(orig);
50057         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50058         orig_conv.is_owned = false;
50059         LDKTxAddInput ret_var = TxAddInput_clone(&orig_conv);
50060         int64_t ret_ref = 0;
50061         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50062         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50063         return ret_ref;
50064 }
50065
50066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1hash(JNIEnv *env, jclass clz, int64_t o) {
50067         LDKTxAddInput o_conv;
50068         o_conv.inner = untag_ptr(o);
50069         o_conv.is_owned = ptr_is_owned(o);
50070         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50071         o_conv.is_owned = false;
50072         int64_t ret_conv = TxAddInput_hash(&o_conv);
50073         return ret_conv;
50074 }
50075
50076 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxAddInput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50077         LDKTxAddInput a_conv;
50078         a_conv.inner = untag_ptr(a);
50079         a_conv.is_owned = ptr_is_owned(a);
50080         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50081         a_conv.is_owned = false;
50082         LDKTxAddInput b_conv;
50083         b_conv.inner = untag_ptr(b);
50084         b_conv.is_owned = ptr_is_owned(b);
50085         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50086         b_conv.is_owned = false;
50087         jboolean ret_conv = TxAddInput_eq(&a_conv, &b_conv);
50088         return ret_conv;
50089 }
50090
50091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50092         LDKTxAddOutput this_obj_conv;
50093         this_obj_conv.inner = untag_ptr(this_obj);
50094         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50096         TxAddOutput_free(this_obj_conv);
50097 }
50098
50099 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
50100         LDKTxAddOutput this_ptr_conv;
50101         this_ptr_conv.inner = untag_ptr(this_ptr);
50102         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50104         this_ptr_conv.is_owned = false;
50105         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
50106         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxAddOutput_get_channel_id(&this_ptr_conv));
50107         return ret_arr;
50108 }
50109
50110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50111         LDKTxAddOutput this_ptr_conv;
50112         this_ptr_conv.inner = untag_ptr(this_ptr);
50113         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50115         this_ptr_conv.is_owned = false;
50116         LDKThirtyTwoBytes val_ref;
50117         CHECK((*env)->GetArrayLength(env, val) == 32);
50118         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
50119         TxAddOutput_set_channel_id(&this_ptr_conv, val_ref);
50120 }
50121
50122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1get_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
50123         LDKTxAddOutput this_ptr_conv;
50124         this_ptr_conv.inner = untag_ptr(this_ptr);
50125         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50127         this_ptr_conv.is_owned = false;
50128         int64_t ret_conv = TxAddOutput_get_serial_id(&this_ptr_conv);
50129         return ret_conv;
50130 }
50131
50132 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1set_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50133         LDKTxAddOutput this_ptr_conv;
50134         this_ptr_conv.inner = untag_ptr(this_ptr);
50135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50137         this_ptr_conv.is_owned = false;
50138         TxAddOutput_set_serial_id(&this_ptr_conv, val);
50139 }
50140
50141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1get_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
50142         LDKTxAddOutput this_ptr_conv;
50143         this_ptr_conv.inner = untag_ptr(this_ptr);
50144         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50146         this_ptr_conv.is_owned = false;
50147         int64_t ret_conv = TxAddOutput_get_sats(&this_ptr_conv);
50148         return ret_conv;
50149 }
50150
50151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1set_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50152         LDKTxAddOutput this_ptr_conv;
50153         this_ptr_conv.inner = untag_ptr(this_ptr);
50154         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50156         this_ptr_conv.is_owned = false;
50157         TxAddOutput_set_sats(&this_ptr_conv, val);
50158 }
50159
50160 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
50161         LDKTxAddOutput this_ptr_conv;
50162         this_ptr_conv.inner = untag_ptr(this_ptr);
50163         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50165         this_ptr_conv.is_owned = false;
50166         LDKCVec_u8Z ret_var = TxAddOutput_get_script(&this_ptr_conv);
50167         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50168         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50169         CVec_u8Z_free(ret_var);
50170         return ret_arr;
50171 }
50172
50173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50174         LDKTxAddOutput this_ptr_conv;
50175         this_ptr_conv.inner = untag_ptr(this_ptr);
50176         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50178         this_ptr_conv.is_owned = false;
50179         LDKCVec_u8Z val_ref;
50180         val_ref.datalen = (*env)->GetArrayLength(env, val);
50181         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
50182         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
50183         TxAddOutput_set_script(&this_ptr_conv, val_ref);
50184 }
50185
50186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t serial_id_arg, int64_t sats_arg, int8_tArray script_arg) {
50187         LDKThirtyTwoBytes channel_id_arg_ref;
50188         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
50189         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
50190         LDKCVec_u8Z script_arg_ref;
50191         script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
50192         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
50193         (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
50194         LDKTxAddOutput ret_var = TxAddOutput_new(channel_id_arg_ref, serial_id_arg, sats_arg, script_arg_ref);
50195         int64_t ret_ref = 0;
50196         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50197         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50198         return ret_ref;
50199 }
50200
50201 static inline uint64_t TxAddOutput_clone_ptr(LDKTxAddOutput *NONNULL_PTR arg) {
50202         LDKTxAddOutput ret_var = TxAddOutput_clone(arg);
50203         int64_t ret_ref = 0;
50204         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50205         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50206         return ret_ref;
50207 }
50208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50209         LDKTxAddOutput arg_conv;
50210         arg_conv.inner = untag_ptr(arg);
50211         arg_conv.is_owned = ptr_is_owned(arg);
50212         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50213         arg_conv.is_owned = false;
50214         int64_t ret_conv = TxAddOutput_clone_ptr(&arg_conv);
50215         return ret_conv;
50216 }
50217
50218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50219         LDKTxAddOutput orig_conv;
50220         orig_conv.inner = untag_ptr(orig);
50221         orig_conv.is_owned = ptr_is_owned(orig);
50222         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50223         orig_conv.is_owned = false;
50224         LDKTxAddOutput ret_var = TxAddOutput_clone(&orig_conv);
50225         int64_t ret_ref = 0;
50226         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50227         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50228         return ret_ref;
50229 }
50230
50231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
50232         LDKTxAddOutput o_conv;
50233         o_conv.inner = untag_ptr(o);
50234         o_conv.is_owned = ptr_is_owned(o);
50235         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50236         o_conv.is_owned = false;
50237         int64_t ret_conv = TxAddOutput_hash(&o_conv);
50238         return ret_conv;
50239 }
50240
50241 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50242         LDKTxAddOutput a_conv;
50243         a_conv.inner = untag_ptr(a);
50244         a_conv.is_owned = ptr_is_owned(a);
50245         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50246         a_conv.is_owned = false;
50247         LDKTxAddOutput b_conv;
50248         b_conv.inner = untag_ptr(b);
50249         b_conv.is_owned = ptr_is_owned(b);
50250         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50251         b_conv.is_owned = false;
50252         jboolean ret_conv = TxAddOutput_eq(&a_conv, &b_conv);
50253         return ret_conv;
50254 }
50255
50256 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50257         LDKTxRemoveInput this_obj_conv;
50258         this_obj_conv.inner = untag_ptr(this_obj);
50259         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50261         TxRemoveInput_free(this_obj_conv);
50262 }
50263
50264 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
50265         LDKTxRemoveInput this_ptr_conv;
50266         this_ptr_conv.inner = untag_ptr(this_ptr);
50267         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50269         this_ptr_conv.is_owned = false;
50270         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
50271         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxRemoveInput_get_channel_id(&this_ptr_conv));
50272         return ret_arr;
50273 }
50274
50275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50276         LDKTxRemoveInput this_ptr_conv;
50277         this_ptr_conv.inner = untag_ptr(this_ptr);
50278         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50280         this_ptr_conv.is_owned = false;
50281         LDKThirtyTwoBytes val_ref;
50282         CHECK((*env)->GetArrayLength(env, val) == 32);
50283         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
50284         TxRemoveInput_set_channel_id(&this_ptr_conv, val_ref);
50285 }
50286
50287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1get_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
50288         LDKTxRemoveInput this_ptr_conv;
50289         this_ptr_conv.inner = untag_ptr(this_ptr);
50290         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50292         this_ptr_conv.is_owned = false;
50293         int64_t ret_conv = TxRemoveInput_get_serial_id(&this_ptr_conv);
50294         return ret_conv;
50295 }
50296
50297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1set_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50298         LDKTxRemoveInput this_ptr_conv;
50299         this_ptr_conv.inner = untag_ptr(this_ptr);
50300         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50302         this_ptr_conv.is_owned = false;
50303         TxRemoveInput_set_serial_id(&this_ptr_conv, val);
50304 }
50305
50306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t serial_id_arg) {
50307         LDKThirtyTwoBytes channel_id_arg_ref;
50308         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
50309         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
50310         LDKTxRemoveInput ret_var = TxRemoveInput_new(channel_id_arg_ref, serial_id_arg);
50311         int64_t ret_ref = 0;
50312         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50313         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50314         return ret_ref;
50315 }
50316
50317 static inline uint64_t TxRemoveInput_clone_ptr(LDKTxRemoveInput *NONNULL_PTR arg) {
50318         LDKTxRemoveInput ret_var = TxRemoveInput_clone(arg);
50319         int64_t ret_ref = 0;
50320         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50321         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50322         return ret_ref;
50323 }
50324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50325         LDKTxRemoveInput arg_conv;
50326         arg_conv.inner = untag_ptr(arg);
50327         arg_conv.is_owned = ptr_is_owned(arg);
50328         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50329         arg_conv.is_owned = false;
50330         int64_t ret_conv = TxRemoveInput_clone_ptr(&arg_conv);
50331         return ret_conv;
50332 }
50333
50334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50335         LDKTxRemoveInput orig_conv;
50336         orig_conv.inner = untag_ptr(orig);
50337         orig_conv.is_owned = ptr_is_owned(orig);
50338         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50339         orig_conv.is_owned = false;
50340         LDKTxRemoveInput ret_var = TxRemoveInput_clone(&orig_conv);
50341         int64_t ret_ref = 0;
50342         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50343         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50344         return ret_ref;
50345 }
50346
50347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1hash(JNIEnv *env, jclass clz, int64_t o) {
50348         LDKTxRemoveInput o_conv;
50349         o_conv.inner = untag_ptr(o);
50350         o_conv.is_owned = ptr_is_owned(o);
50351         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50352         o_conv.is_owned = false;
50353         int64_t ret_conv = TxRemoveInput_hash(&o_conv);
50354         return ret_conv;
50355 }
50356
50357 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50358         LDKTxRemoveInput a_conv;
50359         a_conv.inner = untag_ptr(a);
50360         a_conv.is_owned = ptr_is_owned(a);
50361         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50362         a_conv.is_owned = false;
50363         LDKTxRemoveInput b_conv;
50364         b_conv.inner = untag_ptr(b);
50365         b_conv.is_owned = ptr_is_owned(b);
50366         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50367         b_conv.is_owned = false;
50368         jboolean ret_conv = TxRemoveInput_eq(&a_conv, &b_conv);
50369         return ret_conv;
50370 }
50371
50372 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50373         LDKTxRemoveOutput this_obj_conv;
50374         this_obj_conv.inner = untag_ptr(this_obj);
50375         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50377         TxRemoveOutput_free(this_obj_conv);
50378 }
50379
50380 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
50381         LDKTxRemoveOutput this_ptr_conv;
50382         this_ptr_conv.inner = untag_ptr(this_ptr);
50383         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50385         this_ptr_conv.is_owned = false;
50386         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
50387         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxRemoveOutput_get_channel_id(&this_ptr_conv));
50388         return ret_arr;
50389 }
50390
50391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50392         LDKTxRemoveOutput this_ptr_conv;
50393         this_ptr_conv.inner = untag_ptr(this_ptr);
50394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50396         this_ptr_conv.is_owned = false;
50397         LDKThirtyTwoBytes val_ref;
50398         CHECK((*env)->GetArrayLength(env, val) == 32);
50399         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
50400         TxRemoveOutput_set_channel_id(&this_ptr_conv, val_ref);
50401 }
50402
50403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1get_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
50404         LDKTxRemoveOutput this_ptr_conv;
50405         this_ptr_conv.inner = untag_ptr(this_ptr);
50406         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50408         this_ptr_conv.is_owned = false;
50409         int64_t ret_conv = TxRemoveOutput_get_serial_id(&this_ptr_conv);
50410         return ret_conv;
50411 }
50412
50413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1set_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50414         LDKTxRemoveOutput this_ptr_conv;
50415         this_ptr_conv.inner = untag_ptr(this_ptr);
50416         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50418         this_ptr_conv.is_owned = false;
50419         TxRemoveOutput_set_serial_id(&this_ptr_conv, val);
50420 }
50421
50422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t serial_id_arg) {
50423         LDKThirtyTwoBytes channel_id_arg_ref;
50424         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
50425         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
50426         LDKTxRemoveOutput ret_var = TxRemoveOutput_new(channel_id_arg_ref, serial_id_arg);
50427         int64_t ret_ref = 0;
50428         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50429         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50430         return ret_ref;
50431 }
50432
50433 static inline uint64_t TxRemoveOutput_clone_ptr(LDKTxRemoveOutput *NONNULL_PTR arg) {
50434         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(arg);
50435         int64_t ret_ref = 0;
50436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50438         return ret_ref;
50439 }
50440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50441         LDKTxRemoveOutput arg_conv;
50442         arg_conv.inner = untag_ptr(arg);
50443         arg_conv.is_owned = ptr_is_owned(arg);
50444         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50445         arg_conv.is_owned = false;
50446         int64_t ret_conv = TxRemoveOutput_clone_ptr(&arg_conv);
50447         return ret_conv;
50448 }
50449
50450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50451         LDKTxRemoveOutput orig_conv;
50452         orig_conv.inner = untag_ptr(orig);
50453         orig_conv.is_owned = ptr_is_owned(orig);
50454         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50455         orig_conv.is_owned = false;
50456         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(&orig_conv);
50457         int64_t ret_ref = 0;
50458         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50459         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50460         return ret_ref;
50461 }
50462
50463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
50464         LDKTxRemoveOutput o_conv;
50465         o_conv.inner = untag_ptr(o);
50466         o_conv.is_owned = ptr_is_owned(o);
50467         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50468         o_conv.is_owned = false;
50469         int64_t ret_conv = TxRemoveOutput_hash(&o_conv);
50470         return ret_conv;
50471 }
50472
50473 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50474         LDKTxRemoveOutput a_conv;
50475         a_conv.inner = untag_ptr(a);
50476         a_conv.is_owned = ptr_is_owned(a);
50477         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50478         a_conv.is_owned = false;
50479         LDKTxRemoveOutput b_conv;
50480         b_conv.inner = untag_ptr(b);
50481         b_conv.is_owned = ptr_is_owned(b);
50482         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50483         b_conv.is_owned = false;
50484         jboolean ret_conv = TxRemoveOutput_eq(&a_conv, &b_conv);
50485         return ret_conv;
50486 }
50487
50488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxComplete_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50489         LDKTxComplete this_obj_conv;
50490         this_obj_conv.inner = untag_ptr(this_obj);
50491         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50493         TxComplete_free(this_obj_conv);
50494 }
50495
50496 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxComplete_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
50497         LDKTxComplete this_ptr_conv;
50498         this_ptr_conv.inner = untag_ptr(this_ptr);
50499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50501         this_ptr_conv.is_owned = false;
50502         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
50503         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxComplete_get_channel_id(&this_ptr_conv));
50504         return ret_arr;
50505 }
50506
50507 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxComplete_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50508         LDKTxComplete this_ptr_conv;
50509         this_ptr_conv.inner = untag_ptr(this_ptr);
50510         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50512         this_ptr_conv.is_owned = false;
50513         LDKThirtyTwoBytes val_ref;
50514         CHECK((*env)->GetArrayLength(env, val) == 32);
50515         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
50516         TxComplete_set_channel_id(&this_ptr_conv, val_ref);
50517 }
50518
50519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg) {
50520         LDKThirtyTwoBytes channel_id_arg_ref;
50521         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
50522         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
50523         LDKTxComplete ret_var = TxComplete_new(channel_id_arg_ref);
50524         int64_t ret_ref = 0;
50525         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50526         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50527         return ret_ref;
50528 }
50529
50530 static inline uint64_t TxComplete_clone_ptr(LDKTxComplete *NONNULL_PTR arg) {
50531         LDKTxComplete ret_var = TxComplete_clone(arg);
50532         int64_t ret_ref = 0;
50533         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50534         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50535         return ret_ref;
50536 }
50537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50538         LDKTxComplete arg_conv;
50539         arg_conv.inner = untag_ptr(arg);
50540         arg_conv.is_owned = ptr_is_owned(arg);
50541         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50542         arg_conv.is_owned = false;
50543         int64_t ret_conv = TxComplete_clone_ptr(&arg_conv);
50544         return ret_conv;
50545 }
50546
50547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50548         LDKTxComplete orig_conv;
50549         orig_conv.inner = untag_ptr(orig);
50550         orig_conv.is_owned = ptr_is_owned(orig);
50551         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50552         orig_conv.is_owned = false;
50553         LDKTxComplete ret_var = TxComplete_clone(&orig_conv);
50554         int64_t ret_ref = 0;
50555         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50556         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50557         return ret_ref;
50558 }
50559
50560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1hash(JNIEnv *env, jclass clz, int64_t o) {
50561         LDKTxComplete o_conv;
50562         o_conv.inner = untag_ptr(o);
50563         o_conv.is_owned = ptr_is_owned(o);
50564         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50565         o_conv.is_owned = false;
50566         int64_t ret_conv = TxComplete_hash(&o_conv);
50567         return ret_conv;
50568 }
50569
50570 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxComplete_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50571         LDKTxComplete a_conv;
50572         a_conv.inner = untag_ptr(a);
50573         a_conv.is_owned = ptr_is_owned(a);
50574         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50575         a_conv.is_owned = false;
50576         LDKTxComplete b_conv;
50577         b_conv.inner = untag_ptr(b);
50578         b_conv.is_owned = ptr_is_owned(b);
50579         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50580         b_conv.is_owned = false;
50581         jboolean ret_conv = TxComplete_eq(&a_conv, &b_conv);
50582         return ret_conv;
50583 }
50584
50585 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50586         LDKTxSignatures this_obj_conv;
50587         this_obj_conv.inner = untag_ptr(this_obj);
50588         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50590         TxSignatures_free(this_obj_conv);
50591 }
50592
50593 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
50594         LDKTxSignatures this_ptr_conv;
50595         this_ptr_conv.inner = untag_ptr(this_ptr);
50596         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50598         this_ptr_conv.is_owned = false;
50599         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
50600         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxSignatures_get_channel_id(&this_ptr_conv));
50601         return ret_arr;
50602 }
50603
50604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50605         LDKTxSignatures this_ptr_conv;
50606         this_ptr_conv.inner = untag_ptr(this_ptr);
50607         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50609         this_ptr_conv.is_owned = false;
50610         LDKThirtyTwoBytes val_ref;
50611         CHECK((*env)->GetArrayLength(env, val) == 32);
50612         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
50613         TxSignatures_set_channel_id(&this_ptr_conv, val_ref);
50614 }
50615
50616 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxSignatures_1get_1tx_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
50617         LDKTxSignatures this_ptr_conv;
50618         this_ptr_conv.inner = untag_ptr(this_ptr);
50619         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50621         this_ptr_conv.is_owned = false;
50622         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
50623         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxSignatures_get_tx_hash(&this_ptr_conv));
50624         return ret_arr;
50625 }
50626
50627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1set_1tx_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50628         LDKTxSignatures this_ptr_conv;
50629         this_ptr_conv.inner = untag_ptr(this_ptr);
50630         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50632         this_ptr_conv.is_owned = false;
50633         LDKThirtyTwoBytes val_ref;
50634         CHECK((*env)->GetArrayLength(env, val) == 32);
50635         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
50636         TxSignatures_set_tx_hash(&this_ptr_conv, val_ref);
50637 }
50638
50639 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_TxSignatures_1get_1witnesses(JNIEnv *env, jclass clz, int64_t this_ptr) {
50640         LDKTxSignatures this_ptr_conv;
50641         this_ptr_conv.inner = untag_ptr(this_ptr);
50642         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50644         this_ptr_conv.is_owned = false;
50645         LDKCVec_WitnessZ ret_var = TxSignatures_get_witnesses(&this_ptr_conv);
50646         jobjectArray ret_arr = NULL;
50647         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
50648         ;
50649         for (size_t i = 0; i < ret_var.datalen; i++) {
50650                 LDKWitness ret_conv_8_var = ret_var.data[i];
50651                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
50652                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
50653                 Witness_free(ret_conv_8_var);
50654                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
50655         }
50656         
50657         FREE(ret_var.data);
50658         return ret_arr;
50659 }
50660
50661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1set_1witnesses(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
50662         LDKTxSignatures this_ptr_conv;
50663         this_ptr_conv.inner = untag_ptr(this_ptr);
50664         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50666         this_ptr_conv.is_owned = false;
50667         LDKCVec_WitnessZ val_constr;
50668         val_constr.datalen = (*env)->GetArrayLength(env, val);
50669         if (val_constr.datalen > 0)
50670                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
50671         else
50672                 val_constr.data = NULL;
50673         for (size_t i = 0; i < val_constr.datalen; i++) {
50674                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
50675                 LDKWitness val_conv_8_ref;
50676                 val_conv_8_ref.datalen = (*env)->GetArrayLength(env, val_conv_8);
50677                 val_conv_8_ref.data = MALLOC(val_conv_8_ref.datalen, "LDKWitness Bytes");
50678                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, val_conv_8_ref.datalen, val_conv_8_ref.data);
50679                 val_conv_8_ref.data_is_owned = true;
50680                 val_constr.data[i] = val_conv_8_ref;
50681         }
50682         TxSignatures_set_witnesses(&this_ptr_conv, val_constr);
50683 }
50684
50685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray tx_hash_arg, jobjectArray witnesses_arg) {
50686         LDKThirtyTwoBytes channel_id_arg_ref;
50687         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
50688         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
50689         LDKThirtyTwoBytes tx_hash_arg_ref;
50690         CHECK((*env)->GetArrayLength(env, tx_hash_arg) == 32);
50691         (*env)->GetByteArrayRegion(env, tx_hash_arg, 0, 32, tx_hash_arg_ref.data);
50692         LDKCVec_WitnessZ witnesses_arg_constr;
50693         witnesses_arg_constr.datalen = (*env)->GetArrayLength(env, witnesses_arg);
50694         if (witnesses_arg_constr.datalen > 0)
50695                 witnesses_arg_constr.data = MALLOC(witnesses_arg_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
50696         else
50697                 witnesses_arg_constr.data = NULL;
50698         for (size_t i = 0; i < witnesses_arg_constr.datalen; i++) {
50699                 int8_tArray witnesses_arg_conv_8 = (*env)->GetObjectArrayElement(env, witnesses_arg, i);
50700                 LDKWitness witnesses_arg_conv_8_ref;
50701                 witnesses_arg_conv_8_ref.datalen = (*env)->GetArrayLength(env, witnesses_arg_conv_8);
50702                 witnesses_arg_conv_8_ref.data = MALLOC(witnesses_arg_conv_8_ref.datalen, "LDKWitness Bytes");
50703                 (*env)->GetByteArrayRegion(env, witnesses_arg_conv_8, 0, witnesses_arg_conv_8_ref.datalen, witnesses_arg_conv_8_ref.data);
50704                 witnesses_arg_conv_8_ref.data_is_owned = true;
50705                 witnesses_arg_constr.data[i] = witnesses_arg_conv_8_ref;
50706         }
50707         LDKTxSignatures ret_var = TxSignatures_new(channel_id_arg_ref, tx_hash_arg_ref, witnesses_arg_constr);
50708         int64_t ret_ref = 0;
50709         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50710         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50711         return ret_ref;
50712 }
50713
50714 static inline uint64_t TxSignatures_clone_ptr(LDKTxSignatures *NONNULL_PTR arg) {
50715         LDKTxSignatures ret_var = TxSignatures_clone(arg);
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 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50722         LDKTxSignatures arg_conv;
50723         arg_conv.inner = untag_ptr(arg);
50724         arg_conv.is_owned = ptr_is_owned(arg);
50725         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50726         arg_conv.is_owned = false;
50727         int64_t ret_conv = TxSignatures_clone_ptr(&arg_conv);
50728         return ret_conv;
50729 }
50730
50731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50732         LDKTxSignatures orig_conv;
50733         orig_conv.inner = untag_ptr(orig);
50734         orig_conv.is_owned = ptr_is_owned(orig);
50735         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50736         orig_conv.is_owned = false;
50737         LDKTxSignatures ret_var = TxSignatures_clone(&orig_conv);
50738         int64_t ret_ref = 0;
50739         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50740         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50741         return ret_ref;
50742 }
50743
50744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
50745         LDKTxSignatures o_conv;
50746         o_conv.inner = untag_ptr(o);
50747         o_conv.is_owned = ptr_is_owned(o);
50748         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50749         o_conv.is_owned = false;
50750         int64_t ret_conv = TxSignatures_hash(&o_conv);
50751         return ret_conv;
50752 }
50753
50754 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxSignatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50755         LDKTxSignatures a_conv;
50756         a_conv.inner = untag_ptr(a);
50757         a_conv.is_owned = ptr_is_owned(a);
50758         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50759         a_conv.is_owned = false;
50760         LDKTxSignatures b_conv;
50761         b_conv.inner = untag_ptr(b);
50762         b_conv.is_owned = ptr_is_owned(b);
50763         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50764         b_conv.is_owned = false;
50765         jboolean ret_conv = TxSignatures_eq(&a_conv, &b_conv);
50766         return ret_conv;
50767 }
50768
50769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50770         LDKTxInitRbf this_obj_conv;
50771         this_obj_conv.inner = untag_ptr(this_obj);
50772         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50774         TxInitRbf_free(this_obj_conv);
50775 }
50776
50777 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
50778         LDKTxInitRbf this_ptr_conv;
50779         this_ptr_conv.inner = untag_ptr(this_ptr);
50780         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50782         this_ptr_conv.is_owned = false;
50783         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
50784         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxInitRbf_get_channel_id(&this_ptr_conv));
50785         return ret_arr;
50786 }
50787
50788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50789         LDKTxInitRbf this_ptr_conv;
50790         this_ptr_conv.inner = untag_ptr(this_ptr);
50791         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50793         this_ptr_conv.is_owned = false;
50794         LDKThirtyTwoBytes val_ref;
50795         CHECK((*env)->GetArrayLength(env, val) == 32);
50796         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
50797         TxInitRbf_set_channel_id(&this_ptr_conv, val_ref);
50798 }
50799
50800 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1get_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr) {
50801         LDKTxInitRbf this_ptr_conv;
50802         this_ptr_conv.inner = untag_ptr(this_ptr);
50803         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50805         this_ptr_conv.is_owned = false;
50806         int32_t ret_conv = TxInitRbf_get_locktime(&this_ptr_conv);
50807         return ret_conv;
50808 }
50809
50810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1set_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
50811         LDKTxInitRbf this_ptr_conv;
50812         this_ptr_conv.inner = untag_ptr(this_ptr);
50813         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50815         this_ptr_conv.is_owned = false;
50816         TxInitRbf_set_locktime(&this_ptr_conv, val);
50817 }
50818
50819 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1get_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
50820         LDKTxInitRbf this_ptr_conv;
50821         this_ptr_conv.inner = untag_ptr(this_ptr);
50822         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50824         this_ptr_conv.is_owned = false;
50825         int32_t ret_conv = TxInitRbf_get_feerate_sat_per_1000_weight(&this_ptr_conv);
50826         return ret_conv;
50827 }
50828
50829 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) {
50830         LDKTxInitRbf this_ptr_conv;
50831         this_ptr_conv.inner = untag_ptr(this_ptr);
50832         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50834         this_ptr_conv.is_owned = false;
50835         TxInitRbf_set_feerate_sat_per_1000_weight(&this_ptr_conv, val);
50836 }
50837
50838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1get_1funding_1output_1contribution(JNIEnv *env, jclass clz, int64_t this_ptr) {
50839         LDKTxInitRbf this_ptr_conv;
50840         this_ptr_conv.inner = untag_ptr(this_ptr);
50841         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50843         this_ptr_conv.is_owned = false;
50844         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
50845         *ret_copy = TxInitRbf_get_funding_output_contribution(&this_ptr_conv);
50846         int64_t ret_ref = tag_ptr(ret_copy, true);
50847         return ret_ref;
50848 }
50849
50850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1set_1funding_1output_1contribution(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50851         LDKTxInitRbf this_ptr_conv;
50852         this_ptr_conv.inner = untag_ptr(this_ptr);
50853         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50855         this_ptr_conv.is_owned = false;
50856         void* val_ptr = untag_ptr(val);
50857         CHECK_ACCESS(val_ptr);
50858         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
50859         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
50860         TxInitRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
50861 }
50862
50863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int32_t locktime_arg, int32_t feerate_sat_per_1000_weight_arg, int64_t funding_output_contribution_arg) {
50864         LDKThirtyTwoBytes channel_id_arg_ref;
50865         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
50866         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
50867         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
50868         CHECK_ACCESS(funding_output_contribution_arg_ptr);
50869         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
50870         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
50871         LDKTxInitRbf ret_var = TxInitRbf_new(channel_id_arg_ref, locktime_arg, feerate_sat_per_1000_weight_arg, funding_output_contribution_arg_conv);
50872         int64_t ret_ref = 0;
50873         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50874         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50875         return ret_ref;
50876 }
50877
50878 static inline uint64_t TxInitRbf_clone_ptr(LDKTxInitRbf *NONNULL_PTR arg) {
50879         LDKTxInitRbf ret_var = TxInitRbf_clone(arg);
50880         int64_t ret_ref = 0;
50881         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50882         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50883         return ret_ref;
50884 }
50885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50886         LDKTxInitRbf arg_conv;
50887         arg_conv.inner = untag_ptr(arg);
50888         arg_conv.is_owned = ptr_is_owned(arg);
50889         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50890         arg_conv.is_owned = false;
50891         int64_t ret_conv = TxInitRbf_clone_ptr(&arg_conv);
50892         return ret_conv;
50893 }
50894
50895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50896         LDKTxInitRbf orig_conv;
50897         orig_conv.inner = untag_ptr(orig);
50898         orig_conv.is_owned = ptr_is_owned(orig);
50899         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50900         orig_conv.is_owned = false;
50901         LDKTxInitRbf ret_var = TxInitRbf_clone(&orig_conv);
50902         int64_t ret_ref = 0;
50903         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50904         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50905         return ret_ref;
50906 }
50907
50908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1hash(JNIEnv *env, jclass clz, int64_t o) {
50909         LDKTxInitRbf o_conv;
50910         o_conv.inner = untag_ptr(o);
50911         o_conv.is_owned = ptr_is_owned(o);
50912         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50913         o_conv.is_owned = false;
50914         int64_t ret_conv = TxInitRbf_hash(&o_conv);
50915         return ret_conv;
50916 }
50917
50918 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50919         LDKTxInitRbf a_conv;
50920         a_conv.inner = untag_ptr(a);
50921         a_conv.is_owned = ptr_is_owned(a);
50922         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50923         a_conv.is_owned = false;
50924         LDKTxInitRbf b_conv;
50925         b_conv.inner = untag_ptr(b);
50926         b_conv.is_owned = ptr_is_owned(b);
50927         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50928         b_conv.is_owned = false;
50929         jboolean ret_conv = TxInitRbf_eq(&a_conv, &b_conv);
50930         return ret_conv;
50931 }
50932
50933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50934         LDKTxAckRbf this_obj_conv;
50935         this_obj_conv.inner = untag_ptr(this_obj);
50936         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50938         TxAckRbf_free(this_obj_conv);
50939 }
50940
50941 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
50942         LDKTxAckRbf this_ptr_conv;
50943         this_ptr_conv.inner = untag_ptr(this_ptr);
50944         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50946         this_ptr_conv.is_owned = false;
50947         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
50948         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxAckRbf_get_channel_id(&this_ptr_conv));
50949         return ret_arr;
50950 }
50951
50952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50953         LDKTxAckRbf this_ptr_conv;
50954         this_ptr_conv.inner = untag_ptr(this_ptr);
50955         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50957         this_ptr_conv.is_owned = false;
50958         LDKThirtyTwoBytes val_ref;
50959         CHECK((*env)->GetArrayLength(env, val) == 32);
50960         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
50961         TxAckRbf_set_channel_id(&this_ptr_conv, val_ref);
50962 }
50963
50964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1get_1funding_1output_1contribution(JNIEnv *env, jclass clz, int64_t this_ptr) {
50965         LDKTxAckRbf this_ptr_conv;
50966         this_ptr_conv.inner = untag_ptr(this_ptr);
50967         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50969         this_ptr_conv.is_owned = false;
50970         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
50971         *ret_copy = TxAckRbf_get_funding_output_contribution(&this_ptr_conv);
50972         int64_t ret_ref = tag_ptr(ret_copy, true);
50973         return ret_ref;
50974 }
50975
50976 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1set_1funding_1output_1contribution(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50977         LDKTxAckRbf this_ptr_conv;
50978         this_ptr_conv.inner = untag_ptr(this_ptr);
50979         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50981         this_ptr_conv.is_owned = false;
50982         void* val_ptr = untag_ptr(val);
50983         CHECK_ACCESS(val_ptr);
50984         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
50985         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
50986         TxAckRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
50987 }
50988
50989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t funding_output_contribution_arg) {
50990         LDKThirtyTwoBytes channel_id_arg_ref;
50991         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
50992         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
50993         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
50994         CHECK_ACCESS(funding_output_contribution_arg_ptr);
50995         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
50996         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
50997         LDKTxAckRbf ret_var = TxAckRbf_new(channel_id_arg_ref, funding_output_contribution_arg_conv);
50998         int64_t ret_ref = 0;
50999         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51000         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51001         return ret_ref;
51002 }
51003
51004 static inline uint64_t TxAckRbf_clone_ptr(LDKTxAckRbf *NONNULL_PTR arg) {
51005         LDKTxAckRbf ret_var = TxAckRbf_clone(arg);
51006         int64_t ret_ref = 0;
51007         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51008         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51009         return ret_ref;
51010 }
51011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51012         LDKTxAckRbf arg_conv;
51013         arg_conv.inner = untag_ptr(arg);
51014         arg_conv.is_owned = ptr_is_owned(arg);
51015         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51016         arg_conv.is_owned = false;
51017         int64_t ret_conv = TxAckRbf_clone_ptr(&arg_conv);
51018         return ret_conv;
51019 }
51020
51021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51022         LDKTxAckRbf orig_conv;
51023         orig_conv.inner = untag_ptr(orig);
51024         orig_conv.is_owned = ptr_is_owned(orig);
51025         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51026         orig_conv.is_owned = false;
51027         LDKTxAckRbf ret_var = TxAckRbf_clone(&orig_conv);
51028         int64_t ret_ref = 0;
51029         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51030         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51031         return ret_ref;
51032 }
51033
51034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1hash(JNIEnv *env, jclass clz, int64_t o) {
51035         LDKTxAckRbf o_conv;
51036         o_conv.inner = untag_ptr(o);
51037         o_conv.is_owned = ptr_is_owned(o);
51038         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51039         o_conv.is_owned = false;
51040         int64_t ret_conv = TxAckRbf_hash(&o_conv);
51041         return ret_conv;
51042 }
51043
51044 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
51045         LDKTxAckRbf a_conv;
51046         a_conv.inner = untag_ptr(a);
51047         a_conv.is_owned = ptr_is_owned(a);
51048         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51049         a_conv.is_owned = false;
51050         LDKTxAckRbf b_conv;
51051         b_conv.inner = untag_ptr(b);
51052         b_conv.is_owned = ptr_is_owned(b);
51053         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51054         b_conv.is_owned = false;
51055         jboolean ret_conv = TxAckRbf_eq(&a_conv, &b_conv);
51056         return ret_conv;
51057 }
51058
51059 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAbort_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51060         LDKTxAbort this_obj_conv;
51061         this_obj_conv.inner = untag_ptr(this_obj);
51062         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51064         TxAbort_free(this_obj_conv);
51065 }
51066
51067 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAbort_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
51068         LDKTxAbort this_ptr_conv;
51069         this_ptr_conv.inner = untag_ptr(this_ptr);
51070         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51072         this_ptr_conv.is_owned = false;
51073         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
51074         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxAbort_get_channel_id(&this_ptr_conv));
51075         return ret_arr;
51076 }
51077
51078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAbort_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
51079         LDKTxAbort this_ptr_conv;
51080         this_ptr_conv.inner = untag_ptr(this_ptr);
51081         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51083         this_ptr_conv.is_owned = false;
51084         LDKThirtyTwoBytes val_ref;
51085         CHECK((*env)->GetArrayLength(env, val) == 32);
51086         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
51087         TxAbort_set_channel_id(&this_ptr_conv, val_ref);
51088 }
51089
51090 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAbort_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
51091         LDKTxAbort this_ptr_conv;
51092         this_ptr_conv.inner = untag_ptr(this_ptr);
51093         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51095         this_ptr_conv.is_owned = false;
51096         LDKCVec_u8Z ret_var = TxAbort_get_data(&this_ptr_conv);
51097         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51098         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51099         CVec_u8Z_free(ret_var);
51100         return ret_arr;
51101 }
51102
51103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAbort_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
51104         LDKTxAbort this_ptr_conv;
51105         this_ptr_conv.inner = untag_ptr(this_ptr);
51106         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51108         this_ptr_conv.is_owned = false;
51109         LDKCVec_u8Z val_ref;
51110         val_ref.datalen = (*env)->GetArrayLength(env, val);
51111         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
51112         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
51113         TxAbort_set_data(&this_ptr_conv, val_ref);
51114 }
51115
51116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray data_arg) {
51117         LDKThirtyTwoBytes channel_id_arg_ref;
51118         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
51119         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
51120         LDKCVec_u8Z data_arg_ref;
51121         data_arg_ref.datalen = (*env)->GetArrayLength(env, data_arg);
51122         data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
51123         (*env)->GetByteArrayRegion(env, data_arg, 0, data_arg_ref.datalen, data_arg_ref.data);
51124         LDKTxAbort ret_var = TxAbort_new(channel_id_arg_ref, data_arg_ref);
51125         int64_t ret_ref = 0;
51126         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51127         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51128         return ret_ref;
51129 }
51130
51131 static inline uint64_t TxAbort_clone_ptr(LDKTxAbort *NONNULL_PTR arg) {
51132         LDKTxAbort ret_var = TxAbort_clone(arg);
51133         int64_t ret_ref = 0;
51134         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51135         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51136         return ret_ref;
51137 }
51138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51139         LDKTxAbort arg_conv;
51140         arg_conv.inner = untag_ptr(arg);
51141         arg_conv.is_owned = ptr_is_owned(arg);
51142         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51143         arg_conv.is_owned = false;
51144         int64_t ret_conv = TxAbort_clone_ptr(&arg_conv);
51145         return ret_conv;
51146 }
51147
51148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51149         LDKTxAbort orig_conv;
51150         orig_conv.inner = untag_ptr(orig);
51151         orig_conv.is_owned = ptr_is_owned(orig);
51152         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51153         orig_conv.is_owned = false;
51154         LDKTxAbort ret_var = TxAbort_clone(&orig_conv);
51155         int64_t ret_ref = 0;
51156         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51157         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51158         return ret_ref;
51159 }
51160
51161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1hash(JNIEnv *env, jclass clz, int64_t o) {
51162         LDKTxAbort o_conv;
51163         o_conv.inner = untag_ptr(o);
51164         o_conv.is_owned = ptr_is_owned(o);
51165         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51166         o_conv.is_owned = false;
51167         int64_t ret_conv = TxAbort_hash(&o_conv);
51168         return ret_conv;
51169 }
51170
51171 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxAbort_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
51172         LDKTxAbort a_conv;
51173         a_conv.inner = untag_ptr(a);
51174         a_conv.is_owned = ptr_is_owned(a);
51175         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51176         a_conv.is_owned = false;
51177         LDKTxAbort b_conv;
51178         b_conv.inner = untag_ptr(b);
51179         b_conv.is_owned = ptr_is_owned(b);
51180         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51181         b_conv.is_owned = false;
51182         jboolean ret_conv = TxAbort_eq(&a_conv, &b_conv);
51183         return ret_conv;
51184 }
51185
51186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51187         LDKShutdown this_obj_conv;
51188         this_obj_conv.inner = untag_ptr(this_obj);
51189         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51191         Shutdown_free(this_obj_conv);
51192 }
51193
51194 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
51195         LDKShutdown this_ptr_conv;
51196         this_ptr_conv.inner = untag_ptr(this_ptr);
51197         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51199         this_ptr_conv.is_owned = false;
51200         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
51201         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
51202         return ret_arr;
51203 }
51204
51205 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
51206         LDKShutdown this_ptr_conv;
51207         this_ptr_conv.inner = untag_ptr(this_ptr);
51208         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51210         this_ptr_conv.is_owned = false;
51211         LDKThirtyTwoBytes val_ref;
51212         CHECK((*env)->GetArrayLength(env, val) == 32);
51213         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
51214         Shutdown_set_channel_id(&this_ptr_conv, val_ref);
51215 }
51216
51217 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
51218         LDKShutdown this_ptr_conv;
51219         this_ptr_conv.inner = untag_ptr(this_ptr);
51220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51222         this_ptr_conv.is_owned = false;
51223         LDKCVec_u8Z ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
51224         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51225         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51226         CVec_u8Z_free(ret_var);
51227         return ret_arr;
51228 }
51229
51230 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
51231         LDKShutdown this_ptr_conv;
51232         this_ptr_conv.inner = untag_ptr(this_ptr);
51233         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51235         this_ptr_conv.is_owned = false;
51236         LDKCVec_u8Z val_ref;
51237         val_ref.datalen = (*env)->GetArrayLength(env, val);
51238         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
51239         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
51240         Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
51241 }
51242
51243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
51244         LDKThirtyTwoBytes channel_id_arg_ref;
51245         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
51246         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
51247         LDKCVec_u8Z scriptpubkey_arg_ref;
51248         scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
51249         scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
51250         (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
51251         LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
51252         int64_t ret_ref = 0;
51253         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51254         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51255         return ret_ref;
51256 }
51257
51258 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
51259         LDKShutdown ret_var = Shutdown_clone(arg);
51260         int64_t ret_ref = 0;
51261         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51262         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51263         return ret_ref;
51264 }
51265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51266         LDKShutdown arg_conv;
51267         arg_conv.inner = untag_ptr(arg);
51268         arg_conv.is_owned = ptr_is_owned(arg);
51269         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51270         arg_conv.is_owned = false;
51271         int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
51272         return ret_conv;
51273 }
51274
51275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51276         LDKShutdown orig_conv;
51277         orig_conv.inner = untag_ptr(orig);
51278         orig_conv.is_owned = ptr_is_owned(orig);
51279         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51280         orig_conv.is_owned = false;
51281         LDKShutdown ret_var = Shutdown_clone(&orig_conv);
51282         int64_t ret_ref = 0;
51283         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51284         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51285         return ret_ref;
51286 }
51287
51288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1hash(JNIEnv *env, jclass clz, int64_t o) {
51289         LDKShutdown o_conv;
51290         o_conv.inner = untag_ptr(o);
51291         o_conv.is_owned = ptr_is_owned(o);
51292         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51293         o_conv.is_owned = false;
51294         int64_t ret_conv = Shutdown_hash(&o_conv);
51295         return ret_conv;
51296 }
51297
51298 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Shutdown_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
51299         LDKShutdown a_conv;
51300         a_conv.inner = untag_ptr(a);
51301         a_conv.is_owned = ptr_is_owned(a);
51302         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51303         a_conv.is_owned = false;
51304         LDKShutdown b_conv;
51305         b_conv.inner = untag_ptr(b);
51306         b_conv.is_owned = ptr_is_owned(b);
51307         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51308         b_conv.is_owned = false;
51309         jboolean ret_conv = Shutdown_eq(&a_conv, &b_conv);
51310         return ret_conv;
51311 }
51312
51313 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51314         LDKClosingSignedFeeRange this_obj_conv;
51315         this_obj_conv.inner = untag_ptr(this_obj);
51316         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51318         ClosingSignedFeeRange_free(this_obj_conv);
51319 }
51320
51321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
51322         LDKClosingSignedFeeRange this_ptr_conv;
51323         this_ptr_conv.inner = untag_ptr(this_ptr);
51324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51326         this_ptr_conv.is_owned = false;
51327         int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
51328         return ret_conv;
51329 }
51330
51331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51332         LDKClosingSignedFeeRange this_ptr_conv;
51333         this_ptr_conv.inner = untag_ptr(this_ptr);
51334         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51336         this_ptr_conv.is_owned = false;
51337         ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
51338 }
51339
51340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
51341         LDKClosingSignedFeeRange this_ptr_conv;
51342         this_ptr_conv.inner = untag_ptr(this_ptr);
51343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51345         this_ptr_conv.is_owned = false;
51346         int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
51347         return ret_conv;
51348 }
51349
51350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51351         LDKClosingSignedFeeRange this_ptr_conv;
51352         this_ptr_conv.inner = untag_ptr(this_ptr);
51353         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51355         this_ptr_conv.is_owned = false;
51356         ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
51357 }
51358
51359 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) {
51360         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
51361         int64_t ret_ref = 0;
51362         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51363         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51364         return ret_ref;
51365 }
51366
51367 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
51368         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
51369         int64_t ret_ref = 0;
51370         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51371         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51372         return ret_ref;
51373 }
51374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51375         LDKClosingSignedFeeRange arg_conv;
51376         arg_conv.inner = untag_ptr(arg);
51377         arg_conv.is_owned = ptr_is_owned(arg);
51378         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51379         arg_conv.is_owned = false;
51380         int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
51381         return ret_conv;
51382 }
51383
51384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51385         LDKClosingSignedFeeRange orig_conv;
51386         orig_conv.inner = untag_ptr(orig);
51387         orig_conv.is_owned = ptr_is_owned(orig);
51388         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51389         orig_conv.is_owned = false;
51390         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
51391         int64_t ret_ref = 0;
51392         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51393         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51394         return ret_ref;
51395 }
51396
51397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1hash(JNIEnv *env, jclass clz, int64_t o) {
51398         LDKClosingSignedFeeRange o_conv;
51399         o_conv.inner = untag_ptr(o);
51400         o_conv.is_owned = ptr_is_owned(o);
51401         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51402         o_conv.is_owned = false;
51403         int64_t ret_conv = ClosingSignedFeeRange_hash(&o_conv);
51404         return ret_conv;
51405 }
51406
51407 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
51408         LDKClosingSignedFeeRange a_conv;
51409         a_conv.inner = untag_ptr(a);
51410         a_conv.is_owned = ptr_is_owned(a);
51411         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51412         a_conv.is_owned = false;
51413         LDKClosingSignedFeeRange b_conv;
51414         b_conv.inner = untag_ptr(b);
51415         b_conv.is_owned = ptr_is_owned(b);
51416         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51417         b_conv.is_owned = false;
51418         jboolean ret_conv = ClosingSignedFeeRange_eq(&a_conv, &b_conv);
51419         return ret_conv;
51420 }
51421
51422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51423         LDKClosingSigned this_obj_conv;
51424         this_obj_conv.inner = untag_ptr(this_obj);
51425         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51427         ClosingSigned_free(this_obj_conv);
51428 }
51429
51430 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
51431         LDKClosingSigned this_ptr_conv;
51432         this_ptr_conv.inner = untag_ptr(this_ptr);
51433         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51435         this_ptr_conv.is_owned = false;
51436         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
51437         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
51438         return ret_arr;
51439 }
51440
51441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
51442         LDKClosingSigned this_ptr_conv;
51443         this_ptr_conv.inner = untag_ptr(this_ptr);
51444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51446         this_ptr_conv.is_owned = false;
51447         LDKThirtyTwoBytes val_ref;
51448         CHECK((*env)->GetArrayLength(env, val) == 32);
51449         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
51450         ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
51451 }
51452
51453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
51454         LDKClosingSigned this_ptr_conv;
51455         this_ptr_conv.inner = untag_ptr(this_ptr);
51456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51458         this_ptr_conv.is_owned = false;
51459         int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
51460         return ret_conv;
51461 }
51462
51463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51464         LDKClosingSigned this_ptr_conv;
51465         this_ptr_conv.inner = untag_ptr(this_ptr);
51466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51468         this_ptr_conv.is_owned = false;
51469         ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
51470 }
51471
51472 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
51473         LDKClosingSigned this_ptr_conv;
51474         this_ptr_conv.inner = untag_ptr(this_ptr);
51475         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51477         this_ptr_conv.is_owned = false;
51478         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
51479         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
51480         return ret_arr;
51481 }
51482
51483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
51484         LDKClosingSigned this_ptr_conv;
51485         this_ptr_conv.inner = untag_ptr(this_ptr);
51486         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51488         this_ptr_conv.is_owned = false;
51489         LDKECDSASignature val_ref;
51490         CHECK((*env)->GetArrayLength(env, val) == 64);
51491         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
51492         ClosingSigned_set_signature(&this_ptr_conv, val_ref);
51493 }
51494
51495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
51496         LDKClosingSigned this_ptr_conv;
51497         this_ptr_conv.inner = untag_ptr(this_ptr);
51498         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51500         this_ptr_conv.is_owned = false;
51501         LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
51502         int64_t ret_ref = 0;
51503         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51504         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51505         return ret_ref;
51506 }
51507
51508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51509         LDKClosingSigned this_ptr_conv;
51510         this_ptr_conv.inner = untag_ptr(this_ptr);
51511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51513         this_ptr_conv.is_owned = false;
51514         LDKClosingSignedFeeRange val_conv;
51515         val_conv.inner = untag_ptr(val);
51516         val_conv.is_owned = ptr_is_owned(val);
51517         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51518         val_conv = ClosingSignedFeeRange_clone(&val_conv);
51519         ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
51520 }
51521
51522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg, int64_t fee_range_arg) {
51523         LDKThirtyTwoBytes channel_id_arg_ref;
51524         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
51525         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
51526         LDKECDSASignature signature_arg_ref;
51527         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
51528         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
51529         LDKClosingSignedFeeRange fee_range_arg_conv;
51530         fee_range_arg_conv.inner = untag_ptr(fee_range_arg);
51531         fee_range_arg_conv.is_owned = ptr_is_owned(fee_range_arg);
51532         CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
51533         fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
51534         LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
51535         int64_t ret_ref = 0;
51536         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51537         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51538         return ret_ref;
51539 }
51540
51541 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
51542         LDKClosingSigned ret_var = ClosingSigned_clone(arg);
51543         int64_t ret_ref = 0;
51544         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51545         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51546         return ret_ref;
51547 }
51548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51549         LDKClosingSigned arg_conv;
51550         arg_conv.inner = untag_ptr(arg);
51551         arg_conv.is_owned = ptr_is_owned(arg);
51552         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51553         arg_conv.is_owned = false;
51554         int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
51555         return ret_conv;
51556 }
51557
51558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51559         LDKClosingSigned orig_conv;
51560         orig_conv.inner = untag_ptr(orig);
51561         orig_conv.is_owned = ptr_is_owned(orig);
51562         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51563         orig_conv.is_owned = false;
51564         LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
51565         int64_t ret_ref = 0;
51566         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51567         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51568         return ret_ref;
51569 }
51570
51571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1hash(JNIEnv *env, jclass clz, int64_t o) {
51572         LDKClosingSigned o_conv;
51573         o_conv.inner = untag_ptr(o);
51574         o_conv.is_owned = ptr_is_owned(o);
51575         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51576         o_conv.is_owned = false;
51577         int64_t ret_conv = ClosingSigned_hash(&o_conv);
51578         return ret_conv;
51579 }
51580
51581 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
51582         LDKClosingSigned a_conv;
51583         a_conv.inner = untag_ptr(a);
51584         a_conv.is_owned = ptr_is_owned(a);
51585         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51586         a_conv.is_owned = false;
51587         LDKClosingSigned b_conv;
51588         b_conv.inner = untag_ptr(b);
51589         b_conv.is_owned = ptr_is_owned(b);
51590         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51591         b_conv.is_owned = false;
51592         jboolean ret_conv = ClosingSigned_eq(&a_conv, &b_conv);
51593         return ret_conv;
51594 }
51595
51596 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51597         LDKUpdateAddHTLC this_obj_conv;
51598         this_obj_conv.inner = untag_ptr(this_obj);
51599         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51601         UpdateAddHTLC_free(this_obj_conv);
51602 }
51603
51604 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
51605         LDKUpdateAddHTLC this_ptr_conv;
51606         this_ptr_conv.inner = untag_ptr(this_ptr);
51607         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51609         this_ptr_conv.is_owned = false;
51610         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
51611         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
51612         return ret_arr;
51613 }
51614
51615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
51616         LDKUpdateAddHTLC this_ptr_conv;
51617         this_ptr_conv.inner = untag_ptr(this_ptr);
51618         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51620         this_ptr_conv.is_owned = false;
51621         LDKThirtyTwoBytes val_ref;
51622         CHECK((*env)->GetArrayLength(env, val) == 32);
51623         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
51624         UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
51625 }
51626
51627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
51628         LDKUpdateAddHTLC this_ptr_conv;
51629         this_ptr_conv.inner = untag_ptr(this_ptr);
51630         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51632         this_ptr_conv.is_owned = false;
51633         int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
51634         return ret_conv;
51635 }
51636
51637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51638         LDKUpdateAddHTLC this_ptr_conv;
51639         this_ptr_conv.inner = untag_ptr(this_ptr);
51640         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51642         this_ptr_conv.is_owned = false;
51643         UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
51644 }
51645
51646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
51647         LDKUpdateAddHTLC this_ptr_conv;
51648         this_ptr_conv.inner = untag_ptr(this_ptr);
51649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51651         this_ptr_conv.is_owned = false;
51652         int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
51653         return ret_conv;
51654 }
51655
51656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51657         LDKUpdateAddHTLC this_ptr_conv;
51658         this_ptr_conv.inner = untag_ptr(this_ptr);
51659         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51661         this_ptr_conv.is_owned = false;
51662         UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
51663 }
51664
51665 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
51666         LDKUpdateAddHTLC this_ptr_conv;
51667         this_ptr_conv.inner = untag_ptr(this_ptr);
51668         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51670         this_ptr_conv.is_owned = false;
51671         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
51672         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
51673         return ret_arr;
51674 }
51675
51676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
51677         LDKUpdateAddHTLC this_ptr_conv;
51678         this_ptr_conv.inner = untag_ptr(this_ptr);
51679         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51681         this_ptr_conv.is_owned = false;
51682         LDKThirtyTwoBytes val_ref;
51683         CHECK((*env)->GetArrayLength(env, val) == 32);
51684         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
51685         UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
51686 }
51687
51688 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
51689         LDKUpdateAddHTLC this_ptr_conv;
51690         this_ptr_conv.inner = untag_ptr(this_ptr);
51691         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51693         this_ptr_conv.is_owned = false;
51694         int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
51695         return ret_conv;
51696 }
51697
51698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
51699         LDKUpdateAddHTLC this_ptr_conv;
51700         this_ptr_conv.inner = untag_ptr(this_ptr);
51701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51703         this_ptr_conv.is_owned = false;
51704         UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
51705 }
51706
51707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1skimmed_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
51708         LDKUpdateAddHTLC this_ptr_conv;
51709         this_ptr_conv.inner = untag_ptr(this_ptr);
51710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51712         this_ptr_conv.is_owned = false;
51713         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
51714         *ret_copy = UpdateAddHTLC_get_skimmed_fee_msat(&this_ptr_conv);
51715         int64_t ret_ref = tag_ptr(ret_copy, true);
51716         return ret_ref;
51717 }
51718
51719 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1skimmed_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51720         LDKUpdateAddHTLC this_ptr_conv;
51721         this_ptr_conv.inner = untag_ptr(this_ptr);
51722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51724         this_ptr_conv.is_owned = false;
51725         void* val_ptr = untag_ptr(val);
51726         CHECK_ACCESS(val_ptr);
51727         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
51728         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
51729         UpdateAddHTLC_set_skimmed_fee_msat(&this_ptr_conv, val_conv);
51730 }
51731
51732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1onion_1routing_1packet(JNIEnv *env, jclass clz, int64_t this_ptr) {
51733         LDKUpdateAddHTLC this_ptr_conv;
51734         this_ptr_conv.inner = untag_ptr(this_ptr);
51735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51737         this_ptr_conv.is_owned = false;
51738         LDKOnionPacket ret_var = UpdateAddHTLC_get_onion_routing_packet(&this_ptr_conv);
51739         int64_t ret_ref = 0;
51740         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51741         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51742         return ret_ref;
51743 }
51744
51745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1onion_1routing_1packet(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51746         LDKUpdateAddHTLC this_ptr_conv;
51747         this_ptr_conv.inner = untag_ptr(this_ptr);
51748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51750         this_ptr_conv.is_owned = false;
51751         LDKOnionPacket val_conv;
51752         val_conv.inner = untag_ptr(val);
51753         val_conv.is_owned = ptr_is_owned(val);
51754         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51755         val_conv = OnionPacket_clone(&val_conv);
51756         UpdateAddHTLC_set_onion_routing_packet(&this_ptr_conv, val_conv);
51757 }
51758
51759 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
51760         LDKUpdateAddHTLC this_ptr_conv;
51761         this_ptr_conv.inner = untag_ptr(this_ptr);
51762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51764         this_ptr_conv.is_owned = false;
51765         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
51766         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UpdateAddHTLC_get_blinding_point(&this_ptr_conv).compressed_form);
51767         return ret_arr;
51768 }
51769
51770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
51771         LDKUpdateAddHTLC this_ptr_conv;
51772         this_ptr_conv.inner = untag_ptr(this_ptr);
51773         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51775         this_ptr_conv.is_owned = false;
51776         LDKPublicKey val_ref;
51777         CHECK((*env)->GetArrayLength(env, val) == 33);
51778         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
51779         UpdateAddHTLC_set_blinding_point(&this_ptr_conv, val_ref);
51780 }
51781
51782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t htlc_id_arg, int64_t amount_msat_arg, int8_tArray payment_hash_arg, int32_t cltv_expiry_arg, int64_t skimmed_fee_msat_arg, int64_t onion_routing_packet_arg, int8_tArray blinding_point_arg) {
51783         LDKThirtyTwoBytes channel_id_arg_ref;
51784         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
51785         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
51786         LDKThirtyTwoBytes payment_hash_arg_ref;
51787         CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
51788         (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
51789         void* skimmed_fee_msat_arg_ptr = untag_ptr(skimmed_fee_msat_arg);
51790         CHECK_ACCESS(skimmed_fee_msat_arg_ptr);
51791         LDKCOption_u64Z skimmed_fee_msat_arg_conv = *(LDKCOption_u64Z*)(skimmed_fee_msat_arg_ptr);
51792         skimmed_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(skimmed_fee_msat_arg));
51793         LDKOnionPacket onion_routing_packet_arg_conv;
51794         onion_routing_packet_arg_conv.inner = untag_ptr(onion_routing_packet_arg);
51795         onion_routing_packet_arg_conv.is_owned = ptr_is_owned(onion_routing_packet_arg);
51796         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_routing_packet_arg_conv);
51797         onion_routing_packet_arg_conv = OnionPacket_clone(&onion_routing_packet_arg_conv);
51798         LDKPublicKey blinding_point_arg_ref;
51799         CHECK((*env)->GetArrayLength(env, blinding_point_arg) == 33);
51800         (*env)->GetByteArrayRegion(env, blinding_point_arg, 0, 33, blinding_point_arg_ref.compressed_form);
51801         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_new(channel_id_arg_ref, htlc_id_arg, amount_msat_arg, payment_hash_arg_ref, cltv_expiry_arg, skimmed_fee_msat_arg_conv, onion_routing_packet_arg_conv, blinding_point_arg_ref);
51802         int64_t ret_ref = 0;
51803         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51804         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51805         return ret_ref;
51806 }
51807
51808 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
51809         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
51810         int64_t ret_ref = 0;
51811         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51812         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51813         return ret_ref;
51814 }
51815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51816         LDKUpdateAddHTLC arg_conv;
51817         arg_conv.inner = untag_ptr(arg);
51818         arg_conv.is_owned = ptr_is_owned(arg);
51819         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51820         arg_conv.is_owned = false;
51821         int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
51822         return ret_conv;
51823 }
51824
51825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51826         LDKUpdateAddHTLC orig_conv;
51827         orig_conv.inner = untag_ptr(orig);
51828         orig_conv.is_owned = ptr_is_owned(orig);
51829         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51830         orig_conv.is_owned = false;
51831         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
51832         int64_t ret_ref = 0;
51833         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51834         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51835         return ret_ref;
51836 }
51837
51838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1hash(JNIEnv *env, jclass clz, int64_t o) {
51839         LDKUpdateAddHTLC o_conv;
51840         o_conv.inner = untag_ptr(o);
51841         o_conv.is_owned = ptr_is_owned(o);
51842         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51843         o_conv.is_owned = false;
51844         int64_t ret_conv = UpdateAddHTLC_hash(&o_conv);
51845         return ret_conv;
51846 }
51847
51848 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
51849         LDKUpdateAddHTLC a_conv;
51850         a_conv.inner = untag_ptr(a);
51851         a_conv.is_owned = ptr_is_owned(a);
51852         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51853         a_conv.is_owned = false;
51854         LDKUpdateAddHTLC b_conv;
51855         b_conv.inner = untag_ptr(b);
51856         b_conv.is_owned = ptr_is_owned(b);
51857         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51858         b_conv.is_owned = false;
51859         jboolean ret_conv = UpdateAddHTLC_eq(&a_conv, &b_conv);
51860         return ret_conv;
51861 }
51862
51863 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51864         LDKOnionMessage this_obj_conv;
51865         this_obj_conv.inner = untag_ptr(this_obj);
51866         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51868         OnionMessage_free(this_obj_conv);
51869 }
51870
51871 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionMessage_1get_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
51872         LDKOnionMessage this_ptr_conv;
51873         this_ptr_conv.inner = untag_ptr(this_ptr);
51874         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51876         this_ptr_conv.is_owned = false;
51877         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
51878         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OnionMessage_get_blinding_point(&this_ptr_conv).compressed_form);
51879         return ret_arr;
51880 }
51881
51882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessage_1set_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
51883         LDKOnionMessage this_ptr_conv;
51884         this_ptr_conv.inner = untag_ptr(this_ptr);
51885         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51887         this_ptr_conv.is_owned = false;
51888         LDKPublicKey val_ref;
51889         CHECK((*env)->GetArrayLength(env, val) == 33);
51890         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
51891         OnionMessage_set_blinding_point(&this_ptr_conv, val_ref);
51892 }
51893
51894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1get_1onion_1routing_1packet(JNIEnv *env, jclass clz, int64_t this_ptr) {
51895         LDKOnionMessage this_ptr_conv;
51896         this_ptr_conv.inner = untag_ptr(this_ptr);
51897         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51899         this_ptr_conv.is_owned = false;
51900         LDKPacket ret_var = OnionMessage_get_onion_routing_packet(&this_ptr_conv);
51901         int64_t ret_ref = 0;
51902         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51903         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51904         return ret_ref;
51905 }
51906
51907 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessage_1set_1onion_1routing_1packet(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51908         LDKOnionMessage this_ptr_conv;
51909         this_ptr_conv.inner = untag_ptr(this_ptr);
51910         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51912         this_ptr_conv.is_owned = false;
51913         LDKPacket val_conv;
51914         val_conv.inner = untag_ptr(val);
51915         val_conv.is_owned = ptr_is_owned(val);
51916         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51917         val_conv = Packet_clone(&val_conv);
51918         OnionMessage_set_onion_routing_packet(&this_ptr_conv, val_conv);
51919 }
51920
51921 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) {
51922         LDKPublicKey blinding_point_arg_ref;
51923         CHECK((*env)->GetArrayLength(env, blinding_point_arg) == 33);
51924         (*env)->GetByteArrayRegion(env, blinding_point_arg, 0, 33, blinding_point_arg_ref.compressed_form);
51925         LDKPacket onion_routing_packet_arg_conv;
51926         onion_routing_packet_arg_conv.inner = untag_ptr(onion_routing_packet_arg);
51927         onion_routing_packet_arg_conv.is_owned = ptr_is_owned(onion_routing_packet_arg);
51928         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_routing_packet_arg_conv);
51929         onion_routing_packet_arg_conv = Packet_clone(&onion_routing_packet_arg_conv);
51930         LDKOnionMessage ret_var = OnionMessage_new(blinding_point_arg_ref, onion_routing_packet_arg_conv);
51931         int64_t ret_ref = 0;
51932         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51933         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51934         return ret_ref;
51935 }
51936
51937 static inline uint64_t OnionMessage_clone_ptr(LDKOnionMessage *NONNULL_PTR arg) {
51938         LDKOnionMessage ret_var = OnionMessage_clone(arg);
51939         int64_t ret_ref = 0;
51940         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51941         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51942         return ret_ref;
51943 }
51944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51945         LDKOnionMessage arg_conv;
51946         arg_conv.inner = untag_ptr(arg);
51947         arg_conv.is_owned = ptr_is_owned(arg);
51948         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51949         arg_conv.is_owned = false;
51950         int64_t ret_conv = OnionMessage_clone_ptr(&arg_conv);
51951         return ret_conv;
51952 }
51953
51954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51955         LDKOnionMessage orig_conv;
51956         orig_conv.inner = untag_ptr(orig);
51957         orig_conv.is_owned = ptr_is_owned(orig);
51958         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51959         orig_conv.is_owned = false;
51960         LDKOnionMessage ret_var = OnionMessage_clone(&orig_conv);
51961         int64_t ret_ref = 0;
51962         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51963         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51964         return ret_ref;
51965 }
51966
51967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1hash(JNIEnv *env, jclass clz, int64_t o) {
51968         LDKOnionMessage o_conv;
51969         o_conv.inner = untag_ptr(o);
51970         o_conv.is_owned = ptr_is_owned(o);
51971         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51972         o_conv.is_owned = false;
51973         int64_t ret_conv = OnionMessage_hash(&o_conv);
51974         return ret_conv;
51975 }
51976
51977 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OnionMessage_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
51978         LDKOnionMessage a_conv;
51979         a_conv.inner = untag_ptr(a);
51980         a_conv.is_owned = ptr_is_owned(a);
51981         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51982         a_conv.is_owned = false;
51983         LDKOnionMessage b_conv;
51984         b_conv.inner = untag_ptr(b);
51985         b_conv.is_owned = ptr_is_owned(b);
51986         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51987         b_conv.is_owned = false;
51988         jboolean ret_conv = OnionMessage_eq(&a_conv, &b_conv);
51989         return ret_conv;
51990 }
51991
51992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51993         LDKUpdateFulfillHTLC this_obj_conv;
51994         this_obj_conv.inner = untag_ptr(this_obj);
51995         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51997         UpdateFulfillHTLC_free(this_obj_conv);
51998 }
51999
52000 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
52001         LDKUpdateFulfillHTLC 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         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
52007         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
52008         return ret_arr;
52009 }
52010
52011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52012         LDKUpdateFulfillHTLC this_ptr_conv;
52013         this_ptr_conv.inner = untag_ptr(this_ptr);
52014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52016         this_ptr_conv.is_owned = false;
52017         LDKThirtyTwoBytes val_ref;
52018         CHECK((*env)->GetArrayLength(env, val) == 32);
52019         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
52020         UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
52021 }
52022
52023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
52024         LDKUpdateFulfillHTLC this_ptr_conv;
52025         this_ptr_conv.inner = untag_ptr(this_ptr);
52026         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52028         this_ptr_conv.is_owned = false;
52029         int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
52030         return ret_conv;
52031 }
52032
52033 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52034         LDKUpdateFulfillHTLC 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         UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
52040 }
52041
52042 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
52043         LDKUpdateFulfillHTLC this_ptr_conv;
52044         this_ptr_conv.inner = untag_ptr(this_ptr);
52045         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52047         this_ptr_conv.is_owned = false;
52048         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
52049         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
52050         return ret_arr;
52051 }
52052
52053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52054         LDKUpdateFulfillHTLC this_ptr_conv;
52055         this_ptr_conv.inner = untag_ptr(this_ptr);
52056         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52058         this_ptr_conv.is_owned = false;
52059         LDKThirtyTwoBytes val_ref;
52060         CHECK((*env)->GetArrayLength(env, val) == 32);
52061         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
52062         UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
52063 }
52064
52065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t htlc_id_arg, int8_tArray payment_preimage_arg) {
52066         LDKThirtyTwoBytes channel_id_arg_ref;
52067         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
52068         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
52069         LDKThirtyTwoBytes payment_preimage_arg_ref;
52070         CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
52071         (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
52072         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
52073         int64_t ret_ref = 0;
52074         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52075         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52076         return ret_ref;
52077 }
52078
52079 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
52080         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
52081         int64_t ret_ref = 0;
52082         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52083         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52084         return ret_ref;
52085 }
52086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52087         LDKUpdateFulfillHTLC arg_conv;
52088         arg_conv.inner = untag_ptr(arg);
52089         arg_conv.is_owned = ptr_is_owned(arg);
52090         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52091         arg_conv.is_owned = false;
52092         int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
52093         return ret_conv;
52094 }
52095
52096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52097         LDKUpdateFulfillHTLC orig_conv;
52098         orig_conv.inner = untag_ptr(orig);
52099         orig_conv.is_owned = ptr_is_owned(orig);
52100         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52101         orig_conv.is_owned = false;
52102         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
52103         int64_t ret_ref = 0;
52104         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52105         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52106         return ret_ref;
52107 }
52108
52109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1hash(JNIEnv *env, jclass clz, int64_t o) {
52110         LDKUpdateFulfillHTLC o_conv;
52111         o_conv.inner = untag_ptr(o);
52112         o_conv.is_owned = ptr_is_owned(o);
52113         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52114         o_conv.is_owned = false;
52115         int64_t ret_conv = UpdateFulfillHTLC_hash(&o_conv);
52116         return ret_conv;
52117 }
52118
52119 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52120         LDKUpdateFulfillHTLC a_conv;
52121         a_conv.inner = untag_ptr(a);
52122         a_conv.is_owned = ptr_is_owned(a);
52123         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52124         a_conv.is_owned = false;
52125         LDKUpdateFulfillHTLC b_conv;
52126         b_conv.inner = untag_ptr(b);
52127         b_conv.is_owned = ptr_is_owned(b);
52128         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52129         b_conv.is_owned = false;
52130         jboolean ret_conv = UpdateFulfillHTLC_eq(&a_conv, &b_conv);
52131         return ret_conv;
52132 }
52133
52134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52135         LDKUpdateFailHTLC this_obj_conv;
52136         this_obj_conv.inner = untag_ptr(this_obj);
52137         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52139         UpdateFailHTLC_free(this_obj_conv);
52140 }
52141
52142 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
52143         LDKUpdateFailHTLC this_ptr_conv;
52144         this_ptr_conv.inner = untag_ptr(this_ptr);
52145         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52147         this_ptr_conv.is_owned = false;
52148         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
52149         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
52150         return ret_arr;
52151 }
52152
52153 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52154         LDKUpdateFailHTLC this_ptr_conv;
52155         this_ptr_conv.inner = untag_ptr(this_ptr);
52156         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52158         this_ptr_conv.is_owned = false;
52159         LDKThirtyTwoBytes val_ref;
52160         CHECK((*env)->GetArrayLength(env, val) == 32);
52161         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
52162         UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
52163 }
52164
52165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
52166         LDKUpdateFailHTLC this_ptr_conv;
52167         this_ptr_conv.inner = untag_ptr(this_ptr);
52168         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52170         this_ptr_conv.is_owned = false;
52171         int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
52172         return ret_conv;
52173 }
52174
52175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52176         LDKUpdateFailHTLC this_ptr_conv;
52177         this_ptr_conv.inner = untag_ptr(this_ptr);
52178         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52180         this_ptr_conv.is_owned = false;
52181         UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
52182 }
52183
52184 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
52185         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
52186         int64_t ret_ref = 0;
52187         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52188         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52189         return ret_ref;
52190 }
52191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52192         LDKUpdateFailHTLC arg_conv;
52193         arg_conv.inner = untag_ptr(arg);
52194         arg_conv.is_owned = ptr_is_owned(arg);
52195         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52196         arg_conv.is_owned = false;
52197         int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
52198         return ret_conv;
52199 }
52200
52201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52202         LDKUpdateFailHTLC orig_conv;
52203         orig_conv.inner = untag_ptr(orig);
52204         orig_conv.is_owned = ptr_is_owned(orig);
52205         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52206         orig_conv.is_owned = false;
52207         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
52208         int64_t ret_ref = 0;
52209         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52210         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52211         return ret_ref;
52212 }
52213
52214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1hash(JNIEnv *env, jclass clz, int64_t o) {
52215         LDKUpdateFailHTLC o_conv;
52216         o_conv.inner = untag_ptr(o);
52217         o_conv.is_owned = ptr_is_owned(o);
52218         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52219         o_conv.is_owned = false;
52220         int64_t ret_conv = UpdateFailHTLC_hash(&o_conv);
52221         return ret_conv;
52222 }
52223
52224 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52225         LDKUpdateFailHTLC a_conv;
52226         a_conv.inner = untag_ptr(a);
52227         a_conv.is_owned = ptr_is_owned(a);
52228         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52229         a_conv.is_owned = false;
52230         LDKUpdateFailHTLC b_conv;
52231         b_conv.inner = untag_ptr(b);
52232         b_conv.is_owned = ptr_is_owned(b);
52233         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52234         b_conv.is_owned = false;
52235         jboolean ret_conv = UpdateFailHTLC_eq(&a_conv, &b_conv);
52236         return ret_conv;
52237 }
52238
52239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52240         LDKUpdateFailMalformedHTLC this_obj_conv;
52241         this_obj_conv.inner = untag_ptr(this_obj);
52242         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52244         UpdateFailMalformedHTLC_free(this_obj_conv);
52245 }
52246
52247 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
52248         LDKUpdateFailMalformedHTLC this_ptr_conv;
52249         this_ptr_conv.inner = untag_ptr(this_ptr);
52250         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52252         this_ptr_conv.is_owned = false;
52253         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
52254         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
52255         return ret_arr;
52256 }
52257
52258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52259         LDKUpdateFailMalformedHTLC this_ptr_conv;
52260         this_ptr_conv.inner = untag_ptr(this_ptr);
52261         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52263         this_ptr_conv.is_owned = false;
52264         LDKThirtyTwoBytes val_ref;
52265         CHECK((*env)->GetArrayLength(env, val) == 32);
52266         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
52267         UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
52268 }
52269
52270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
52271         LDKUpdateFailMalformedHTLC this_ptr_conv;
52272         this_ptr_conv.inner = untag_ptr(this_ptr);
52273         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52275         this_ptr_conv.is_owned = false;
52276         int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
52277         return ret_conv;
52278 }
52279
52280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52281         LDKUpdateFailMalformedHTLC this_ptr_conv;
52282         this_ptr_conv.inner = untag_ptr(this_ptr);
52283         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52285         this_ptr_conv.is_owned = false;
52286         UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
52287 }
52288
52289 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
52290         LDKUpdateFailMalformedHTLC this_ptr_conv;
52291         this_ptr_conv.inner = untag_ptr(this_ptr);
52292         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52294         this_ptr_conv.is_owned = false;
52295         int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
52296         return ret_conv;
52297 }
52298
52299 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
52300         LDKUpdateFailMalformedHTLC this_ptr_conv;
52301         this_ptr_conv.inner = untag_ptr(this_ptr);
52302         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52304         this_ptr_conv.is_owned = false;
52305         UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
52306 }
52307
52308 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
52309         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
52310         int64_t ret_ref = 0;
52311         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52312         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52313         return ret_ref;
52314 }
52315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52316         LDKUpdateFailMalformedHTLC arg_conv;
52317         arg_conv.inner = untag_ptr(arg);
52318         arg_conv.is_owned = ptr_is_owned(arg);
52319         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52320         arg_conv.is_owned = false;
52321         int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
52322         return ret_conv;
52323 }
52324
52325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52326         LDKUpdateFailMalformedHTLC orig_conv;
52327         orig_conv.inner = untag_ptr(orig);
52328         orig_conv.is_owned = ptr_is_owned(orig);
52329         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52330         orig_conv.is_owned = false;
52331         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
52332         int64_t ret_ref = 0;
52333         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52334         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52335         return ret_ref;
52336 }
52337
52338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1hash(JNIEnv *env, jclass clz, int64_t o) {
52339         LDKUpdateFailMalformedHTLC o_conv;
52340         o_conv.inner = untag_ptr(o);
52341         o_conv.is_owned = ptr_is_owned(o);
52342         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52343         o_conv.is_owned = false;
52344         int64_t ret_conv = UpdateFailMalformedHTLC_hash(&o_conv);
52345         return ret_conv;
52346 }
52347
52348 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52349         LDKUpdateFailMalformedHTLC a_conv;
52350         a_conv.inner = untag_ptr(a);
52351         a_conv.is_owned = ptr_is_owned(a);
52352         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52353         a_conv.is_owned = false;
52354         LDKUpdateFailMalformedHTLC b_conv;
52355         b_conv.inner = untag_ptr(b);
52356         b_conv.is_owned = ptr_is_owned(b);
52357         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52358         b_conv.is_owned = false;
52359         jboolean ret_conv = UpdateFailMalformedHTLC_eq(&a_conv, &b_conv);
52360         return ret_conv;
52361 }
52362
52363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52364         LDKCommitmentSigned this_obj_conv;
52365         this_obj_conv.inner = untag_ptr(this_obj);
52366         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52368         CommitmentSigned_free(this_obj_conv);
52369 }
52370
52371 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
52372         LDKCommitmentSigned this_ptr_conv;
52373         this_ptr_conv.inner = untag_ptr(this_ptr);
52374         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52376         this_ptr_conv.is_owned = false;
52377         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
52378         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
52379         return ret_arr;
52380 }
52381
52382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52383         LDKCommitmentSigned this_ptr_conv;
52384         this_ptr_conv.inner = untag_ptr(this_ptr);
52385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52387         this_ptr_conv.is_owned = false;
52388         LDKThirtyTwoBytes val_ref;
52389         CHECK((*env)->GetArrayLength(env, val) == 32);
52390         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
52391         CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
52392 }
52393
52394 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
52395         LDKCommitmentSigned this_ptr_conv;
52396         this_ptr_conv.inner = untag_ptr(this_ptr);
52397         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52399         this_ptr_conv.is_owned = false;
52400         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
52401         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
52402         return ret_arr;
52403 }
52404
52405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52406         LDKCommitmentSigned this_ptr_conv;
52407         this_ptr_conv.inner = untag_ptr(this_ptr);
52408         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52410         this_ptr_conv.is_owned = false;
52411         LDKECDSASignature val_ref;
52412         CHECK((*env)->GetArrayLength(env, val) == 64);
52413         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
52414         CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
52415 }
52416
52417 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr) {
52418         LDKCommitmentSigned this_ptr_conv;
52419         this_ptr_conv.inner = untag_ptr(this_ptr);
52420         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52422         this_ptr_conv.is_owned = false;
52423         LDKCVec_ECDSASignatureZ ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
52424         jobjectArray ret_arr = NULL;
52425         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
52426         ;
52427         for (size_t i = 0; i < ret_var.datalen; i++) {
52428                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
52429                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
52430                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
52431         }
52432         
52433         FREE(ret_var.data);
52434         return ret_arr;
52435 }
52436
52437 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
52438         LDKCommitmentSigned this_ptr_conv;
52439         this_ptr_conv.inner = untag_ptr(this_ptr);
52440         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52442         this_ptr_conv.is_owned = false;
52443         LDKCVec_ECDSASignatureZ val_constr;
52444         val_constr.datalen = (*env)->GetArrayLength(env, val);
52445         if (val_constr.datalen > 0)
52446                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
52447         else
52448                 val_constr.data = NULL;
52449         for (size_t i = 0; i < val_constr.datalen; i++) {
52450                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
52451                 LDKECDSASignature val_conv_8_ref;
52452                 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
52453                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
52454                 val_constr.data[i] = val_conv_8_ref;
52455         }
52456         CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
52457 }
52458
52459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg, jobjectArray htlc_signatures_arg) {
52460         LDKThirtyTwoBytes channel_id_arg_ref;
52461         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
52462         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
52463         LDKECDSASignature signature_arg_ref;
52464         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
52465         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
52466         LDKCVec_ECDSASignatureZ htlc_signatures_arg_constr;
52467         htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
52468         if (htlc_signatures_arg_constr.datalen > 0)
52469                 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
52470         else
52471                 htlc_signatures_arg_constr.data = NULL;
52472         for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
52473                 int8_tArray htlc_signatures_arg_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
52474                 LDKECDSASignature htlc_signatures_arg_conv_8_ref;
52475                 CHECK((*env)->GetArrayLength(env, htlc_signatures_arg_conv_8) == 64);
52476                 (*env)->GetByteArrayRegion(env, htlc_signatures_arg_conv_8, 0, 64, htlc_signatures_arg_conv_8_ref.compact_form);
52477                 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
52478         }
52479         LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
52480         int64_t ret_ref = 0;
52481         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52482         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52483         return ret_ref;
52484 }
52485
52486 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
52487         LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
52488         int64_t ret_ref = 0;
52489         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52490         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52491         return ret_ref;
52492 }
52493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52494         LDKCommitmentSigned arg_conv;
52495         arg_conv.inner = untag_ptr(arg);
52496         arg_conv.is_owned = ptr_is_owned(arg);
52497         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52498         arg_conv.is_owned = false;
52499         int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
52500         return ret_conv;
52501 }
52502
52503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52504         LDKCommitmentSigned orig_conv;
52505         orig_conv.inner = untag_ptr(orig);
52506         orig_conv.is_owned = ptr_is_owned(orig);
52507         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52508         orig_conv.is_owned = false;
52509         LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
52510         int64_t ret_ref = 0;
52511         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52512         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52513         return ret_ref;
52514 }
52515
52516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1hash(JNIEnv *env, jclass clz, int64_t o) {
52517         LDKCommitmentSigned o_conv;
52518         o_conv.inner = untag_ptr(o);
52519         o_conv.is_owned = ptr_is_owned(o);
52520         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52521         o_conv.is_owned = false;
52522         int64_t ret_conv = CommitmentSigned_hash(&o_conv);
52523         return ret_conv;
52524 }
52525
52526 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52527         LDKCommitmentSigned a_conv;
52528         a_conv.inner = untag_ptr(a);
52529         a_conv.is_owned = ptr_is_owned(a);
52530         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52531         a_conv.is_owned = false;
52532         LDKCommitmentSigned b_conv;
52533         b_conv.inner = untag_ptr(b);
52534         b_conv.is_owned = ptr_is_owned(b);
52535         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52536         b_conv.is_owned = false;
52537         jboolean ret_conv = CommitmentSigned_eq(&a_conv, &b_conv);
52538         return ret_conv;
52539 }
52540
52541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52542         LDKRevokeAndACK this_obj_conv;
52543         this_obj_conv.inner = untag_ptr(this_obj);
52544         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52546         RevokeAndACK_free(this_obj_conv);
52547 }
52548
52549 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
52550         LDKRevokeAndACK this_ptr_conv;
52551         this_ptr_conv.inner = untag_ptr(this_ptr);
52552         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52554         this_ptr_conv.is_owned = false;
52555         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
52556         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
52557         return ret_arr;
52558 }
52559
52560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52561         LDKRevokeAndACK this_ptr_conv;
52562         this_ptr_conv.inner = untag_ptr(this_ptr);
52563         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52565         this_ptr_conv.is_owned = false;
52566         LDKThirtyTwoBytes val_ref;
52567         CHECK((*env)->GetArrayLength(env, val) == 32);
52568         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
52569         RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
52570 }
52571
52572 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
52573         LDKRevokeAndACK this_ptr_conv;
52574         this_ptr_conv.inner = untag_ptr(this_ptr);
52575         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52577         this_ptr_conv.is_owned = false;
52578         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
52579         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
52580         return ret_arr;
52581 }
52582
52583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52584         LDKRevokeAndACK this_ptr_conv;
52585         this_ptr_conv.inner = untag_ptr(this_ptr);
52586         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52588         this_ptr_conv.is_owned = false;
52589         LDKThirtyTwoBytes val_ref;
52590         CHECK((*env)->GetArrayLength(env, val) == 32);
52591         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
52592         RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
52593 }
52594
52595 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
52596         LDKRevokeAndACK this_ptr_conv;
52597         this_ptr_conv.inner = untag_ptr(this_ptr);
52598         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52600         this_ptr_conv.is_owned = false;
52601         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52602         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
52603         return ret_arr;
52604 }
52605
52606 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) {
52607         LDKRevokeAndACK this_ptr_conv;
52608         this_ptr_conv.inner = untag_ptr(this_ptr);
52609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52611         this_ptr_conv.is_owned = false;
52612         LDKPublicKey val_ref;
52613         CHECK((*env)->GetArrayLength(env, val) == 33);
52614         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52615         RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
52616 }
52617
52618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray per_commitment_secret_arg, int8_tArray next_per_commitment_point_arg) {
52619         LDKThirtyTwoBytes channel_id_arg_ref;
52620         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
52621         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
52622         LDKThirtyTwoBytes per_commitment_secret_arg_ref;
52623         CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
52624         (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
52625         LDKPublicKey next_per_commitment_point_arg_ref;
52626         CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
52627         (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
52628         LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
52629         int64_t ret_ref = 0;
52630         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52631         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52632         return ret_ref;
52633 }
52634
52635 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
52636         LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
52637         int64_t ret_ref = 0;
52638         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52639         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52640         return ret_ref;
52641 }
52642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52643         LDKRevokeAndACK arg_conv;
52644         arg_conv.inner = untag_ptr(arg);
52645         arg_conv.is_owned = ptr_is_owned(arg);
52646         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52647         arg_conv.is_owned = false;
52648         int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
52649         return ret_conv;
52650 }
52651
52652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52653         LDKRevokeAndACK orig_conv;
52654         orig_conv.inner = untag_ptr(orig);
52655         orig_conv.is_owned = ptr_is_owned(orig);
52656         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52657         orig_conv.is_owned = false;
52658         LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
52659         int64_t ret_ref = 0;
52660         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52661         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52662         return ret_ref;
52663 }
52664
52665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1hash(JNIEnv *env, jclass clz, int64_t o) {
52666         LDKRevokeAndACK o_conv;
52667         o_conv.inner = untag_ptr(o);
52668         o_conv.is_owned = ptr_is_owned(o);
52669         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52670         o_conv.is_owned = false;
52671         int64_t ret_conv = RevokeAndACK_hash(&o_conv);
52672         return ret_conv;
52673 }
52674
52675 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52676         LDKRevokeAndACK a_conv;
52677         a_conv.inner = untag_ptr(a);
52678         a_conv.is_owned = ptr_is_owned(a);
52679         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52680         a_conv.is_owned = false;
52681         LDKRevokeAndACK b_conv;
52682         b_conv.inner = untag_ptr(b);
52683         b_conv.is_owned = ptr_is_owned(b);
52684         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52685         b_conv.is_owned = false;
52686         jboolean ret_conv = RevokeAndACK_eq(&a_conv, &b_conv);
52687         return ret_conv;
52688 }
52689
52690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52691         LDKUpdateFee this_obj_conv;
52692         this_obj_conv.inner = untag_ptr(this_obj);
52693         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52695         UpdateFee_free(this_obj_conv);
52696 }
52697
52698 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
52699         LDKUpdateFee this_ptr_conv;
52700         this_ptr_conv.inner = untag_ptr(this_ptr);
52701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52703         this_ptr_conv.is_owned = false;
52704         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
52705         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
52706         return ret_arr;
52707 }
52708
52709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52710         LDKUpdateFee this_ptr_conv;
52711         this_ptr_conv.inner = untag_ptr(this_ptr);
52712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52714         this_ptr_conv.is_owned = false;
52715         LDKThirtyTwoBytes val_ref;
52716         CHECK((*env)->GetArrayLength(env, val) == 32);
52717         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
52718         UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
52719 }
52720
52721 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
52722         LDKUpdateFee this_ptr_conv;
52723         this_ptr_conv.inner = untag_ptr(this_ptr);
52724         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52726         this_ptr_conv.is_owned = false;
52727         int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
52728         return ret_conv;
52729 }
52730
52731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
52732         LDKUpdateFee this_ptr_conv;
52733         this_ptr_conv.inner = untag_ptr(this_ptr);
52734         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52736         this_ptr_conv.is_owned = false;
52737         UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
52738 }
52739
52740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
52741         LDKThirtyTwoBytes channel_id_arg_ref;
52742         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
52743         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
52744         LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
52745         int64_t ret_ref = 0;
52746         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52747         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52748         return ret_ref;
52749 }
52750
52751 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
52752         LDKUpdateFee ret_var = UpdateFee_clone(arg);
52753         int64_t ret_ref = 0;
52754         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52755         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52756         return ret_ref;
52757 }
52758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52759         LDKUpdateFee arg_conv;
52760         arg_conv.inner = untag_ptr(arg);
52761         arg_conv.is_owned = ptr_is_owned(arg);
52762         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52763         arg_conv.is_owned = false;
52764         int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
52765         return ret_conv;
52766 }
52767
52768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52769         LDKUpdateFee orig_conv;
52770         orig_conv.inner = untag_ptr(orig);
52771         orig_conv.is_owned = ptr_is_owned(orig);
52772         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52773         orig_conv.is_owned = false;
52774         LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
52775         int64_t ret_ref = 0;
52776         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52777         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52778         return ret_ref;
52779 }
52780
52781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1hash(JNIEnv *env, jclass clz, int64_t o) {
52782         LDKUpdateFee o_conv;
52783         o_conv.inner = untag_ptr(o);
52784         o_conv.is_owned = ptr_is_owned(o);
52785         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52786         o_conv.is_owned = false;
52787         int64_t ret_conv = UpdateFee_hash(&o_conv);
52788         return ret_conv;
52789 }
52790
52791 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFee_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52792         LDKUpdateFee a_conv;
52793         a_conv.inner = untag_ptr(a);
52794         a_conv.is_owned = ptr_is_owned(a);
52795         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52796         a_conv.is_owned = false;
52797         LDKUpdateFee b_conv;
52798         b_conv.inner = untag_ptr(b);
52799         b_conv.is_owned = ptr_is_owned(b);
52800         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52801         b_conv.is_owned = false;
52802         jboolean ret_conv = UpdateFee_eq(&a_conv, &b_conv);
52803         return ret_conv;
52804 }
52805
52806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52807         LDKChannelReestablish this_obj_conv;
52808         this_obj_conv.inner = untag_ptr(this_obj);
52809         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52811         ChannelReestablish_free(this_obj_conv);
52812 }
52813
52814 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
52815         LDKChannelReestablish this_ptr_conv;
52816         this_ptr_conv.inner = untag_ptr(this_ptr);
52817         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52819         this_ptr_conv.is_owned = false;
52820         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
52821         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
52822         return ret_arr;
52823 }
52824
52825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52826         LDKChannelReestablish this_ptr_conv;
52827         this_ptr_conv.inner = untag_ptr(this_ptr);
52828         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52830         this_ptr_conv.is_owned = false;
52831         LDKThirtyTwoBytes val_ref;
52832         CHECK((*env)->GetArrayLength(env, val) == 32);
52833         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
52834         ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
52835 }
52836
52837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
52838         LDKChannelReestablish this_ptr_conv;
52839         this_ptr_conv.inner = untag_ptr(this_ptr);
52840         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52842         this_ptr_conv.is_owned = false;
52843         int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
52844         return ret_conv;
52845 }
52846
52847 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) {
52848         LDKChannelReestablish this_ptr_conv;
52849         this_ptr_conv.inner = untag_ptr(this_ptr);
52850         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52852         this_ptr_conv.is_owned = false;
52853         ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
52854 }
52855
52856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
52857         LDKChannelReestablish this_ptr_conv;
52858         this_ptr_conv.inner = untag_ptr(this_ptr);
52859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52861         this_ptr_conv.is_owned = false;
52862         int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
52863         return ret_conv;
52864 }
52865
52866 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) {
52867         LDKChannelReestablish this_ptr_conv;
52868         this_ptr_conv.inner = untag_ptr(this_ptr);
52869         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52871         this_ptr_conv.is_owned = false;
52872         ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
52873 }
52874
52875 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
52876         LDKChannelReestablish this_ptr_conv;
52877         this_ptr_conv.inner = untag_ptr(this_ptr);
52878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52880         this_ptr_conv.is_owned = false;
52881         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
52882         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_your_last_per_commitment_secret(&this_ptr_conv));
52883         return ret_arr;
52884 }
52885
52886 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) {
52887         LDKChannelReestablish 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         LDKThirtyTwoBytes val_ref;
52893         CHECK((*env)->GetArrayLength(env, val) == 32);
52894         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
52895         ChannelReestablish_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
52896 }
52897
52898 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
52899         LDKChannelReestablish this_ptr_conv;
52900         this_ptr_conv.inner = untag_ptr(this_ptr);
52901         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52903         this_ptr_conv.is_owned = false;
52904         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52905         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelReestablish_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
52906         return ret_arr;
52907 }
52908
52909 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) {
52910         LDKChannelReestablish this_ptr_conv;
52911         this_ptr_conv.inner = untag_ptr(this_ptr);
52912         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52914         this_ptr_conv.is_owned = false;
52915         LDKPublicKey val_ref;
52916         CHECK((*env)->GetArrayLength(env, val) == 33);
52917         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52918         ChannelReestablish_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
52919 }
52920
52921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
52922         LDKChannelReestablish this_ptr_conv;
52923         this_ptr_conv.inner = untag_ptr(this_ptr);
52924         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52926         this_ptr_conv.is_owned = false;
52927         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
52928         *ret_copy = ChannelReestablish_get_next_funding_txid(&this_ptr_conv);
52929         int64_t ret_ref = tag_ptr(ret_copy, true);
52930         return ret_ref;
52931 }
52932
52933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52934         LDKChannelReestablish this_ptr_conv;
52935         this_ptr_conv.inner = untag_ptr(this_ptr);
52936         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52938         this_ptr_conv.is_owned = false;
52939         void* val_ptr = untag_ptr(val);
52940         CHECK_ACCESS(val_ptr);
52941         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
52942         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
52943         ChannelReestablish_set_next_funding_txid(&this_ptr_conv, val_conv);
52944 }
52945
52946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t next_local_commitment_number_arg, int64_t next_remote_commitment_number_arg, int8_tArray your_last_per_commitment_secret_arg, int8_tArray my_current_per_commitment_point_arg, int64_t next_funding_txid_arg) {
52947         LDKThirtyTwoBytes channel_id_arg_ref;
52948         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
52949         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
52950         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
52951         CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
52952         (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
52953         LDKPublicKey my_current_per_commitment_point_arg_ref;
52954         CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
52955         (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
52956         void* next_funding_txid_arg_ptr = untag_ptr(next_funding_txid_arg);
52957         CHECK_ACCESS(next_funding_txid_arg_ptr);
52958         LDKCOption_ThirtyTwoBytesZ next_funding_txid_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(next_funding_txid_arg_ptr);
52959         next_funding_txid_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(next_funding_txid_arg));
52960         LDKChannelReestablish ret_var = ChannelReestablish_new(channel_id_arg_ref, next_local_commitment_number_arg, next_remote_commitment_number_arg, your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref, next_funding_txid_arg_conv);
52961         int64_t ret_ref = 0;
52962         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52963         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52964         return ret_ref;
52965 }
52966
52967 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
52968         LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
52969         int64_t ret_ref = 0;
52970         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52971         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52972         return ret_ref;
52973 }
52974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52975         LDKChannelReestablish arg_conv;
52976         arg_conv.inner = untag_ptr(arg);
52977         arg_conv.is_owned = ptr_is_owned(arg);
52978         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52979         arg_conv.is_owned = false;
52980         int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
52981         return ret_conv;
52982 }
52983
52984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52985         LDKChannelReestablish orig_conv;
52986         orig_conv.inner = untag_ptr(orig);
52987         orig_conv.is_owned = ptr_is_owned(orig);
52988         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52989         orig_conv.is_owned = false;
52990         LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
52991         int64_t ret_ref = 0;
52992         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52993         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52994         return ret_ref;
52995 }
52996
52997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1hash(JNIEnv *env, jclass clz, int64_t o) {
52998         LDKChannelReestablish o_conv;
52999         o_conv.inner = untag_ptr(o);
53000         o_conv.is_owned = ptr_is_owned(o);
53001         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53002         o_conv.is_owned = false;
53003         int64_t ret_conv = ChannelReestablish_hash(&o_conv);
53004         return ret_conv;
53005 }
53006
53007 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53008         LDKChannelReestablish a_conv;
53009         a_conv.inner = untag_ptr(a);
53010         a_conv.is_owned = ptr_is_owned(a);
53011         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53012         a_conv.is_owned = false;
53013         LDKChannelReestablish b_conv;
53014         b_conv.inner = untag_ptr(b);
53015         b_conv.is_owned = ptr_is_owned(b);
53016         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53017         b_conv.is_owned = false;
53018         jboolean ret_conv = ChannelReestablish_eq(&a_conv, &b_conv);
53019         return ret_conv;
53020 }
53021
53022 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53023         LDKAnnouncementSignatures this_obj_conv;
53024         this_obj_conv.inner = untag_ptr(this_obj);
53025         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53027         AnnouncementSignatures_free(this_obj_conv);
53028 }
53029
53030 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
53031         LDKAnnouncementSignatures this_ptr_conv;
53032         this_ptr_conv.inner = untag_ptr(this_ptr);
53033         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53035         this_ptr_conv.is_owned = false;
53036         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
53037         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
53038         return ret_arr;
53039 }
53040
53041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53042         LDKAnnouncementSignatures this_ptr_conv;
53043         this_ptr_conv.inner = untag_ptr(this_ptr);
53044         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53046         this_ptr_conv.is_owned = false;
53047         LDKThirtyTwoBytes val_ref;
53048         CHECK((*env)->GetArrayLength(env, val) == 32);
53049         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
53050         AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
53051 }
53052
53053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
53054         LDKAnnouncementSignatures 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         int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
53060         return ret_conv;
53061 }
53062
53063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53064         LDKAnnouncementSignatures this_ptr_conv;
53065         this_ptr_conv.inner = untag_ptr(this_ptr);
53066         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53068         this_ptr_conv.is_owned = false;
53069         AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
53070 }
53071
53072 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
53073         LDKAnnouncementSignatures this_ptr_conv;
53074         this_ptr_conv.inner = untag_ptr(this_ptr);
53075         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53077         this_ptr_conv.is_owned = false;
53078         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
53079         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
53080         return ret_arr;
53081 }
53082
53083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53084         LDKAnnouncementSignatures this_ptr_conv;
53085         this_ptr_conv.inner = untag_ptr(this_ptr);
53086         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53088         this_ptr_conv.is_owned = false;
53089         LDKECDSASignature val_ref;
53090         CHECK((*env)->GetArrayLength(env, val) == 64);
53091         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
53092         AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
53093 }
53094
53095 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
53096         LDKAnnouncementSignatures this_ptr_conv;
53097         this_ptr_conv.inner = untag_ptr(this_ptr);
53098         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53100         this_ptr_conv.is_owned = false;
53101         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
53102         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
53103         return ret_arr;
53104 }
53105
53106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53107         LDKAnnouncementSignatures this_ptr_conv;
53108         this_ptr_conv.inner = untag_ptr(this_ptr);
53109         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53111         this_ptr_conv.is_owned = false;
53112         LDKECDSASignature val_ref;
53113         CHECK((*env)->GetArrayLength(env, val) == 64);
53114         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
53115         AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
53116 }
53117
53118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t short_channel_id_arg, int8_tArray node_signature_arg, int8_tArray bitcoin_signature_arg) {
53119         LDKThirtyTwoBytes channel_id_arg_ref;
53120         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
53121         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
53122         LDKECDSASignature node_signature_arg_ref;
53123         CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
53124         (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
53125         LDKECDSASignature bitcoin_signature_arg_ref;
53126         CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
53127         (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
53128         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
53129         int64_t ret_ref = 0;
53130         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53131         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53132         return ret_ref;
53133 }
53134
53135 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
53136         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
53137         int64_t ret_ref = 0;
53138         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53139         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53140         return ret_ref;
53141 }
53142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53143         LDKAnnouncementSignatures arg_conv;
53144         arg_conv.inner = untag_ptr(arg);
53145         arg_conv.is_owned = ptr_is_owned(arg);
53146         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53147         arg_conv.is_owned = false;
53148         int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
53149         return ret_conv;
53150 }
53151
53152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53153         LDKAnnouncementSignatures orig_conv;
53154         orig_conv.inner = untag_ptr(orig);
53155         orig_conv.is_owned = ptr_is_owned(orig);
53156         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53157         orig_conv.is_owned = false;
53158         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
53159         int64_t ret_ref = 0;
53160         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53161         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53162         return ret_ref;
53163 }
53164
53165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
53166         LDKAnnouncementSignatures o_conv;
53167         o_conv.inner = untag_ptr(o);
53168         o_conv.is_owned = ptr_is_owned(o);
53169         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53170         o_conv.is_owned = false;
53171         int64_t ret_conv = AnnouncementSignatures_hash(&o_conv);
53172         return ret_conv;
53173 }
53174
53175 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53176         LDKAnnouncementSignatures a_conv;
53177         a_conv.inner = untag_ptr(a);
53178         a_conv.is_owned = ptr_is_owned(a);
53179         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53180         a_conv.is_owned = false;
53181         LDKAnnouncementSignatures b_conv;
53182         b_conv.inner = untag_ptr(b);
53183         b_conv.is_owned = ptr_is_owned(b);
53184         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53185         b_conv.is_owned = false;
53186         jboolean ret_conv = AnnouncementSignatures_eq(&a_conv, &b_conv);
53187         return ret_conv;
53188 }
53189
53190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
53191         if (!ptr_is_owned(this_ptr)) return;
53192         void* this_ptr_ptr = untag_ptr(this_ptr);
53193         CHECK_ACCESS(this_ptr_ptr);
53194         LDKSocketAddress this_ptr_conv = *(LDKSocketAddress*)(this_ptr_ptr);
53195         FREE(untag_ptr(this_ptr));
53196         SocketAddress_free(this_ptr_conv);
53197 }
53198
53199 static inline uint64_t SocketAddress_clone_ptr(LDKSocketAddress *NONNULL_PTR arg) {
53200         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
53201         *ret_copy = SocketAddress_clone(arg);
53202         int64_t ret_ref = tag_ptr(ret_copy, true);
53203         return ret_ref;
53204 }
53205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53206         LDKSocketAddress* arg_conv = (LDKSocketAddress*)untag_ptr(arg);
53207         int64_t ret_conv = SocketAddress_clone_ptr(arg_conv);
53208         return ret_conv;
53209 }
53210
53211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53212         LDKSocketAddress* orig_conv = (LDKSocketAddress*)untag_ptr(orig);
53213         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
53214         *ret_copy = SocketAddress_clone(orig_conv);
53215         int64_t ret_ref = tag_ptr(ret_copy, true);
53216         return ret_ref;
53217 }
53218
53219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1tcp_1ip_1v4(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
53220         LDKFourBytes addr_ref;
53221         CHECK((*env)->GetArrayLength(env, addr) == 4);
53222         (*env)->GetByteArrayRegion(env, addr, 0, 4, addr_ref.data);
53223         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
53224         *ret_copy = SocketAddress_tcp_ip_v4(addr_ref, port);
53225         int64_t ret_ref = tag_ptr(ret_copy, true);
53226         return ret_ref;
53227 }
53228
53229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1tcp_1ip_1v6(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
53230         LDKSixteenBytes addr_ref;
53231         CHECK((*env)->GetArrayLength(env, addr) == 16);
53232         (*env)->GetByteArrayRegion(env, addr, 0, 16, addr_ref.data);
53233         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
53234         *ret_copy = SocketAddress_tcp_ip_v6(addr_ref, port);
53235         int64_t ret_ref = tag_ptr(ret_copy, true);
53236         return ret_ref;
53237 }
53238
53239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1onion_1v2(JNIEnv *env, jclass clz, int8_tArray a) {
53240         LDKTwelveBytes a_ref;
53241         CHECK((*env)->GetArrayLength(env, a) == 12);
53242         (*env)->GetByteArrayRegion(env, a, 0, 12, a_ref.data);
53243         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
53244         *ret_copy = SocketAddress_onion_v2(a_ref);
53245         int64_t ret_ref = tag_ptr(ret_copy, true);
53246         return ret_ref;
53247 }
53248
53249 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) {
53250         LDKThirtyTwoBytes ed25519_pubkey_ref;
53251         CHECK((*env)->GetArrayLength(env, ed25519_pubkey) == 32);
53252         (*env)->GetByteArrayRegion(env, ed25519_pubkey, 0, 32, ed25519_pubkey_ref.data);
53253         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
53254         *ret_copy = SocketAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
53255         int64_t ret_ref = tag_ptr(ret_copy, true);
53256         return ret_ref;
53257 }
53258
53259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1hostname(JNIEnv *env, jclass clz, int64_t hostname, int16_t port) {
53260         LDKHostname hostname_conv;
53261         hostname_conv.inner = untag_ptr(hostname);
53262         hostname_conv.is_owned = ptr_is_owned(hostname);
53263         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
53264         hostname_conv = Hostname_clone(&hostname_conv);
53265         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
53266         *ret_copy = SocketAddress_hostname(hostname_conv, port);
53267         int64_t ret_ref = tag_ptr(ret_copy, true);
53268         return ret_ref;
53269 }
53270
53271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1hash(JNIEnv *env, jclass clz, int64_t o) {
53272         LDKSocketAddress* o_conv = (LDKSocketAddress*)untag_ptr(o);
53273         int64_t ret_conv = SocketAddress_hash(o_conv);
53274         return ret_conv;
53275 }
53276
53277 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SocketAddress_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53278         LDKSocketAddress* a_conv = (LDKSocketAddress*)untag_ptr(a);
53279         LDKSocketAddress* b_conv = (LDKSocketAddress*)untag_ptr(b);
53280         jboolean ret_conv = SocketAddress_eq(a_conv, b_conv);
53281         return ret_conv;
53282 }
53283
53284 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SocketAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
53285         LDKSocketAddress* obj_conv = (LDKSocketAddress*)untag_ptr(obj);
53286         LDKCVec_u8Z ret_var = SocketAddress_write(obj_conv);
53287         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53288         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53289         CVec_u8Z_free(ret_var);
53290         return ret_arr;
53291 }
53292
53293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
53294         LDKu8slice ser_ref;
53295         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
53296         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
53297         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
53298         *ret_conv = SocketAddress_read(ser_ref);
53299         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
53300         return tag_ptr(ret_conv, true);
53301 }
53302
53303 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53304         LDKSocketAddressParseError* orig_conv = (LDKSocketAddressParseError*)untag_ptr(orig);
53305         jclass ret_conv = LDKSocketAddressParseError_to_java(env, SocketAddressParseError_clone(orig_conv));
53306         return ret_conv;
53307 }
53308
53309 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1socket_1addr_1parse(JNIEnv *env, jclass clz) {
53310         jclass ret_conv = LDKSocketAddressParseError_to_java(env, SocketAddressParseError_socket_addr_parse());
53311         return ret_conv;
53312 }
53313
53314 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1invalid_1input(JNIEnv *env, jclass clz) {
53315         jclass ret_conv = LDKSocketAddressParseError_to_java(env, SocketAddressParseError_invalid_input());
53316         return ret_conv;
53317 }
53318
53319 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1invalid_1port(JNIEnv *env, jclass clz) {
53320         jclass ret_conv = LDKSocketAddressParseError_to_java(env, SocketAddressParseError_invalid_port());
53321         return ret_conv;
53322 }
53323
53324 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1invalid_1onion_1v3(JNIEnv *env, jclass clz) {
53325         jclass ret_conv = LDKSocketAddressParseError_to_java(env, SocketAddressParseError_invalid_onion_v3());
53326         return ret_conv;
53327 }
53328
53329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1hash(JNIEnv *env, jclass clz, int64_t o) {
53330         LDKSocketAddressParseError* o_conv = (LDKSocketAddressParseError*)untag_ptr(o);
53331         int64_t ret_conv = SocketAddressParseError_hash(o_conv);
53332         return ret_conv;
53333 }
53334
53335 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53336         LDKSocketAddressParseError* a_conv = (LDKSocketAddressParseError*)untag_ptr(a);
53337         LDKSocketAddressParseError* b_conv = (LDKSocketAddressParseError*)untag_ptr(b);
53338         jboolean ret_conv = SocketAddressParseError_eq(a_conv, b_conv);
53339         return ret_conv;
53340 }
53341
53342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_parse_1onion_1address(JNIEnv *env, jclass clz, jstring host, int16_t port) {
53343         LDKStr host_conv = java_to_owned_str(env, host);
53344         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
53345         *ret_conv = parse_onion_address(host_conv, port);
53346         return tag_ptr(ret_conv, true);
53347 }
53348
53349 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SocketAddress_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
53350         LDKSocketAddress* o_conv = (LDKSocketAddress*)untag_ptr(o);
53351         LDKStr ret_str = SocketAddress_to_str(o_conv);
53352         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
53353         Str_free(ret_str);
53354         return ret_conv;
53355 }
53356
53357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1from_1str(JNIEnv *env, jclass clz, jstring s) {
53358         LDKStr s_conv = java_to_owned_str(env, s);
53359         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
53360         *ret_conv = SocketAddress_from_str(s_conv);
53361         return tag_ptr(ret_conv, true);
53362 }
53363
53364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
53365         if (!ptr_is_owned(this_ptr)) return;
53366         void* this_ptr_ptr = untag_ptr(this_ptr);
53367         CHECK_ACCESS(this_ptr_ptr);
53368         LDKUnsignedGossipMessage this_ptr_conv = *(LDKUnsignedGossipMessage*)(this_ptr_ptr);
53369         FREE(untag_ptr(this_ptr));
53370         UnsignedGossipMessage_free(this_ptr_conv);
53371 }
53372
53373 static inline uint64_t UnsignedGossipMessage_clone_ptr(LDKUnsignedGossipMessage *NONNULL_PTR arg) {
53374         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
53375         *ret_copy = UnsignedGossipMessage_clone(arg);
53376         int64_t ret_ref = tag_ptr(ret_copy, true);
53377         return ret_ref;
53378 }
53379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53380         LDKUnsignedGossipMessage* arg_conv = (LDKUnsignedGossipMessage*)untag_ptr(arg);
53381         int64_t ret_conv = UnsignedGossipMessage_clone_ptr(arg_conv);
53382         return ret_conv;
53383 }
53384
53385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53386         LDKUnsignedGossipMessage* orig_conv = (LDKUnsignedGossipMessage*)untag_ptr(orig);
53387         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
53388         *ret_copy = UnsignedGossipMessage_clone(orig_conv);
53389         int64_t ret_ref = tag_ptr(ret_copy, true);
53390         return ret_ref;
53391 }
53392
53393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1channel_1announcement(JNIEnv *env, jclass clz, int64_t a) {
53394         LDKUnsignedChannelAnnouncement a_conv;
53395         a_conv.inner = untag_ptr(a);
53396         a_conv.is_owned = ptr_is_owned(a);
53397         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53398         a_conv = UnsignedChannelAnnouncement_clone(&a_conv);
53399         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
53400         *ret_copy = UnsignedGossipMessage_channel_announcement(a_conv);
53401         int64_t ret_ref = tag_ptr(ret_copy, true);
53402         return ret_ref;
53403 }
53404
53405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1channel_1update(JNIEnv *env, jclass clz, int64_t a) {
53406         LDKUnsignedChannelUpdate a_conv;
53407         a_conv.inner = untag_ptr(a);
53408         a_conv.is_owned = ptr_is_owned(a);
53409         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53410         a_conv = UnsignedChannelUpdate_clone(&a_conv);
53411         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
53412         *ret_copy = UnsignedGossipMessage_channel_update(a_conv);
53413         int64_t ret_ref = tag_ptr(ret_copy, true);
53414         return ret_ref;
53415 }
53416
53417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1node_1announcement(JNIEnv *env, jclass clz, int64_t a) {
53418         LDKUnsignedNodeAnnouncement a_conv;
53419         a_conv.inner = untag_ptr(a);
53420         a_conv.is_owned = ptr_is_owned(a);
53421         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53422         a_conv = UnsignedNodeAnnouncement_clone(&a_conv);
53423         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
53424         *ret_copy = UnsignedGossipMessage_node_announcement(a_conv);
53425         int64_t ret_ref = tag_ptr(ret_copy, true);
53426         return ret_ref;
53427 }
53428
53429 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
53430         LDKUnsignedGossipMessage* obj_conv = (LDKUnsignedGossipMessage*)untag_ptr(obj);
53431         LDKCVec_u8Z ret_var = UnsignedGossipMessage_write(obj_conv);
53432         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53433         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53434         CVec_u8Z_free(ret_var);
53435         return ret_arr;
53436 }
53437
53438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53439         LDKUnsignedNodeAnnouncement this_obj_conv;
53440         this_obj_conv.inner = untag_ptr(this_obj);
53441         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53443         UnsignedNodeAnnouncement_free(this_obj_conv);
53444 }
53445
53446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
53447         LDKUnsignedNodeAnnouncement this_ptr_conv;
53448         this_ptr_conv.inner = untag_ptr(this_ptr);
53449         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53451         this_ptr_conv.is_owned = false;
53452         LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
53453         int64_t ret_ref = 0;
53454         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53455         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53456         return ret_ref;
53457 }
53458
53459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53460         LDKUnsignedNodeAnnouncement this_ptr_conv;
53461         this_ptr_conv.inner = untag_ptr(this_ptr);
53462         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53464         this_ptr_conv.is_owned = false;
53465         LDKNodeFeatures val_conv;
53466         val_conv.inner = untag_ptr(val);
53467         val_conv.is_owned = ptr_is_owned(val);
53468         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53469         val_conv = NodeFeatures_clone(&val_conv);
53470         UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
53471 }
53472
53473 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
53474         LDKUnsignedNodeAnnouncement this_ptr_conv;
53475         this_ptr_conv.inner = untag_ptr(this_ptr);
53476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53478         this_ptr_conv.is_owned = false;
53479         int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
53480         return ret_conv;
53481 }
53482
53483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
53484         LDKUnsignedNodeAnnouncement this_ptr_conv;
53485         this_ptr_conv.inner = untag_ptr(this_ptr);
53486         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53488         this_ptr_conv.is_owned = false;
53489         UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
53490 }
53491
53492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
53493         LDKUnsignedNodeAnnouncement this_ptr_conv;
53494         this_ptr_conv.inner = untag_ptr(this_ptr);
53495         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53497         this_ptr_conv.is_owned = false;
53498         LDKNodeId ret_var = UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv);
53499         int64_t ret_ref = 0;
53500         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53501         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53502         return ret_ref;
53503 }
53504
53505 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53506         LDKUnsignedNodeAnnouncement this_ptr_conv;
53507         this_ptr_conv.inner = untag_ptr(this_ptr);
53508         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53510         this_ptr_conv.is_owned = false;
53511         LDKNodeId val_conv;
53512         val_conv.inner = untag_ptr(val);
53513         val_conv.is_owned = ptr_is_owned(val);
53514         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53515         val_conv = NodeId_clone(&val_conv);
53516         UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_conv);
53517 }
53518
53519 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
53520         LDKUnsignedNodeAnnouncement this_ptr_conv;
53521         this_ptr_conv.inner = untag_ptr(this_ptr);
53522         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53524         this_ptr_conv.is_owned = false;
53525         int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
53526         (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
53527         return ret_arr;
53528 }
53529
53530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53531         LDKUnsignedNodeAnnouncement this_ptr_conv;
53532         this_ptr_conv.inner = untag_ptr(this_ptr);
53533         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53535         this_ptr_conv.is_owned = false;
53536         LDKThreeBytes val_ref;
53537         CHECK((*env)->GetArrayLength(env, val) == 3);
53538         (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
53539         UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
53540 }
53541
53542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
53543         LDKUnsignedNodeAnnouncement this_ptr_conv;
53544         this_ptr_conv.inner = untag_ptr(this_ptr);
53545         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53547         this_ptr_conv.is_owned = false;
53548         LDKNodeAlias ret_var = UnsignedNodeAnnouncement_get_alias(&this_ptr_conv);
53549         int64_t ret_ref = 0;
53550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53552         return ret_ref;
53553 }
53554
53555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53556         LDKUnsignedNodeAnnouncement this_ptr_conv;
53557         this_ptr_conv.inner = untag_ptr(this_ptr);
53558         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53560         this_ptr_conv.is_owned = false;
53561         LDKNodeAlias val_conv;
53562         val_conv.inner = untag_ptr(val);
53563         val_conv.is_owned = ptr_is_owned(val);
53564         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53565         val_conv = NodeAlias_clone(&val_conv);
53566         UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_conv);
53567 }
53568
53569 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr) {
53570         LDKUnsignedNodeAnnouncement this_ptr_conv;
53571         this_ptr_conv.inner = untag_ptr(this_ptr);
53572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53574         this_ptr_conv.is_owned = false;
53575         LDKCVec_SocketAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
53576         int64_tArray ret_arr = NULL;
53577         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
53578         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
53579         for (size_t p = 0; p < ret_var.datalen; p++) {
53580                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
53581                 *ret_conv_15_copy = ret_var.data[p];
53582                 int64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
53583                 ret_arr_ptr[p] = ret_conv_15_ref;
53584         }
53585         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
53586         FREE(ret_var.data);
53587         return ret_arr;
53588 }
53589
53590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
53591         LDKUnsignedNodeAnnouncement this_ptr_conv;
53592         this_ptr_conv.inner = untag_ptr(this_ptr);
53593         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53595         this_ptr_conv.is_owned = false;
53596         LDKCVec_SocketAddressZ val_constr;
53597         val_constr.datalen = (*env)->GetArrayLength(env, val);
53598         if (val_constr.datalen > 0)
53599                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
53600         else
53601                 val_constr.data = NULL;
53602         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
53603         for (size_t p = 0; p < val_constr.datalen; p++) {
53604                 int64_t val_conv_15 = val_vals[p];
53605                 void* val_conv_15_ptr = untag_ptr(val_conv_15);
53606                 CHECK_ACCESS(val_conv_15_ptr);
53607                 LDKSocketAddress val_conv_15_conv = *(LDKSocketAddress*)(val_conv_15_ptr);
53608                 val_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(val_conv_15));
53609                 val_constr.data[p] = val_conv_15_conv;
53610         }
53611         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
53612         UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
53613 }
53614
53615 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
53616         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
53617         int64_t ret_ref = 0;
53618         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53619         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53620         return ret_ref;
53621 }
53622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53623         LDKUnsignedNodeAnnouncement arg_conv;
53624         arg_conv.inner = untag_ptr(arg);
53625         arg_conv.is_owned = ptr_is_owned(arg);
53626         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53627         arg_conv.is_owned = false;
53628         int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
53629         return ret_conv;
53630 }
53631
53632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53633         LDKUnsignedNodeAnnouncement orig_conv;
53634         orig_conv.inner = untag_ptr(orig);
53635         orig_conv.is_owned = ptr_is_owned(orig);
53636         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53637         orig_conv.is_owned = false;
53638         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
53639         int64_t ret_ref = 0;
53640         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53641         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53642         return ret_ref;
53643 }
53644
53645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1hash(JNIEnv *env, jclass clz, int64_t o) {
53646         LDKUnsignedNodeAnnouncement o_conv;
53647         o_conv.inner = untag_ptr(o);
53648         o_conv.is_owned = ptr_is_owned(o);
53649         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53650         o_conv.is_owned = false;
53651         int64_t ret_conv = UnsignedNodeAnnouncement_hash(&o_conv);
53652         return ret_conv;
53653 }
53654
53655 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53656         LDKUnsignedNodeAnnouncement a_conv;
53657         a_conv.inner = untag_ptr(a);
53658         a_conv.is_owned = ptr_is_owned(a);
53659         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53660         a_conv.is_owned = false;
53661         LDKUnsignedNodeAnnouncement b_conv;
53662         b_conv.inner = untag_ptr(b);
53663         b_conv.is_owned = ptr_is_owned(b);
53664         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53665         b_conv.is_owned = false;
53666         jboolean ret_conv = UnsignedNodeAnnouncement_eq(&a_conv, &b_conv);
53667         return ret_conv;
53668 }
53669
53670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53671         LDKNodeAnnouncement this_obj_conv;
53672         this_obj_conv.inner = untag_ptr(this_obj);
53673         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53675         NodeAnnouncement_free(this_obj_conv);
53676 }
53677
53678 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
53679         LDKNodeAnnouncement this_ptr_conv;
53680         this_ptr_conv.inner = untag_ptr(this_ptr);
53681         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53683         this_ptr_conv.is_owned = false;
53684         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
53685         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
53686         return ret_arr;
53687 }
53688
53689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53690         LDKNodeAnnouncement this_ptr_conv;
53691         this_ptr_conv.inner = untag_ptr(this_ptr);
53692         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53694         this_ptr_conv.is_owned = false;
53695         LDKECDSASignature val_ref;
53696         CHECK((*env)->GetArrayLength(env, val) == 64);
53697         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
53698         NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
53699 }
53700
53701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
53702         LDKNodeAnnouncement this_ptr_conv;
53703         this_ptr_conv.inner = untag_ptr(this_ptr);
53704         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53706         this_ptr_conv.is_owned = false;
53707         LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
53708         int64_t ret_ref = 0;
53709         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53710         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53711         return ret_ref;
53712 }
53713
53714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53715         LDKNodeAnnouncement this_ptr_conv;
53716         this_ptr_conv.inner = untag_ptr(this_ptr);
53717         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53719         this_ptr_conv.is_owned = false;
53720         LDKUnsignedNodeAnnouncement val_conv;
53721         val_conv.inner = untag_ptr(val);
53722         val_conv.is_owned = ptr_is_owned(val);
53723         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53724         val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
53725         NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
53726 }
53727
53728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
53729         LDKECDSASignature signature_arg_ref;
53730         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
53731         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
53732         LDKUnsignedNodeAnnouncement contents_arg_conv;
53733         contents_arg_conv.inner = untag_ptr(contents_arg);
53734         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
53735         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
53736         contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
53737         LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
53738         int64_t ret_ref = 0;
53739         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53740         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53741         return ret_ref;
53742 }
53743
53744 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
53745         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
53746         int64_t ret_ref = 0;
53747         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53748         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53749         return ret_ref;
53750 }
53751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53752         LDKNodeAnnouncement arg_conv;
53753         arg_conv.inner = untag_ptr(arg);
53754         arg_conv.is_owned = ptr_is_owned(arg);
53755         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53756         arg_conv.is_owned = false;
53757         int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
53758         return ret_conv;
53759 }
53760
53761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53762         LDKNodeAnnouncement orig_conv;
53763         orig_conv.inner = untag_ptr(orig);
53764         orig_conv.is_owned = ptr_is_owned(orig);
53765         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53766         orig_conv.is_owned = false;
53767         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
53768         int64_t ret_ref = 0;
53769         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53770         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53771         return ret_ref;
53772 }
53773
53774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1hash(JNIEnv *env, jclass clz, int64_t o) {
53775         LDKNodeAnnouncement o_conv;
53776         o_conv.inner = untag_ptr(o);
53777         o_conv.is_owned = ptr_is_owned(o);
53778         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53779         o_conv.is_owned = false;
53780         int64_t ret_conv = NodeAnnouncement_hash(&o_conv);
53781         return ret_conv;
53782 }
53783
53784 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53785         LDKNodeAnnouncement a_conv;
53786         a_conv.inner = untag_ptr(a);
53787         a_conv.is_owned = ptr_is_owned(a);
53788         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53789         a_conv.is_owned = false;
53790         LDKNodeAnnouncement b_conv;
53791         b_conv.inner = untag_ptr(b);
53792         b_conv.is_owned = ptr_is_owned(b);
53793         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53794         b_conv.is_owned = false;
53795         jboolean ret_conv = NodeAnnouncement_eq(&a_conv, &b_conv);
53796         return ret_conv;
53797 }
53798
53799 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53800         LDKUnsignedChannelAnnouncement this_obj_conv;
53801         this_obj_conv.inner = untag_ptr(this_obj);
53802         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53804         UnsignedChannelAnnouncement_free(this_obj_conv);
53805 }
53806
53807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
53808         LDKUnsignedChannelAnnouncement this_ptr_conv;
53809         this_ptr_conv.inner = untag_ptr(this_ptr);
53810         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53812         this_ptr_conv.is_owned = false;
53813         LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
53814         int64_t ret_ref = 0;
53815         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53816         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53817         return ret_ref;
53818 }
53819
53820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53821         LDKUnsignedChannelAnnouncement this_ptr_conv;
53822         this_ptr_conv.inner = untag_ptr(this_ptr);
53823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53825         this_ptr_conv.is_owned = false;
53826         LDKChannelFeatures val_conv;
53827         val_conv.inner = untag_ptr(val);
53828         val_conv.is_owned = ptr_is_owned(val);
53829         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53830         val_conv = ChannelFeatures_clone(&val_conv);
53831         UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
53832 }
53833
53834 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
53835         LDKUnsignedChannelAnnouncement this_ptr_conv;
53836         this_ptr_conv.inner = untag_ptr(this_ptr);
53837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53839         this_ptr_conv.is_owned = false;
53840         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
53841         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
53842         return ret_arr;
53843 }
53844
53845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53846         LDKUnsignedChannelAnnouncement this_ptr_conv;
53847         this_ptr_conv.inner = untag_ptr(this_ptr);
53848         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53850         this_ptr_conv.is_owned = false;
53851         LDKThirtyTwoBytes val_ref;
53852         CHECK((*env)->GetArrayLength(env, val) == 32);
53853         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
53854         UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
53855 }
53856
53857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
53858         LDKUnsignedChannelAnnouncement this_ptr_conv;
53859         this_ptr_conv.inner = untag_ptr(this_ptr);
53860         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53862         this_ptr_conv.is_owned = false;
53863         int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
53864         return ret_conv;
53865 }
53866
53867 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53868         LDKUnsignedChannelAnnouncement this_ptr_conv;
53869         this_ptr_conv.inner = untag_ptr(this_ptr);
53870         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53872         this_ptr_conv.is_owned = false;
53873         UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
53874 }
53875
53876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
53877         LDKUnsignedChannelAnnouncement this_ptr_conv;
53878         this_ptr_conv.inner = untag_ptr(this_ptr);
53879         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53881         this_ptr_conv.is_owned = false;
53882         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv);
53883         int64_t ret_ref = 0;
53884         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53885         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53886         return ret_ref;
53887 }
53888
53889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53890         LDKUnsignedChannelAnnouncement this_ptr_conv;
53891         this_ptr_conv.inner = untag_ptr(this_ptr);
53892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53894         this_ptr_conv.is_owned = false;
53895         LDKNodeId val_conv;
53896         val_conv.inner = untag_ptr(val);
53897         val_conv.is_owned = ptr_is_owned(val);
53898         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53899         val_conv = NodeId_clone(&val_conv);
53900         UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_conv);
53901 }
53902
53903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
53904         LDKUnsignedChannelAnnouncement this_ptr_conv;
53905         this_ptr_conv.inner = untag_ptr(this_ptr);
53906         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53908         this_ptr_conv.is_owned = false;
53909         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv);
53910         int64_t ret_ref = 0;
53911         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53912         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53913         return ret_ref;
53914 }
53915
53916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53917         LDKUnsignedChannelAnnouncement this_ptr_conv;
53918         this_ptr_conv.inner = untag_ptr(this_ptr);
53919         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53921         this_ptr_conv.is_owned = false;
53922         LDKNodeId val_conv;
53923         val_conv.inner = untag_ptr(val);
53924         val_conv.is_owned = ptr_is_owned(val);
53925         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53926         val_conv = NodeId_clone(&val_conv);
53927         UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_conv);
53928 }
53929
53930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
53931         LDKUnsignedChannelAnnouncement this_ptr_conv;
53932         this_ptr_conv.inner = untag_ptr(this_ptr);
53933         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53935         this_ptr_conv.is_owned = false;
53936         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv);
53937         int64_t ret_ref = 0;
53938         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53939         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53940         return ret_ref;
53941 }
53942
53943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53944         LDKUnsignedChannelAnnouncement this_ptr_conv;
53945         this_ptr_conv.inner = untag_ptr(this_ptr);
53946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53948         this_ptr_conv.is_owned = false;
53949         LDKNodeId val_conv;
53950         val_conv.inner = untag_ptr(val);
53951         val_conv.is_owned = ptr_is_owned(val);
53952         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53953         val_conv = NodeId_clone(&val_conv);
53954         UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_conv);
53955 }
53956
53957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
53958         LDKUnsignedChannelAnnouncement this_ptr_conv;
53959         this_ptr_conv.inner = untag_ptr(this_ptr);
53960         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53962         this_ptr_conv.is_owned = false;
53963         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv);
53964         int64_t ret_ref = 0;
53965         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53966         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53967         return ret_ref;
53968 }
53969
53970 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53971         LDKUnsignedChannelAnnouncement this_ptr_conv;
53972         this_ptr_conv.inner = untag_ptr(this_ptr);
53973         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53975         this_ptr_conv.is_owned = false;
53976         LDKNodeId val_conv;
53977         val_conv.inner = untag_ptr(val);
53978         val_conv.is_owned = ptr_is_owned(val);
53979         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53980         val_conv = NodeId_clone(&val_conv);
53981         UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_conv);
53982 }
53983
53984 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
53985         LDKUnsignedChannelAnnouncement this_ptr_conv;
53986         this_ptr_conv.inner = untag_ptr(this_ptr);
53987         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53989         this_ptr_conv.is_owned = false;
53990         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_get_excess_data(&this_ptr_conv);
53991         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53992         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53993         CVec_u8Z_free(ret_var);
53994         return ret_arr;
53995 }
53996
53997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53998         LDKUnsignedChannelAnnouncement this_ptr_conv;
53999         this_ptr_conv.inner = untag_ptr(this_ptr);
54000         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54002         this_ptr_conv.is_owned = false;
54003         LDKCVec_u8Z val_ref;
54004         val_ref.datalen = (*env)->GetArrayLength(env, val);
54005         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
54006         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
54007         UnsignedChannelAnnouncement_set_excess_data(&this_ptr_conv, val_ref);
54008 }
54009
54010 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) {
54011         LDKChannelFeatures features_arg_conv;
54012         features_arg_conv.inner = untag_ptr(features_arg);
54013         features_arg_conv.is_owned = ptr_is_owned(features_arg);
54014         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
54015         features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
54016         LDKThirtyTwoBytes chain_hash_arg_ref;
54017         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
54018         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
54019         LDKNodeId node_id_1_arg_conv;
54020         node_id_1_arg_conv.inner = untag_ptr(node_id_1_arg);
54021         node_id_1_arg_conv.is_owned = ptr_is_owned(node_id_1_arg);
54022         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_1_arg_conv);
54023         node_id_1_arg_conv = NodeId_clone(&node_id_1_arg_conv);
54024         LDKNodeId node_id_2_arg_conv;
54025         node_id_2_arg_conv.inner = untag_ptr(node_id_2_arg);
54026         node_id_2_arg_conv.is_owned = ptr_is_owned(node_id_2_arg);
54027         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_2_arg_conv);
54028         node_id_2_arg_conv = NodeId_clone(&node_id_2_arg_conv);
54029         LDKNodeId bitcoin_key_1_arg_conv;
54030         bitcoin_key_1_arg_conv.inner = untag_ptr(bitcoin_key_1_arg);
54031         bitcoin_key_1_arg_conv.is_owned = ptr_is_owned(bitcoin_key_1_arg);
54032         CHECK_INNER_FIELD_ACCESS_OR_NULL(bitcoin_key_1_arg_conv);
54033         bitcoin_key_1_arg_conv = NodeId_clone(&bitcoin_key_1_arg_conv);
54034         LDKNodeId bitcoin_key_2_arg_conv;
54035         bitcoin_key_2_arg_conv.inner = untag_ptr(bitcoin_key_2_arg);
54036         bitcoin_key_2_arg_conv.is_owned = ptr_is_owned(bitcoin_key_2_arg);
54037         CHECK_INNER_FIELD_ACCESS_OR_NULL(bitcoin_key_2_arg_conv);
54038         bitcoin_key_2_arg_conv = NodeId_clone(&bitcoin_key_2_arg_conv);
54039         LDKCVec_u8Z excess_data_arg_ref;
54040         excess_data_arg_ref.datalen = (*env)->GetArrayLength(env, excess_data_arg);
54041         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
54042         (*env)->GetByteArrayRegion(env, excess_data_arg, 0, excess_data_arg_ref.datalen, excess_data_arg_ref.data);
54043         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);
54044         int64_t ret_ref = 0;
54045         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54046         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54047         return ret_ref;
54048 }
54049
54050 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
54051         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
54052         int64_t ret_ref = 0;
54053         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54054         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54055         return ret_ref;
54056 }
54057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54058         LDKUnsignedChannelAnnouncement arg_conv;
54059         arg_conv.inner = untag_ptr(arg);
54060         arg_conv.is_owned = ptr_is_owned(arg);
54061         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54062         arg_conv.is_owned = false;
54063         int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
54064         return ret_conv;
54065 }
54066
54067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54068         LDKUnsignedChannelAnnouncement orig_conv;
54069         orig_conv.inner = untag_ptr(orig);
54070         orig_conv.is_owned = ptr_is_owned(orig);
54071         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54072         orig_conv.is_owned = false;
54073         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
54074         int64_t ret_ref = 0;
54075         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54076         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54077         return ret_ref;
54078 }
54079
54080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1hash(JNIEnv *env, jclass clz, int64_t o) {
54081         LDKUnsignedChannelAnnouncement o_conv;
54082         o_conv.inner = untag_ptr(o);
54083         o_conv.is_owned = ptr_is_owned(o);
54084         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54085         o_conv.is_owned = false;
54086         int64_t ret_conv = UnsignedChannelAnnouncement_hash(&o_conv);
54087         return ret_conv;
54088 }
54089
54090 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54091         LDKUnsignedChannelAnnouncement a_conv;
54092         a_conv.inner = untag_ptr(a);
54093         a_conv.is_owned = ptr_is_owned(a);
54094         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54095         a_conv.is_owned = false;
54096         LDKUnsignedChannelAnnouncement b_conv;
54097         b_conv.inner = untag_ptr(b);
54098         b_conv.is_owned = ptr_is_owned(b);
54099         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54100         b_conv.is_owned = false;
54101         jboolean ret_conv = UnsignedChannelAnnouncement_eq(&a_conv, &b_conv);
54102         return ret_conv;
54103 }
54104
54105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54106         LDKChannelAnnouncement this_obj_conv;
54107         this_obj_conv.inner = untag_ptr(this_obj);
54108         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54110         ChannelAnnouncement_free(this_obj_conv);
54111 }
54112
54113 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
54114         LDKChannelAnnouncement this_ptr_conv;
54115         this_ptr_conv.inner = untag_ptr(this_ptr);
54116         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54118         this_ptr_conv.is_owned = false;
54119         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
54120         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
54121         return ret_arr;
54122 }
54123
54124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
54125         LDKChannelAnnouncement this_ptr_conv;
54126         this_ptr_conv.inner = untag_ptr(this_ptr);
54127         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54129         this_ptr_conv.is_owned = false;
54130         LDKECDSASignature val_ref;
54131         CHECK((*env)->GetArrayLength(env, val) == 64);
54132         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
54133         ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
54134 }
54135
54136 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
54137         LDKChannelAnnouncement this_ptr_conv;
54138         this_ptr_conv.inner = untag_ptr(this_ptr);
54139         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54141         this_ptr_conv.is_owned = false;
54142         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
54143         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
54144         return ret_arr;
54145 }
54146
54147 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
54148         LDKChannelAnnouncement this_ptr_conv;
54149         this_ptr_conv.inner = untag_ptr(this_ptr);
54150         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54152         this_ptr_conv.is_owned = false;
54153         LDKECDSASignature val_ref;
54154         CHECK((*env)->GetArrayLength(env, val) == 64);
54155         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
54156         ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
54157 }
54158
54159 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
54160         LDKChannelAnnouncement this_ptr_conv;
54161         this_ptr_conv.inner = untag_ptr(this_ptr);
54162         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54164         this_ptr_conv.is_owned = false;
54165         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
54166         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
54167         return ret_arr;
54168 }
54169
54170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
54171         LDKChannelAnnouncement this_ptr_conv;
54172         this_ptr_conv.inner = untag_ptr(this_ptr);
54173         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54175         this_ptr_conv.is_owned = false;
54176         LDKECDSASignature val_ref;
54177         CHECK((*env)->GetArrayLength(env, val) == 64);
54178         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
54179         ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
54180 }
54181
54182 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
54183         LDKChannelAnnouncement this_ptr_conv;
54184         this_ptr_conv.inner = untag_ptr(this_ptr);
54185         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54187         this_ptr_conv.is_owned = false;
54188         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
54189         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
54190         return ret_arr;
54191 }
54192
54193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
54194         LDKChannelAnnouncement this_ptr_conv;
54195         this_ptr_conv.inner = untag_ptr(this_ptr);
54196         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54198         this_ptr_conv.is_owned = false;
54199         LDKECDSASignature val_ref;
54200         CHECK((*env)->GetArrayLength(env, val) == 64);
54201         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
54202         ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
54203 }
54204
54205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
54206         LDKChannelAnnouncement this_ptr_conv;
54207         this_ptr_conv.inner = untag_ptr(this_ptr);
54208         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54210         this_ptr_conv.is_owned = false;
54211         LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
54212         int64_t ret_ref = 0;
54213         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54214         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54215         return ret_ref;
54216 }
54217
54218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
54219         LDKChannelAnnouncement this_ptr_conv;
54220         this_ptr_conv.inner = untag_ptr(this_ptr);
54221         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54223         this_ptr_conv.is_owned = false;
54224         LDKUnsignedChannelAnnouncement val_conv;
54225         val_conv.inner = untag_ptr(val);
54226         val_conv.is_owned = ptr_is_owned(val);
54227         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54228         val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
54229         ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
54230 }
54231
54232 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) {
54233         LDKECDSASignature node_signature_1_arg_ref;
54234         CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
54235         (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
54236         LDKECDSASignature node_signature_2_arg_ref;
54237         CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
54238         (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
54239         LDKECDSASignature bitcoin_signature_1_arg_ref;
54240         CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
54241         (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
54242         LDKECDSASignature bitcoin_signature_2_arg_ref;
54243         CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
54244         (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
54245         LDKUnsignedChannelAnnouncement contents_arg_conv;
54246         contents_arg_conv.inner = untag_ptr(contents_arg);
54247         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
54248         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
54249         contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
54250         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);
54251         int64_t ret_ref = 0;
54252         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54253         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54254         return ret_ref;
54255 }
54256
54257 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
54258         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
54259         int64_t ret_ref = 0;
54260         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54261         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54262         return ret_ref;
54263 }
54264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54265         LDKChannelAnnouncement arg_conv;
54266         arg_conv.inner = untag_ptr(arg);
54267         arg_conv.is_owned = ptr_is_owned(arg);
54268         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54269         arg_conv.is_owned = false;
54270         int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
54271         return ret_conv;
54272 }
54273
54274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54275         LDKChannelAnnouncement orig_conv;
54276         orig_conv.inner = untag_ptr(orig);
54277         orig_conv.is_owned = ptr_is_owned(orig);
54278         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54279         orig_conv.is_owned = false;
54280         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
54281         int64_t ret_ref = 0;
54282         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54283         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54284         return ret_ref;
54285 }
54286
54287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1hash(JNIEnv *env, jclass clz, int64_t o) {
54288         LDKChannelAnnouncement o_conv;
54289         o_conv.inner = untag_ptr(o);
54290         o_conv.is_owned = ptr_is_owned(o);
54291         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54292         o_conv.is_owned = false;
54293         int64_t ret_conv = ChannelAnnouncement_hash(&o_conv);
54294         return ret_conv;
54295 }
54296
54297 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54298         LDKChannelAnnouncement a_conv;
54299         a_conv.inner = untag_ptr(a);
54300         a_conv.is_owned = ptr_is_owned(a);
54301         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54302         a_conv.is_owned = false;
54303         LDKChannelAnnouncement b_conv;
54304         b_conv.inner = untag_ptr(b);
54305         b_conv.is_owned = ptr_is_owned(b);
54306         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54307         b_conv.is_owned = false;
54308         jboolean ret_conv = ChannelAnnouncement_eq(&a_conv, &b_conv);
54309         return ret_conv;
54310 }
54311
54312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54313         LDKUnsignedChannelUpdate this_obj_conv;
54314         this_obj_conv.inner = untag_ptr(this_obj);
54315         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54317         UnsignedChannelUpdate_free(this_obj_conv);
54318 }
54319
54320 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
54321         LDKUnsignedChannelUpdate this_ptr_conv;
54322         this_ptr_conv.inner = untag_ptr(this_ptr);
54323         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54325         this_ptr_conv.is_owned = false;
54326         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
54327         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
54328         return ret_arr;
54329 }
54330
54331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
54332         LDKUnsignedChannelUpdate this_ptr_conv;
54333         this_ptr_conv.inner = untag_ptr(this_ptr);
54334         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54336         this_ptr_conv.is_owned = false;
54337         LDKThirtyTwoBytes val_ref;
54338         CHECK((*env)->GetArrayLength(env, val) == 32);
54339         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
54340         UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
54341 }
54342
54343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
54344         LDKUnsignedChannelUpdate this_ptr_conv;
54345         this_ptr_conv.inner = untag_ptr(this_ptr);
54346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54348         this_ptr_conv.is_owned = false;
54349         int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
54350         return ret_conv;
54351 }
54352
54353 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
54354         LDKUnsignedChannelUpdate this_ptr_conv;
54355         this_ptr_conv.inner = untag_ptr(this_ptr);
54356         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54358         this_ptr_conv.is_owned = false;
54359         UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
54360 }
54361
54362 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
54363         LDKUnsignedChannelUpdate this_ptr_conv;
54364         this_ptr_conv.inner = untag_ptr(this_ptr);
54365         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54367         this_ptr_conv.is_owned = false;
54368         int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
54369         return ret_conv;
54370 }
54371
54372 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
54373         LDKUnsignedChannelUpdate this_ptr_conv;
54374         this_ptr_conv.inner = untag_ptr(this_ptr);
54375         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54377         this_ptr_conv.is_owned = false;
54378         UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
54379 }
54380
54381 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
54382         LDKUnsignedChannelUpdate this_ptr_conv;
54383         this_ptr_conv.inner = untag_ptr(this_ptr);
54384         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54386         this_ptr_conv.is_owned = false;
54387         int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
54388         return ret_conv;
54389 }
54390
54391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
54392         LDKUnsignedChannelUpdate this_ptr_conv;
54393         this_ptr_conv.inner = untag_ptr(this_ptr);
54394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54396         this_ptr_conv.is_owned = false;
54397         UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
54398 }
54399
54400 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
54401         LDKUnsignedChannelUpdate this_ptr_conv;
54402         this_ptr_conv.inner = untag_ptr(this_ptr);
54403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54405         this_ptr_conv.is_owned = false;
54406         int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
54407         return ret_conv;
54408 }
54409
54410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
54411         LDKUnsignedChannelUpdate this_ptr_conv;
54412         this_ptr_conv.inner = untag_ptr(this_ptr);
54413         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54415         this_ptr_conv.is_owned = false;
54416         UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
54417 }
54418
54419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
54420         LDKUnsignedChannelUpdate this_ptr_conv;
54421         this_ptr_conv.inner = untag_ptr(this_ptr);
54422         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54424         this_ptr_conv.is_owned = false;
54425         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
54426         return ret_conv;
54427 }
54428
54429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
54430         LDKUnsignedChannelUpdate this_ptr_conv;
54431         this_ptr_conv.inner = untag_ptr(this_ptr);
54432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54434         this_ptr_conv.is_owned = false;
54435         UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
54436 }
54437
54438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
54439         LDKUnsignedChannelUpdate this_ptr_conv;
54440         this_ptr_conv.inner = untag_ptr(this_ptr);
54441         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54443         this_ptr_conv.is_owned = false;
54444         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
54445         return ret_conv;
54446 }
54447
54448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
54449         LDKUnsignedChannelUpdate this_ptr_conv;
54450         this_ptr_conv.inner = untag_ptr(this_ptr);
54451         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54453         this_ptr_conv.is_owned = false;
54454         UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
54455 }
54456
54457 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
54458         LDKUnsignedChannelUpdate this_ptr_conv;
54459         this_ptr_conv.inner = untag_ptr(this_ptr);
54460         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54462         this_ptr_conv.is_owned = false;
54463         int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
54464         return ret_conv;
54465 }
54466
54467 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
54468         LDKUnsignedChannelUpdate 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         UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
54474 }
54475
54476 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
54477         LDKUnsignedChannelUpdate this_ptr_conv;
54478         this_ptr_conv.inner = untag_ptr(this_ptr);
54479         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54481         this_ptr_conv.is_owned = false;
54482         int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
54483         return ret_conv;
54484 }
54485
54486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
54487         LDKUnsignedChannelUpdate this_ptr_conv;
54488         this_ptr_conv.inner = untag_ptr(this_ptr);
54489         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54491         this_ptr_conv.is_owned = false;
54492         UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
54493 }
54494
54495 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
54496         LDKUnsignedChannelUpdate this_ptr_conv;
54497         this_ptr_conv.inner = untag_ptr(this_ptr);
54498         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54500         this_ptr_conv.is_owned = false;
54501         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_conv);
54502         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
54503         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
54504         CVec_u8Z_free(ret_var);
54505         return ret_arr;
54506 }
54507
54508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
54509         LDKUnsignedChannelUpdate this_ptr_conv;
54510         this_ptr_conv.inner = untag_ptr(this_ptr);
54511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54513         this_ptr_conv.is_owned = false;
54514         LDKCVec_u8Z val_ref;
54515         val_ref.datalen = (*env)->GetArrayLength(env, val);
54516         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
54517         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
54518         UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
54519 }
54520
54521 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) {
54522         LDKThirtyTwoBytes chain_hash_arg_ref;
54523         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
54524         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
54525         LDKCVec_u8Z excess_data_arg_ref;
54526         excess_data_arg_ref.datalen = (*env)->GetArrayLength(env, excess_data_arg);
54527         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
54528         (*env)->GetByteArrayRegion(env, excess_data_arg, 0, excess_data_arg_ref.datalen, excess_data_arg_ref.data);
54529         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);
54530         int64_t ret_ref = 0;
54531         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54532         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54533         return ret_ref;
54534 }
54535
54536 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
54537         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
54538         int64_t ret_ref = 0;
54539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54541         return ret_ref;
54542 }
54543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54544         LDKUnsignedChannelUpdate arg_conv;
54545         arg_conv.inner = untag_ptr(arg);
54546         arg_conv.is_owned = ptr_is_owned(arg);
54547         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54548         arg_conv.is_owned = false;
54549         int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
54550         return ret_conv;
54551 }
54552
54553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54554         LDKUnsignedChannelUpdate orig_conv;
54555         orig_conv.inner = untag_ptr(orig);
54556         orig_conv.is_owned = ptr_is_owned(orig);
54557         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54558         orig_conv.is_owned = false;
54559         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
54560         int64_t ret_ref = 0;
54561         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54562         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54563         return ret_ref;
54564 }
54565
54566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1hash(JNIEnv *env, jclass clz, int64_t o) {
54567         LDKUnsignedChannelUpdate o_conv;
54568         o_conv.inner = untag_ptr(o);
54569         o_conv.is_owned = ptr_is_owned(o);
54570         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54571         o_conv.is_owned = false;
54572         int64_t ret_conv = UnsignedChannelUpdate_hash(&o_conv);
54573         return ret_conv;
54574 }
54575
54576 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54577         LDKUnsignedChannelUpdate a_conv;
54578         a_conv.inner = untag_ptr(a);
54579         a_conv.is_owned = ptr_is_owned(a);
54580         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54581         a_conv.is_owned = false;
54582         LDKUnsignedChannelUpdate b_conv;
54583         b_conv.inner = untag_ptr(b);
54584         b_conv.is_owned = ptr_is_owned(b);
54585         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54586         b_conv.is_owned = false;
54587         jboolean ret_conv = UnsignedChannelUpdate_eq(&a_conv, &b_conv);
54588         return ret_conv;
54589 }
54590
54591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54592         LDKChannelUpdate this_obj_conv;
54593         this_obj_conv.inner = untag_ptr(this_obj);
54594         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54596         ChannelUpdate_free(this_obj_conv);
54597 }
54598
54599 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
54600         LDKChannelUpdate this_ptr_conv;
54601         this_ptr_conv.inner = untag_ptr(this_ptr);
54602         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54604         this_ptr_conv.is_owned = false;
54605         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
54606         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
54607         return ret_arr;
54608 }
54609
54610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
54611         LDKChannelUpdate this_ptr_conv;
54612         this_ptr_conv.inner = untag_ptr(this_ptr);
54613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54615         this_ptr_conv.is_owned = false;
54616         LDKECDSASignature val_ref;
54617         CHECK((*env)->GetArrayLength(env, val) == 64);
54618         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
54619         ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
54620 }
54621
54622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
54623         LDKChannelUpdate this_ptr_conv;
54624         this_ptr_conv.inner = untag_ptr(this_ptr);
54625         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54627         this_ptr_conv.is_owned = false;
54628         LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
54629         int64_t ret_ref = 0;
54630         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54631         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54632         return ret_ref;
54633 }
54634
54635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
54636         LDKChannelUpdate this_ptr_conv;
54637         this_ptr_conv.inner = untag_ptr(this_ptr);
54638         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54640         this_ptr_conv.is_owned = false;
54641         LDKUnsignedChannelUpdate val_conv;
54642         val_conv.inner = untag_ptr(val);
54643         val_conv.is_owned = ptr_is_owned(val);
54644         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54645         val_conv = UnsignedChannelUpdate_clone(&val_conv);
54646         ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
54647 }
54648
54649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
54650         LDKECDSASignature signature_arg_ref;
54651         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
54652         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
54653         LDKUnsignedChannelUpdate contents_arg_conv;
54654         contents_arg_conv.inner = untag_ptr(contents_arg);
54655         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
54656         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
54657         contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
54658         LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
54659         int64_t ret_ref = 0;
54660         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54661         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54662         return ret_ref;
54663 }
54664
54665 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
54666         LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
54667         int64_t ret_ref = 0;
54668         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54669         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54670         return ret_ref;
54671 }
54672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54673         LDKChannelUpdate arg_conv;
54674         arg_conv.inner = untag_ptr(arg);
54675         arg_conv.is_owned = ptr_is_owned(arg);
54676         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54677         arg_conv.is_owned = false;
54678         int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
54679         return ret_conv;
54680 }
54681
54682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54683         LDKChannelUpdate orig_conv;
54684         orig_conv.inner = untag_ptr(orig);
54685         orig_conv.is_owned = ptr_is_owned(orig);
54686         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54687         orig_conv.is_owned = false;
54688         LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
54689         int64_t ret_ref = 0;
54690         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54691         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54692         return ret_ref;
54693 }
54694
54695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1hash(JNIEnv *env, jclass clz, int64_t o) {
54696         LDKChannelUpdate o_conv;
54697         o_conv.inner = untag_ptr(o);
54698         o_conv.is_owned = ptr_is_owned(o);
54699         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54700         o_conv.is_owned = false;
54701         int64_t ret_conv = ChannelUpdate_hash(&o_conv);
54702         return ret_conv;
54703 }
54704
54705 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54706         LDKChannelUpdate a_conv;
54707         a_conv.inner = untag_ptr(a);
54708         a_conv.is_owned = ptr_is_owned(a);
54709         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54710         a_conv.is_owned = false;
54711         LDKChannelUpdate b_conv;
54712         b_conv.inner = untag_ptr(b);
54713         b_conv.is_owned = ptr_is_owned(b);
54714         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54715         b_conv.is_owned = false;
54716         jboolean ret_conv = ChannelUpdate_eq(&a_conv, &b_conv);
54717         return ret_conv;
54718 }
54719
54720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54721         LDKQueryChannelRange this_obj_conv;
54722         this_obj_conv.inner = untag_ptr(this_obj);
54723         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54725         QueryChannelRange_free(this_obj_conv);
54726 }
54727
54728 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
54729         LDKQueryChannelRange this_ptr_conv;
54730         this_ptr_conv.inner = untag_ptr(this_ptr);
54731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54733         this_ptr_conv.is_owned = false;
54734         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
54735         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
54736         return ret_arr;
54737 }
54738
54739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
54740         LDKQueryChannelRange this_ptr_conv;
54741         this_ptr_conv.inner = untag_ptr(this_ptr);
54742         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54744         this_ptr_conv.is_owned = false;
54745         LDKThirtyTwoBytes val_ref;
54746         CHECK((*env)->GetArrayLength(env, val) == 32);
54747         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
54748         QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
54749 }
54750
54751 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
54752         LDKQueryChannelRange this_ptr_conv;
54753         this_ptr_conv.inner = untag_ptr(this_ptr);
54754         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54756         this_ptr_conv.is_owned = false;
54757         int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
54758         return ret_conv;
54759 }
54760
54761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
54762         LDKQueryChannelRange this_ptr_conv;
54763         this_ptr_conv.inner = untag_ptr(this_ptr);
54764         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54766         this_ptr_conv.is_owned = false;
54767         QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
54768 }
54769
54770 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
54771         LDKQueryChannelRange this_ptr_conv;
54772         this_ptr_conv.inner = untag_ptr(this_ptr);
54773         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54775         this_ptr_conv.is_owned = false;
54776         int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
54777         return ret_conv;
54778 }
54779
54780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
54781         LDKQueryChannelRange this_ptr_conv;
54782         this_ptr_conv.inner = untag_ptr(this_ptr);
54783         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54785         this_ptr_conv.is_owned = false;
54786         QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
54787 }
54788
54789 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) {
54790         LDKThirtyTwoBytes chain_hash_arg_ref;
54791         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
54792         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
54793         LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
54794         int64_t ret_ref = 0;
54795         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54796         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54797         return ret_ref;
54798 }
54799
54800 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
54801         LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
54802         int64_t ret_ref = 0;
54803         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54804         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54805         return ret_ref;
54806 }
54807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54808         LDKQueryChannelRange arg_conv;
54809         arg_conv.inner = untag_ptr(arg);
54810         arg_conv.is_owned = ptr_is_owned(arg);
54811         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54812         arg_conv.is_owned = false;
54813         int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
54814         return ret_conv;
54815 }
54816
54817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54818         LDKQueryChannelRange orig_conv;
54819         orig_conv.inner = untag_ptr(orig);
54820         orig_conv.is_owned = ptr_is_owned(orig);
54821         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54822         orig_conv.is_owned = false;
54823         LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
54824         int64_t ret_ref = 0;
54825         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54826         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54827         return ret_ref;
54828 }
54829
54830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1hash(JNIEnv *env, jclass clz, int64_t o) {
54831         LDKQueryChannelRange o_conv;
54832         o_conv.inner = untag_ptr(o);
54833         o_conv.is_owned = ptr_is_owned(o);
54834         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54835         o_conv.is_owned = false;
54836         int64_t ret_conv = QueryChannelRange_hash(&o_conv);
54837         return ret_conv;
54838 }
54839
54840 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54841         LDKQueryChannelRange a_conv;
54842         a_conv.inner = untag_ptr(a);
54843         a_conv.is_owned = ptr_is_owned(a);
54844         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54845         a_conv.is_owned = false;
54846         LDKQueryChannelRange b_conv;
54847         b_conv.inner = untag_ptr(b);
54848         b_conv.is_owned = ptr_is_owned(b);
54849         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54850         b_conv.is_owned = false;
54851         jboolean ret_conv = QueryChannelRange_eq(&a_conv, &b_conv);
54852         return ret_conv;
54853 }
54854
54855 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54856         LDKReplyChannelRange this_obj_conv;
54857         this_obj_conv.inner = untag_ptr(this_obj);
54858         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54860         ReplyChannelRange_free(this_obj_conv);
54861 }
54862
54863 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
54864         LDKReplyChannelRange this_ptr_conv;
54865         this_ptr_conv.inner = untag_ptr(this_ptr);
54866         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54868         this_ptr_conv.is_owned = false;
54869         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
54870         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
54871         return ret_arr;
54872 }
54873
54874 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
54875         LDKReplyChannelRange this_ptr_conv;
54876         this_ptr_conv.inner = untag_ptr(this_ptr);
54877         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54879         this_ptr_conv.is_owned = false;
54880         LDKThirtyTwoBytes val_ref;
54881         CHECK((*env)->GetArrayLength(env, val) == 32);
54882         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
54883         ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
54884 }
54885
54886 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
54887         LDKReplyChannelRange this_ptr_conv;
54888         this_ptr_conv.inner = untag_ptr(this_ptr);
54889         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54891         this_ptr_conv.is_owned = false;
54892         int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
54893         return ret_conv;
54894 }
54895
54896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
54897         LDKReplyChannelRange this_ptr_conv;
54898         this_ptr_conv.inner = untag_ptr(this_ptr);
54899         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54901         this_ptr_conv.is_owned = false;
54902         ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
54903 }
54904
54905 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
54906         LDKReplyChannelRange this_ptr_conv;
54907         this_ptr_conv.inner = untag_ptr(this_ptr);
54908         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54910         this_ptr_conv.is_owned = false;
54911         int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
54912         return ret_conv;
54913 }
54914
54915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
54916         LDKReplyChannelRange this_ptr_conv;
54917         this_ptr_conv.inner = untag_ptr(this_ptr);
54918         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54920         this_ptr_conv.is_owned = false;
54921         ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
54922 }
54923
54924 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr) {
54925         LDKReplyChannelRange this_ptr_conv;
54926         this_ptr_conv.inner = untag_ptr(this_ptr);
54927         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54929         this_ptr_conv.is_owned = false;
54930         jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
54931         return ret_conv;
54932 }
54933
54934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
54935         LDKReplyChannelRange this_ptr_conv;
54936         this_ptr_conv.inner = untag_ptr(this_ptr);
54937         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54939         this_ptr_conv.is_owned = false;
54940         ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
54941 }
54942
54943 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr) {
54944         LDKReplyChannelRange this_ptr_conv;
54945         this_ptr_conv.inner = untag_ptr(this_ptr);
54946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54948         this_ptr_conv.is_owned = false;
54949         LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
54950         int64_tArray ret_arr = NULL;
54951         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
54952         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
54953         for (size_t g = 0; g < ret_var.datalen; g++) {
54954                 int64_t ret_conv_6_conv = ret_var.data[g];
54955                 ret_arr_ptr[g] = ret_conv_6_conv;
54956         }
54957         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
54958         FREE(ret_var.data);
54959         return ret_arr;
54960 }
54961
54962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
54963         LDKReplyChannelRange this_ptr_conv;
54964         this_ptr_conv.inner = untag_ptr(this_ptr);
54965         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54967         this_ptr_conv.is_owned = false;
54968         LDKCVec_u64Z val_constr;
54969         val_constr.datalen = (*env)->GetArrayLength(env, val);
54970         if (val_constr.datalen > 0)
54971                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
54972         else
54973                 val_constr.data = NULL;
54974         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
54975         for (size_t g = 0; g < val_constr.datalen; g++) {
54976                 int64_t val_conv_6 = val_vals[g];
54977                 val_constr.data[g] = val_conv_6;
54978         }
54979         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
54980         ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
54981 }
54982
54983 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) {
54984         LDKThirtyTwoBytes chain_hash_arg_ref;
54985         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
54986         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
54987         LDKCVec_u64Z short_channel_ids_arg_constr;
54988         short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
54989         if (short_channel_ids_arg_constr.datalen > 0)
54990                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
54991         else
54992                 short_channel_ids_arg_constr.data = NULL;
54993         int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
54994         for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
54995                 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
54996                 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
54997         }
54998         (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
54999         LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
55000         int64_t ret_ref = 0;
55001         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55002         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55003         return ret_ref;
55004 }
55005
55006 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
55007         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
55008         int64_t ret_ref = 0;
55009         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55010         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55011         return ret_ref;
55012 }
55013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55014         LDKReplyChannelRange arg_conv;
55015         arg_conv.inner = untag_ptr(arg);
55016         arg_conv.is_owned = ptr_is_owned(arg);
55017         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55018         arg_conv.is_owned = false;
55019         int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
55020         return ret_conv;
55021 }
55022
55023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55024         LDKReplyChannelRange orig_conv;
55025         orig_conv.inner = untag_ptr(orig);
55026         orig_conv.is_owned = ptr_is_owned(orig);
55027         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55028         orig_conv.is_owned = false;
55029         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
55030         int64_t ret_ref = 0;
55031         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55032         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55033         return ret_ref;
55034 }
55035
55036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1hash(JNIEnv *env, jclass clz, int64_t o) {
55037         LDKReplyChannelRange o_conv;
55038         o_conv.inner = untag_ptr(o);
55039         o_conv.is_owned = ptr_is_owned(o);
55040         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55041         o_conv.is_owned = false;
55042         int64_t ret_conv = ReplyChannelRange_hash(&o_conv);
55043         return ret_conv;
55044 }
55045
55046 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55047         LDKReplyChannelRange a_conv;
55048         a_conv.inner = untag_ptr(a);
55049         a_conv.is_owned = ptr_is_owned(a);
55050         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55051         a_conv.is_owned = false;
55052         LDKReplyChannelRange b_conv;
55053         b_conv.inner = untag_ptr(b);
55054         b_conv.is_owned = ptr_is_owned(b);
55055         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55056         b_conv.is_owned = false;
55057         jboolean ret_conv = ReplyChannelRange_eq(&a_conv, &b_conv);
55058         return ret_conv;
55059 }
55060
55061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55062         LDKQueryShortChannelIds this_obj_conv;
55063         this_obj_conv.inner = untag_ptr(this_obj);
55064         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55066         QueryShortChannelIds_free(this_obj_conv);
55067 }
55068
55069 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
55070         LDKQueryShortChannelIds this_ptr_conv;
55071         this_ptr_conv.inner = untag_ptr(this_ptr);
55072         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55074         this_ptr_conv.is_owned = false;
55075         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
55076         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
55077         return ret_arr;
55078 }
55079
55080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
55081         LDKQueryShortChannelIds this_ptr_conv;
55082         this_ptr_conv.inner = untag_ptr(this_ptr);
55083         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55085         this_ptr_conv.is_owned = false;
55086         LDKThirtyTwoBytes val_ref;
55087         CHECK((*env)->GetArrayLength(env, val) == 32);
55088         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
55089         QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
55090 }
55091
55092 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr) {
55093         LDKQueryShortChannelIds this_ptr_conv;
55094         this_ptr_conv.inner = untag_ptr(this_ptr);
55095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55097         this_ptr_conv.is_owned = false;
55098         LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
55099         int64_tArray ret_arr = NULL;
55100         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
55101         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
55102         for (size_t g = 0; g < ret_var.datalen; g++) {
55103                 int64_t ret_conv_6_conv = ret_var.data[g];
55104                 ret_arr_ptr[g] = ret_conv_6_conv;
55105         }
55106         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
55107         FREE(ret_var.data);
55108         return ret_arr;
55109 }
55110
55111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
55112         LDKQueryShortChannelIds this_ptr_conv;
55113         this_ptr_conv.inner = untag_ptr(this_ptr);
55114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55116         this_ptr_conv.is_owned = false;
55117         LDKCVec_u64Z val_constr;
55118         val_constr.datalen = (*env)->GetArrayLength(env, val);
55119         if (val_constr.datalen > 0)
55120                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
55121         else
55122                 val_constr.data = NULL;
55123         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
55124         for (size_t g = 0; g < val_constr.datalen; g++) {
55125                 int64_t val_conv_6 = val_vals[g];
55126                 val_constr.data[g] = val_conv_6;
55127         }
55128         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
55129         QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
55130 }
55131
55132 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) {
55133         LDKThirtyTwoBytes chain_hash_arg_ref;
55134         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
55135         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
55136         LDKCVec_u64Z short_channel_ids_arg_constr;
55137         short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
55138         if (short_channel_ids_arg_constr.datalen > 0)
55139                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
55140         else
55141                 short_channel_ids_arg_constr.data = NULL;
55142         int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
55143         for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
55144                 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
55145                 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
55146         }
55147         (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
55148         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
55149         int64_t ret_ref = 0;
55150         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55151         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55152         return ret_ref;
55153 }
55154
55155 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
55156         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
55157         int64_t ret_ref = 0;
55158         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55159         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55160         return ret_ref;
55161 }
55162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55163         LDKQueryShortChannelIds arg_conv;
55164         arg_conv.inner = untag_ptr(arg);
55165         arg_conv.is_owned = ptr_is_owned(arg);
55166         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55167         arg_conv.is_owned = false;
55168         int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
55169         return ret_conv;
55170 }
55171
55172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55173         LDKQueryShortChannelIds orig_conv;
55174         orig_conv.inner = untag_ptr(orig);
55175         orig_conv.is_owned = ptr_is_owned(orig);
55176         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55177         orig_conv.is_owned = false;
55178         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
55179         int64_t ret_ref = 0;
55180         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55181         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55182         return ret_ref;
55183 }
55184
55185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1hash(JNIEnv *env, jclass clz, int64_t o) {
55186         LDKQueryShortChannelIds o_conv;
55187         o_conv.inner = untag_ptr(o);
55188         o_conv.is_owned = ptr_is_owned(o);
55189         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55190         o_conv.is_owned = false;
55191         int64_t ret_conv = QueryShortChannelIds_hash(&o_conv);
55192         return ret_conv;
55193 }
55194
55195 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55196         LDKQueryShortChannelIds a_conv;
55197         a_conv.inner = untag_ptr(a);
55198         a_conv.is_owned = ptr_is_owned(a);
55199         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55200         a_conv.is_owned = false;
55201         LDKQueryShortChannelIds b_conv;
55202         b_conv.inner = untag_ptr(b);
55203         b_conv.is_owned = ptr_is_owned(b);
55204         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55205         b_conv.is_owned = false;
55206         jboolean ret_conv = QueryShortChannelIds_eq(&a_conv, &b_conv);
55207         return ret_conv;
55208 }
55209
55210 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55211         LDKReplyShortChannelIdsEnd this_obj_conv;
55212         this_obj_conv.inner = untag_ptr(this_obj);
55213         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55215         ReplyShortChannelIdsEnd_free(this_obj_conv);
55216 }
55217
55218 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
55219         LDKReplyShortChannelIdsEnd this_ptr_conv;
55220         this_ptr_conv.inner = untag_ptr(this_ptr);
55221         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55223         this_ptr_conv.is_owned = false;
55224         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
55225         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
55226         return ret_arr;
55227 }
55228
55229 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
55230         LDKReplyShortChannelIdsEnd this_ptr_conv;
55231         this_ptr_conv.inner = untag_ptr(this_ptr);
55232         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55234         this_ptr_conv.is_owned = false;
55235         LDKThirtyTwoBytes val_ref;
55236         CHECK((*env)->GetArrayLength(env, val) == 32);
55237         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
55238         ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
55239 }
55240
55241 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
55242         LDKReplyShortChannelIdsEnd 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         jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
55248         return ret_conv;
55249 }
55250
55251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
55252         LDKReplyShortChannelIdsEnd 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         ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
55258 }
55259
55260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
55261         LDKThirtyTwoBytes chain_hash_arg_ref;
55262         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
55263         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
55264         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
55265         int64_t ret_ref = 0;
55266         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55267         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55268         return ret_ref;
55269 }
55270
55271 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
55272         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
55273         int64_t ret_ref = 0;
55274         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55275         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55276         return ret_ref;
55277 }
55278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55279         LDKReplyShortChannelIdsEnd arg_conv;
55280         arg_conv.inner = untag_ptr(arg);
55281         arg_conv.is_owned = ptr_is_owned(arg);
55282         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55283         arg_conv.is_owned = false;
55284         int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
55285         return ret_conv;
55286 }
55287
55288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55289         LDKReplyShortChannelIdsEnd orig_conv;
55290         orig_conv.inner = untag_ptr(orig);
55291         orig_conv.is_owned = ptr_is_owned(orig);
55292         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55293         orig_conv.is_owned = false;
55294         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
55295         int64_t ret_ref = 0;
55296         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55297         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55298         return ret_ref;
55299 }
55300
55301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1hash(JNIEnv *env, jclass clz, int64_t o) {
55302         LDKReplyShortChannelIdsEnd o_conv;
55303         o_conv.inner = untag_ptr(o);
55304         o_conv.is_owned = ptr_is_owned(o);
55305         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55306         o_conv.is_owned = false;
55307         int64_t ret_conv = ReplyShortChannelIdsEnd_hash(&o_conv);
55308         return ret_conv;
55309 }
55310
55311 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55312         LDKReplyShortChannelIdsEnd a_conv;
55313         a_conv.inner = untag_ptr(a);
55314         a_conv.is_owned = ptr_is_owned(a);
55315         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55316         a_conv.is_owned = false;
55317         LDKReplyShortChannelIdsEnd b_conv;
55318         b_conv.inner = untag_ptr(b);
55319         b_conv.is_owned = ptr_is_owned(b);
55320         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55321         b_conv.is_owned = false;
55322         jboolean ret_conv = ReplyShortChannelIdsEnd_eq(&a_conv, &b_conv);
55323         return ret_conv;
55324 }
55325
55326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55327         LDKGossipTimestampFilter this_obj_conv;
55328         this_obj_conv.inner = untag_ptr(this_obj);
55329         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55331         GossipTimestampFilter_free(this_obj_conv);
55332 }
55333
55334 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
55335         LDKGossipTimestampFilter this_ptr_conv;
55336         this_ptr_conv.inner = untag_ptr(this_ptr);
55337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55339         this_ptr_conv.is_owned = false;
55340         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
55341         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
55342         return ret_arr;
55343 }
55344
55345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
55346         LDKGossipTimestampFilter this_ptr_conv;
55347         this_ptr_conv.inner = untag_ptr(this_ptr);
55348         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55350         this_ptr_conv.is_owned = false;
55351         LDKThirtyTwoBytes val_ref;
55352         CHECK((*env)->GetArrayLength(env, val) == 32);
55353         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
55354         GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
55355 }
55356
55357 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
55358         LDKGossipTimestampFilter this_ptr_conv;
55359         this_ptr_conv.inner = untag_ptr(this_ptr);
55360         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55362         this_ptr_conv.is_owned = false;
55363         int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
55364         return ret_conv;
55365 }
55366
55367 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
55368         LDKGossipTimestampFilter this_ptr_conv;
55369         this_ptr_conv.inner = untag_ptr(this_ptr);
55370         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55372         this_ptr_conv.is_owned = false;
55373         GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
55374 }
55375
55376 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
55377         LDKGossipTimestampFilter this_ptr_conv;
55378         this_ptr_conv.inner = untag_ptr(this_ptr);
55379         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55381         this_ptr_conv.is_owned = false;
55382         int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
55383         return ret_conv;
55384 }
55385
55386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
55387         LDKGossipTimestampFilter this_ptr_conv;
55388         this_ptr_conv.inner = untag_ptr(this_ptr);
55389         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55391         this_ptr_conv.is_owned = false;
55392         GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
55393 }
55394
55395 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) {
55396         LDKThirtyTwoBytes chain_hash_arg_ref;
55397         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
55398         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
55399         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
55400         int64_t ret_ref = 0;
55401         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55402         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55403         return ret_ref;
55404 }
55405
55406 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
55407         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
55408         int64_t ret_ref = 0;
55409         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55410         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55411         return ret_ref;
55412 }
55413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55414         LDKGossipTimestampFilter arg_conv;
55415         arg_conv.inner = untag_ptr(arg);
55416         arg_conv.is_owned = ptr_is_owned(arg);
55417         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55418         arg_conv.is_owned = false;
55419         int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
55420         return ret_conv;
55421 }
55422
55423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55424         LDKGossipTimestampFilter orig_conv;
55425         orig_conv.inner = untag_ptr(orig);
55426         orig_conv.is_owned = ptr_is_owned(orig);
55427         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55428         orig_conv.is_owned = false;
55429         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
55430         int64_t ret_ref = 0;
55431         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55432         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55433         return ret_ref;
55434 }
55435
55436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1hash(JNIEnv *env, jclass clz, int64_t o) {
55437         LDKGossipTimestampFilter o_conv;
55438         o_conv.inner = untag_ptr(o);
55439         o_conv.is_owned = ptr_is_owned(o);
55440         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55441         o_conv.is_owned = false;
55442         int64_t ret_conv = GossipTimestampFilter_hash(&o_conv);
55443         return ret_conv;
55444 }
55445
55446 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55447         LDKGossipTimestampFilter a_conv;
55448         a_conv.inner = untag_ptr(a);
55449         a_conv.is_owned = ptr_is_owned(a);
55450         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55451         a_conv.is_owned = false;
55452         LDKGossipTimestampFilter b_conv;
55453         b_conv.inner = untag_ptr(b);
55454         b_conv.is_owned = ptr_is_owned(b);
55455         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55456         b_conv.is_owned = false;
55457         jboolean ret_conv = GossipTimestampFilter_eq(&a_conv, &b_conv);
55458         return ret_conv;
55459 }
55460
55461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
55462         if (!ptr_is_owned(this_ptr)) return;
55463         void* this_ptr_ptr = untag_ptr(this_ptr);
55464         CHECK_ACCESS(this_ptr_ptr);
55465         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
55466         FREE(untag_ptr(this_ptr));
55467         ErrorAction_free(this_ptr_conv);
55468 }
55469
55470 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
55471         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
55472         *ret_copy = ErrorAction_clone(arg);
55473         int64_t ret_ref = tag_ptr(ret_copy, true);
55474         return ret_ref;
55475 }
55476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55477         LDKErrorAction* arg_conv = (LDKErrorAction*)untag_ptr(arg);
55478         int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
55479         return ret_conv;
55480 }
55481
55482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55483         LDKErrorAction* orig_conv = (LDKErrorAction*)untag_ptr(orig);
55484         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
55485         *ret_copy = ErrorAction_clone(orig_conv);
55486         int64_t ret_ref = tag_ptr(ret_copy, true);
55487         return ret_ref;
55488 }
55489
55490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1disconnect_1peer(JNIEnv *env, jclass clz, int64_t msg) {
55491         LDKErrorMessage msg_conv;
55492         msg_conv.inner = untag_ptr(msg);
55493         msg_conv.is_owned = ptr_is_owned(msg);
55494         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
55495         msg_conv = ErrorMessage_clone(&msg_conv);
55496         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
55497         *ret_copy = ErrorAction_disconnect_peer(msg_conv);
55498         int64_t ret_ref = tag_ptr(ret_copy, true);
55499         return ret_ref;
55500 }
55501
55502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1disconnect_1peer_1with_1warning(JNIEnv *env, jclass clz, int64_t msg) {
55503         LDKWarningMessage msg_conv;
55504         msg_conv.inner = untag_ptr(msg);
55505         msg_conv.is_owned = ptr_is_owned(msg);
55506         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
55507         msg_conv = WarningMessage_clone(&msg_conv);
55508         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
55509         *ret_copy = ErrorAction_disconnect_peer_with_warning(msg_conv);
55510         int64_t ret_ref = tag_ptr(ret_copy, true);
55511         return ret_ref;
55512 }
55513
55514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1error(JNIEnv *env, jclass clz) {
55515         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
55516         *ret_copy = ErrorAction_ignore_error();
55517         int64_t ret_ref = tag_ptr(ret_copy, true);
55518         return ret_ref;
55519 }
55520
55521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1and_1log(JNIEnv *env, jclass clz, jclass a) {
55522         LDKLevel a_conv = LDKLevel_from_java(env, a);
55523         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
55524         *ret_copy = ErrorAction_ignore_and_log(a_conv);
55525         int64_t ret_ref = tag_ptr(ret_copy, true);
55526         return ret_ref;
55527 }
55528
55529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1duplicate_1gossip(JNIEnv *env, jclass clz) {
55530         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
55531         *ret_copy = ErrorAction_ignore_duplicate_gossip();
55532         int64_t ret_ref = tag_ptr(ret_copy, true);
55533         return ret_ref;
55534 }
55535
55536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1error_1message(JNIEnv *env, jclass clz, int64_t msg) {
55537         LDKErrorMessage msg_conv;
55538         msg_conv.inner = untag_ptr(msg);
55539         msg_conv.is_owned = ptr_is_owned(msg);
55540         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
55541         msg_conv = ErrorMessage_clone(&msg_conv);
55542         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
55543         *ret_copy = ErrorAction_send_error_message(msg_conv);
55544         int64_t ret_ref = tag_ptr(ret_copy, true);
55545         return ret_ref;
55546 }
55547
55548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1warning_1message(JNIEnv *env, jclass clz, int64_t msg, jclass log_level) {
55549         LDKWarningMessage msg_conv;
55550         msg_conv.inner = untag_ptr(msg);
55551         msg_conv.is_owned = ptr_is_owned(msg);
55552         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
55553         msg_conv = WarningMessage_clone(&msg_conv);
55554         LDKLevel log_level_conv = LDKLevel_from_java(env, log_level);
55555         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
55556         *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
55557         int64_t ret_ref = tag_ptr(ret_copy, true);
55558         return ret_ref;
55559 }
55560
55561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1hash(JNIEnv *env, jclass clz, int64_t o) {
55562         LDKErrorAction* o_conv = (LDKErrorAction*)untag_ptr(o);
55563         int64_t ret_conv = ErrorAction_hash(o_conv);
55564         return ret_conv;
55565 }
55566
55567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55568         LDKLightningError this_obj_conv;
55569         this_obj_conv.inner = untag_ptr(this_obj);
55570         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55572         LightningError_free(this_obj_conv);
55573 }
55574
55575 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
55576         LDKLightningError this_ptr_conv;
55577         this_ptr_conv.inner = untag_ptr(this_ptr);
55578         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55580         this_ptr_conv.is_owned = false;
55581         LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
55582         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
55583         Str_free(ret_str);
55584         return ret_conv;
55585 }
55586
55587 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
55588         LDKLightningError this_ptr_conv;
55589         this_ptr_conv.inner = untag_ptr(this_ptr);
55590         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55592         this_ptr_conv.is_owned = false;
55593         LDKStr val_conv = java_to_owned_str(env, val);
55594         LightningError_set_err(&this_ptr_conv, val_conv);
55595 }
55596
55597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
55598         LDKLightningError this_ptr_conv;
55599         this_ptr_conv.inner = untag_ptr(this_ptr);
55600         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55602         this_ptr_conv.is_owned = false;
55603         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
55604         *ret_copy = LightningError_get_action(&this_ptr_conv);
55605         int64_t ret_ref = tag_ptr(ret_copy, true);
55606         return ret_ref;
55607 }
55608
55609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55610         LDKLightningError this_ptr_conv;
55611         this_ptr_conv.inner = untag_ptr(this_ptr);
55612         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55614         this_ptr_conv.is_owned = false;
55615         void* val_ptr = untag_ptr(val);
55616         CHECK_ACCESS(val_ptr);
55617         LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
55618         val_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(val));
55619         LightningError_set_action(&this_ptr_conv, val_conv);
55620 }
55621
55622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, jstring err_arg, int64_t action_arg) {
55623         LDKStr err_arg_conv = java_to_owned_str(env, err_arg);
55624         void* action_arg_ptr = untag_ptr(action_arg);
55625         CHECK_ACCESS(action_arg_ptr);
55626         LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
55627         action_arg_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action_arg));
55628         LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
55629         int64_t ret_ref = 0;
55630         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55631         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55632         return ret_ref;
55633 }
55634
55635 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
55636         LDKLightningError ret_var = LightningError_clone(arg);
55637         int64_t ret_ref = 0;
55638         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55639         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55640         return ret_ref;
55641 }
55642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55643         LDKLightningError arg_conv;
55644         arg_conv.inner = untag_ptr(arg);
55645         arg_conv.is_owned = ptr_is_owned(arg);
55646         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55647         arg_conv.is_owned = false;
55648         int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
55649         return ret_conv;
55650 }
55651
55652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55653         LDKLightningError orig_conv;
55654         orig_conv.inner = untag_ptr(orig);
55655         orig_conv.is_owned = ptr_is_owned(orig);
55656         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55657         orig_conv.is_owned = false;
55658         LDKLightningError ret_var = LightningError_clone(&orig_conv);
55659         int64_t ret_ref = 0;
55660         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55661         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55662         return ret_ref;
55663 }
55664
55665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55666         LDKCommitmentUpdate this_obj_conv;
55667         this_obj_conv.inner = untag_ptr(this_obj);
55668         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55670         CommitmentUpdate_free(this_obj_conv);
55671 }
55672
55673 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
55674         LDKCommitmentUpdate this_ptr_conv;
55675         this_ptr_conv.inner = untag_ptr(this_ptr);
55676         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55678         this_ptr_conv.is_owned = false;
55679         LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
55680         int64_tArray ret_arr = NULL;
55681         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
55682         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
55683         for (size_t p = 0; p < ret_var.datalen; p++) {
55684                 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
55685                 int64_t ret_conv_15_ref = 0;
55686                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
55687                 ret_conv_15_ref = tag_ptr(ret_conv_15_var.inner, ret_conv_15_var.is_owned);
55688                 ret_arr_ptr[p] = ret_conv_15_ref;
55689         }
55690         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
55691         FREE(ret_var.data);
55692         return ret_arr;
55693 }
55694
55695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
55696         LDKCommitmentUpdate this_ptr_conv;
55697         this_ptr_conv.inner = untag_ptr(this_ptr);
55698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55700         this_ptr_conv.is_owned = false;
55701         LDKCVec_UpdateAddHTLCZ val_constr;
55702         val_constr.datalen = (*env)->GetArrayLength(env, val);
55703         if (val_constr.datalen > 0)
55704                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
55705         else
55706                 val_constr.data = NULL;
55707         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
55708         for (size_t p = 0; p < val_constr.datalen; p++) {
55709                 int64_t val_conv_15 = val_vals[p];
55710                 LDKUpdateAddHTLC val_conv_15_conv;
55711                 val_conv_15_conv.inner = untag_ptr(val_conv_15);
55712                 val_conv_15_conv.is_owned = ptr_is_owned(val_conv_15);
55713                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
55714                 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
55715                 val_constr.data[p] = val_conv_15_conv;
55716         }
55717         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
55718         CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
55719 }
55720
55721 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
55722         LDKCommitmentUpdate this_ptr_conv;
55723         this_ptr_conv.inner = untag_ptr(this_ptr);
55724         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55726         this_ptr_conv.is_owned = false;
55727         LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
55728         int64_tArray ret_arr = NULL;
55729         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
55730         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
55731         for (size_t t = 0; t < ret_var.datalen; t++) {
55732                 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
55733                 int64_t ret_conv_19_ref = 0;
55734                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
55735                 ret_conv_19_ref = tag_ptr(ret_conv_19_var.inner, ret_conv_19_var.is_owned);
55736                 ret_arr_ptr[t] = ret_conv_19_ref;
55737         }
55738         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
55739         FREE(ret_var.data);
55740         return ret_arr;
55741 }
55742
55743 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
55744         LDKCommitmentUpdate this_ptr_conv;
55745         this_ptr_conv.inner = untag_ptr(this_ptr);
55746         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55748         this_ptr_conv.is_owned = false;
55749         LDKCVec_UpdateFulfillHTLCZ val_constr;
55750         val_constr.datalen = (*env)->GetArrayLength(env, val);
55751         if (val_constr.datalen > 0)
55752                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
55753         else
55754                 val_constr.data = NULL;
55755         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
55756         for (size_t t = 0; t < val_constr.datalen; t++) {
55757                 int64_t val_conv_19 = val_vals[t];
55758                 LDKUpdateFulfillHTLC val_conv_19_conv;
55759                 val_conv_19_conv.inner = untag_ptr(val_conv_19);
55760                 val_conv_19_conv.is_owned = ptr_is_owned(val_conv_19);
55761                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
55762                 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
55763                 val_constr.data[t] = val_conv_19_conv;
55764         }
55765         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
55766         CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
55767 }
55768
55769 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
55770         LDKCommitmentUpdate this_ptr_conv;
55771         this_ptr_conv.inner = untag_ptr(this_ptr);
55772         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55774         this_ptr_conv.is_owned = false;
55775         LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
55776         int64_tArray ret_arr = NULL;
55777         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
55778         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
55779         for (size_t q = 0; q < ret_var.datalen; q++) {
55780                 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
55781                 int64_t ret_conv_16_ref = 0;
55782                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
55783                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
55784                 ret_arr_ptr[q] = ret_conv_16_ref;
55785         }
55786         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
55787         FREE(ret_var.data);
55788         return ret_arr;
55789 }
55790
55791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
55792         LDKCommitmentUpdate this_ptr_conv;
55793         this_ptr_conv.inner = untag_ptr(this_ptr);
55794         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55796         this_ptr_conv.is_owned = false;
55797         LDKCVec_UpdateFailHTLCZ val_constr;
55798         val_constr.datalen = (*env)->GetArrayLength(env, val);
55799         if (val_constr.datalen > 0)
55800                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
55801         else
55802                 val_constr.data = NULL;
55803         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
55804         for (size_t q = 0; q < val_constr.datalen; q++) {
55805                 int64_t val_conv_16 = val_vals[q];
55806                 LDKUpdateFailHTLC val_conv_16_conv;
55807                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
55808                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
55809                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
55810                 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
55811                 val_constr.data[q] = val_conv_16_conv;
55812         }
55813         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
55814         CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
55815 }
55816
55817 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1malformed_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
55818         LDKCommitmentUpdate this_ptr_conv;
55819         this_ptr_conv.inner = untag_ptr(this_ptr);
55820         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55822         this_ptr_conv.is_owned = false;
55823         LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
55824         int64_tArray ret_arr = NULL;
55825         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
55826         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
55827         for (size_t z = 0; z < ret_var.datalen; z++) {
55828                 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
55829                 int64_t ret_conv_25_ref = 0;
55830                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
55831                 ret_conv_25_ref = tag_ptr(ret_conv_25_var.inner, ret_conv_25_var.is_owned);
55832                 ret_arr_ptr[z] = ret_conv_25_ref;
55833         }
55834         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
55835         FREE(ret_var.data);
55836         return ret_arr;
55837 }
55838
55839 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) {
55840         LDKCommitmentUpdate 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         LDKCVec_UpdateFailMalformedHTLCZ val_constr;
55846         val_constr.datalen = (*env)->GetArrayLength(env, val);
55847         if (val_constr.datalen > 0)
55848                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
55849         else
55850                 val_constr.data = NULL;
55851         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
55852         for (size_t z = 0; z < val_constr.datalen; z++) {
55853                 int64_t val_conv_25 = val_vals[z];
55854                 LDKUpdateFailMalformedHTLC val_conv_25_conv;
55855                 val_conv_25_conv.inner = untag_ptr(val_conv_25);
55856                 val_conv_25_conv.is_owned = ptr_is_owned(val_conv_25);
55857                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
55858                 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
55859                 val_constr.data[z] = val_conv_25_conv;
55860         }
55861         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
55862         CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
55863 }
55864
55865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
55866         LDKCommitmentUpdate this_ptr_conv;
55867         this_ptr_conv.inner = untag_ptr(this_ptr);
55868         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55870         this_ptr_conv.is_owned = false;
55871         LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
55872         int64_t ret_ref = 0;
55873         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55874         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55875         return ret_ref;
55876 }
55877
55878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55879         LDKCommitmentUpdate this_ptr_conv;
55880         this_ptr_conv.inner = untag_ptr(this_ptr);
55881         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55883         this_ptr_conv.is_owned = false;
55884         LDKUpdateFee val_conv;
55885         val_conv.inner = untag_ptr(val);
55886         val_conv.is_owned = ptr_is_owned(val);
55887         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
55888         val_conv = UpdateFee_clone(&val_conv);
55889         CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
55890 }
55891
55892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
55893         LDKCommitmentUpdate this_ptr_conv;
55894         this_ptr_conv.inner = untag_ptr(this_ptr);
55895         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55897         this_ptr_conv.is_owned = false;
55898         LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
55899         int64_t ret_ref = 0;
55900         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55901         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55902         return ret_ref;
55903 }
55904
55905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55906         LDKCommitmentUpdate this_ptr_conv;
55907         this_ptr_conv.inner = untag_ptr(this_ptr);
55908         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55910         this_ptr_conv.is_owned = false;
55911         LDKCommitmentSigned val_conv;
55912         val_conv.inner = untag_ptr(val);
55913         val_conv.is_owned = ptr_is_owned(val);
55914         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
55915         val_conv = CommitmentSigned_clone(&val_conv);
55916         CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
55917 }
55918
55919 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) {
55920         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
55921         update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
55922         if (update_add_htlcs_arg_constr.datalen > 0)
55923                 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
55924         else
55925                 update_add_htlcs_arg_constr.data = NULL;
55926         int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
55927         for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
55928                 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
55929                 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
55930                 update_add_htlcs_arg_conv_15_conv.inner = untag_ptr(update_add_htlcs_arg_conv_15);
55931                 update_add_htlcs_arg_conv_15_conv.is_owned = ptr_is_owned(update_add_htlcs_arg_conv_15);
55932                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
55933                 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
55934                 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
55935         }
55936         (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
55937         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
55938         update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
55939         if (update_fulfill_htlcs_arg_constr.datalen > 0)
55940                 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
55941         else
55942                 update_fulfill_htlcs_arg_constr.data = NULL;
55943         int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
55944         for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
55945                 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
55946                 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
55947                 update_fulfill_htlcs_arg_conv_19_conv.inner = untag_ptr(update_fulfill_htlcs_arg_conv_19);
55948                 update_fulfill_htlcs_arg_conv_19_conv.is_owned = ptr_is_owned(update_fulfill_htlcs_arg_conv_19);
55949                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
55950                 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
55951                 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
55952         }
55953         (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
55954         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
55955         update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
55956         if (update_fail_htlcs_arg_constr.datalen > 0)
55957                 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
55958         else
55959                 update_fail_htlcs_arg_constr.data = NULL;
55960         int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
55961         for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
55962                 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
55963                 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
55964                 update_fail_htlcs_arg_conv_16_conv.inner = untag_ptr(update_fail_htlcs_arg_conv_16);
55965                 update_fail_htlcs_arg_conv_16_conv.is_owned = ptr_is_owned(update_fail_htlcs_arg_conv_16);
55966                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
55967                 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
55968                 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
55969         }
55970         (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
55971         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
55972         update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
55973         if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
55974                 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
55975         else
55976                 update_fail_malformed_htlcs_arg_constr.data = NULL;
55977         int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
55978         for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
55979                 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
55980                 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
55981                 update_fail_malformed_htlcs_arg_conv_25_conv.inner = untag_ptr(update_fail_malformed_htlcs_arg_conv_25);
55982                 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = ptr_is_owned(update_fail_malformed_htlcs_arg_conv_25);
55983                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
55984                 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
55985                 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
55986         }
55987         (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
55988         LDKUpdateFee update_fee_arg_conv;
55989         update_fee_arg_conv.inner = untag_ptr(update_fee_arg);
55990         update_fee_arg_conv.is_owned = ptr_is_owned(update_fee_arg);
55991         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
55992         update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
55993         LDKCommitmentSigned commitment_signed_arg_conv;
55994         commitment_signed_arg_conv.inner = untag_ptr(commitment_signed_arg);
55995         commitment_signed_arg_conv.is_owned = ptr_is_owned(commitment_signed_arg);
55996         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
55997         commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
55998         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);
55999         int64_t ret_ref = 0;
56000         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56001         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56002         return ret_ref;
56003 }
56004
56005 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
56006         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
56007         int64_t ret_ref = 0;
56008         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56009         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56010         return ret_ref;
56011 }
56012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
56013         LDKCommitmentUpdate arg_conv;
56014         arg_conv.inner = untag_ptr(arg);
56015         arg_conv.is_owned = ptr_is_owned(arg);
56016         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56017         arg_conv.is_owned = false;
56018         int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
56019         return ret_conv;
56020 }
56021
56022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56023         LDKCommitmentUpdate orig_conv;
56024         orig_conv.inner = untag_ptr(orig);
56025         orig_conv.is_owned = ptr_is_owned(orig);
56026         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56027         orig_conv.is_owned = false;
56028         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
56029         int64_t ret_ref = 0;
56030         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56031         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56032         return ret_ref;
56033 }
56034
56035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1hash(JNIEnv *env, jclass clz, int64_t o) {
56036         LDKCommitmentUpdate o_conv;
56037         o_conv.inner = untag_ptr(o);
56038         o_conv.is_owned = ptr_is_owned(o);
56039         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
56040         o_conv.is_owned = false;
56041         int64_t ret_conv = CommitmentUpdate_hash(&o_conv);
56042         return ret_conv;
56043 }
56044
56045 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
56046         LDKCommitmentUpdate a_conv;
56047         a_conv.inner = untag_ptr(a);
56048         a_conv.is_owned = ptr_is_owned(a);
56049         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
56050         a_conv.is_owned = false;
56051         LDKCommitmentUpdate b_conv;
56052         b_conv.inner = untag_ptr(b);
56053         b_conv.is_owned = ptr_is_owned(b);
56054         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
56055         b_conv.is_owned = false;
56056         jboolean ret_conv = CommitmentUpdate_eq(&a_conv, &b_conv);
56057         return ret_conv;
56058 }
56059
56060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
56061         if (!ptr_is_owned(this_ptr)) return;
56062         void* this_ptr_ptr = untag_ptr(this_ptr);
56063         CHECK_ACCESS(this_ptr_ptr);
56064         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
56065         FREE(untag_ptr(this_ptr));
56066         ChannelMessageHandler_free(this_ptr_conv);
56067 }
56068
56069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
56070         if (!ptr_is_owned(this_ptr)) return;
56071         void* this_ptr_ptr = untag_ptr(this_ptr);
56072         CHECK_ACCESS(this_ptr_ptr);
56073         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
56074         FREE(untag_ptr(this_ptr));
56075         RoutingMessageHandler_free(this_ptr_conv);
56076 }
56077
56078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
56079         if (!ptr_is_owned(this_ptr)) return;
56080         void* this_ptr_ptr = untag_ptr(this_ptr);
56081         CHECK_ACCESS(this_ptr_ptr);
56082         LDKOnionMessageHandler this_ptr_conv = *(LDKOnionMessageHandler*)(this_ptr_ptr);
56083         FREE(untag_ptr(this_ptr));
56084         OnionMessageHandler_free(this_ptr_conv);
56085 }
56086
56087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
56088         LDKFinalOnionHopData this_obj_conv;
56089         this_obj_conv.inner = untag_ptr(this_obj);
56090         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56092         FinalOnionHopData_free(this_obj_conv);
56093 }
56094
56095 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1get_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
56096         LDKFinalOnionHopData this_ptr_conv;
56097         this_ptr_conv.inner = untag_ptr(this_ptr);
56098         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56100         this_ptr_conv.is_owned = false;
56101         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
56102         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FinalOnionHopData_get_payment_secret(&this_ptr_conv));
56103         return ret_arr;
56104 }
56105
56106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1set_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
56107         LDKFinalOnionHopData this_ptr_conv;
56108         this_ptr_conv.inner = untag_ptr(this_ptr);
56109         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56111         this_ptr_conv.is_owned = false;
56112         LDKThirtyTwoBytes val_ref;
56113         CHECK((*env)->GetArrayLength(env, val) == 32);
56114         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
56115         FinalOnionHopData_set_payment_secret(&this_ptr_conv, val_ref);
56116 }
56117
56118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1get_1total_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
56119         LDKFinalOnionHopData this_ptr_conv;
56120         this_ptr_conv.inner = untag_ptr(this_ptr);
56121         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56123         this_ptr_conv.is_owned = false;
56124         int64_t ret_conv = FinalOnionHopData_get_total_msat(&this_ptr_conv);
56125         return ret_conv;
56126 }
56127
56128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1set_1total_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
56129         LDKFinalOnionHopData this_ptr_conv;
56130         this_ptr_conv.inner = untag_ptr(this_ptr);
56131         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56133         this_ptr_conv.is_owned = false;
56134         FinalOnionHopData_set_total_msat(&this_ptr_conv, val);
56135 }
56136
56137 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) {
56138         LDKThirtyTwoBytes payment_secret_arg_ref;
56139         CHECK((*env)->GetArrayLength(env, payment_secret_arg) == 32);
56140         (*env)->GetByteArrayRegion(env, payment_secret_arg, 0, 32, payment_secret_arg_ref.data);
56141         LDKFinalOnionHopData ret_var = FinalOnionHopData_new(payment_secret_arg_ref, total_msat_arg);
56142         int64_t ret_ref = 0;
56143         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56144         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56145         return ret_ref;
56146 }
56147
56148 static inline uint64_t FinalOnionHopData_clone_ptr(LDKFinalOnionHopData *NONNULL_PTR arg) {
56149         LDKFinalOnionHopData ret_var = FinalOnionHopData_clone(arg);
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 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
56156         LDKFinalOnionHopData arg_conv;
56157         arg_conv.inner = untag_ptr(arg);
56158         arg_conv.is_owned = ptr_is_owned(arg);
56159         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56160         arg_conv.is_owned = false;
56161         int64_t ret_conv = FinalOnionHopData_clone_ptr(&arg_conv);
56162         return ret_conv;
56163 }
56164
56165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56166         LDKFinalOnionHopData orig_conv;
56167         orig_conv.inner = untag_ptr(orig);
56168         orig_conv.is_owned = ptr_is_owned(orig);
56169         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56170         orig_conv.is_owned = false;
56171         LDKFinalOnionHopData ret_var = FinalOnionHopData_clone(&orig_conv);
56172         int64_t ret_ref = 0;
56173         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56174         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56175         return ret_ref;
56176 }
56177
56178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionPacket_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
56179         LDKOnionPacket this_obj_conv;
56180         this_obj_conv.inner = untag_ptr(this_obj);
56181         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56183         OnionPacket_free(this_obj_conv);
56184 }
56185
56186 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OnionPacket_1get_1version(JNIEnv *env, jclass clz, int64_t this_ptr) {
56187         LDKOnionPacket this_ptr_conv;
56188         this_ptr_conv.inner = untag_ptr(this_ptr);
56189         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56191         this_ptr_conv.is_owned = false;
56192         int8_t ret_conv = OnionPacket_get_version(&this_ptr_conv);
56193         return ret_conv;
56194 }
56195
56196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionPacket_1set_1version(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
56197         LDKOnionPacket this_ptr_conv;
56198         this_ptr_conv.inner = untag_ptr(this_ptr);
56199         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56201         this_ptr_conv.is_owned = false;
56202         OnionPacket_set_version(&this_ptr_conv, val);
56203 }
56204
56205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionPacket_1get_1public_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
56206         LDKOnionPacket this_ptr_conv;
56207         this_ptr_conv.inner = untag_ptr(this_ptr);
56208         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56210         this_ptr_conv.is_owned = false;
56211         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
56212         *ret_conv = OnionPacket_get_public_key(&this_ptr_conv);
56213         return tag_ptr(ret_conv, true);
56214 }
56215
56216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionPacket_1set_1public_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
56217         LDKOnionPacket 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         void* val_ptr = untag_ptr(val);
56223         CHECK_ACCESS(val_ptr);
56224         LDKCResult_PublicKeySecp256k1ErrorZ val_conv = *(LDKCResult_PublicKeySecp256k1ErrorZ*)(val_ptr);
56225         val_conv = CResult_PublicKeySecp256k1ErrorZ_clone((LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(val));
56226         OnionPacket_set_public_key(&this_ptr_conv, val_conv);
56227 }
56228
56229 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionPacket_1get_1hmac(JNIEnv *env, jclass clz, int64_t this_ptr) {
56230         LDKOnionPacket this_ptr_conv;
56231         this_ptr_conv.inner = untag_ptr(this_ptr);
56232         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56234         this_ptr_conv.is_owned = false;
56235         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
56236         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OnionPacket_get_hmac(&this_ptr_conv));
56237         return ret_arr;
56238 }
56239
56240 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionPacket_1set_1hmac(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
56241         LDKOnionPacket this_ptr_conv;
56242         this_ptr_conv.inner = untag_ptr(this_ptr);
56243         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56245         this_ptr_conv.is_owned = false;
56246         LDKThirtyTwoBytes val_ref;
56247         CHECK((*env)->GetArrayLength(env, val) == 32);
56248         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
56249         OnionPacket_set_hmac(&this_ptr_conv, val_ref);
56250 }
56251
56252 static inline uint64_t OnionPacket_clone_ptr(LDKOnionPacket *NONNULL_PTR arg) {
56253         LDKOnionPacket ret_var = OnionPacket_clone(arg);
56254         int64_t ret_ref = 0;
56255         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56256         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56257         return ret_ref;
56258 }
56259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionPacket_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
56260         LDKOnionPacket arg_conv;
56261         arg_conv.inner = untag_ptr(arg);
56262         arg_conv.is_owned = ptr_is_owned(arg);
56263         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56264         arg_conv.is_owned = false;
56265         int64_t ret_conv = OnionPacket_clone_ptr(&arg_conv);
56266         return ret_conv;
56267 }
56268
56269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionPacket_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56270         LDKOnionPacket orig_conv;
56271         orig_conv.inner = untag_ptr(orig);
56272         orig_conv.is_owned = ptr_is_owned(orig);
56273         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56274         orig_conv.is_owned = false;
56275         LDKOnionPacket ret_var = OnionPacket_clone(&orig_conv);
56276         int64_t ret_ref = 0;
56277         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56278         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56279         return ret_ref;
56280 }
56281
56282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionPacket_1hash(JNIEnv *env, jclass clz, int64_t o) {
56283         LDKOnionPacket o_conv;
56284         o_conv.inner = untag_ptr(o);
56285         o_conv.is_owned = ptr_is_owned(o);
56286         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
56287         o_conv.is_owned = false;
56288         int64_t ret_conv = OnionPacket_hash(&o_conv);
56289         return ret_conv;
56290 }
56291
56292 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OnionPacket_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
56293         LDKOnionPacket a_conv;
56294         a_conv.inner = untag_ptr(a);
56295         a_conv.is_owned = ptr_is_owned(a);
56296         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
56297         a_conv.is_owned = false;
56298         LDKOnionPacket b_conv;
56299         b_conv.inner = untag_ptr(b);
56300         b_conv.is_owned = ptr_is_owned(b);
56301         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
56302         b_conv.is_owned = false;
56303         jboolean ret_conv = OnionPacket_eq(&a_conv, &b_conv);
56304         return ret_conv;
56305 }
56306
56307 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
56308         LDKAcceptChannel obj_conv;
56309         obj_conv.inner = untag_ptr(obj);
56310         obj_conv.is_owned = ptr_is_owned(obj);
56311         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56312         obj_conv.is_owned = false;
56313         LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
56314         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56315         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56316         CVec_u8Z_free(ret_var);
56317         return ret_arr;
56318 }
56319
56320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56321         LDKu8slice ser_ref;
56322         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56323         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56324         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
56325         *ret_conv = AcceptChannel_read(ser_ref);
56326         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56327         return tag_ptr(ret_conv, true);
56328 }
56329
56330 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1write(JNIEnv *env, jclass clz, int64_t obj) {
56331         LDKAcceptChannelV2 obj_conv;
56332         obj_conv.inner = untag_ptr(obj);
56333         obj_conv.is_owned = ptr_is_owned(obj);
56334         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56335         obj_conv.is_owned = false;
56336         LDKCVec_u8Z ret_var = AcceptChannelV2_write(&obj_conv);
56337         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56338         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56339         CVec_u8Z_free(ret_var);
56340         return ret_arr;
56341 }
56342
56343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56344         LDKu8slice ser_ref;
56345         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56346         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56347         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
56348         *ret_conv = AcceptChannelV2_read(ser_ref);
56349         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56350         return tag_ptr(ret_conv, true);
56351 }
56352
56353 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Stfu_1write(JNIEnv *env, jclass clz, int64_t obj) {
56354         LDKStfu obj_conv;
56355         obj_conv.inner = untag_ptr(obj);
56356         obj_conv.is_owned = ptr_is_owned(obj);
56357         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56358         obj_conv.is_owned = false;
56359         LDKCVec_u8Z ret_var = Stfu_write(&obj_conv);
56360         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56361         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56362         CVec_u8Z_free(ret_var);
56363         return ret_arr;
56364 }
56365
56366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Stfu_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56367         LDKu8slice ser_ref;
56368         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56369         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56370         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
56371         *ret_conv = Stfu_read(ser_ref);
56372         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56373         return tag_ptr(ret_conv, true);
56374 }
56375
56376 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Splice_1write(JNIEnv *env, jclass clz, int64_t obj) {
56377         LDKSplice obj_conv;
56378         obj_conv.inner = untag_ptr(obj);
56379         obj_conv.is_owned = ptr_is_owned(obj);
56380         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56381         obj_conv.is_owned = false;
56382         LDKCVec_u8Z ret_var = Splice_write(&obj_conv);
56383         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56384         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56385         CVec_u8Z_free(ret_var);
56386         return ret_arr;
56387 }
56388
56389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Splice_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56390         LDKu8slice ser_ref;
56391         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56392         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56393         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
56394         *ret_conv = Splice_read(ser_ref);
56395         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56396         return tag_ptr(ret_conv, true);
56397 }
56398
56399 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpliceAck_1write(JNIEnv *env, jclass clz, int64_t obj) {
56400         LDKSpliceAck obj_conv;
56401         obj_conv.inner = untag_ptr(obj);
56402         obj_conv.is_owned = ptr_is_owned(obj);
56403         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56404         obj_conv.is_owned = false;
56405         LDKCVec_u8Z ret_var = SpliceAck_write(&obj_conv);
56406         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56407         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56408         CVec_u8Z_free(ret_var);
56409         return ret_arr;
56410 }
56411
56412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceAck_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56413         LDKu8slice ser_ref;
56414         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56415         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56416         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
56417         *ret_conv = SpliceAck_read(ser_ref);
56418         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56419         return tag_ptr(ret_conv, true);
56420 }
56421
56422 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpliceLocked_1write(JNIEnv *env, jclass clz, int64_t obj) {
56423         LDKSpliceLocked obj_conv;
56424         obj_conv.inner = untag_ptr(obj);
56425         obj_conv.is_owned = ptr_is_owned(obj);
56426         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56427         obj_conv.is_owned = false;
56428         LDKCVec_u8Z ret_var = SpliceLocked_write(&obj_conv);
56429         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56430         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56431         CVec_u8Z_free(ret_var);
56432         return ret_arr;
56433 }
56434
56435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceLocked_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56436         LDKu8slice ser_ref;
56437         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56438         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56439         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
56440         *ret_conv = SpliceLocked_read(ser_ref);
56441         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56442         return tag_ptr(ret_conv, true);
56443 }
56444
56445 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddInput_1write(JNIEnv *env, jclass clz, int64_t obj) {
56446         LDKTxAddInput obj_conv;
56447         obj_conv.inner = untag_ptr(obj);
56448         obj_conv.is_owned = ptr_is_owned(obj);
56449         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56450         obj_conv.is_owned = false;
56451         LDKCVec_u8Z ret_var = TxAddInput_write(&obj_conv);
56452         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56453         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56454         CVec_u8Z_free(ret_var);
56455         return ret_arr;
56456 }
56457
56458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56459         LDKu8slice ser_ref;
56460         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56461         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56462         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
56463         *ret_conv = TxAddInput_read(ser_ref);
56464         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56465         return tag_ptr(ret_conv, true);
56466 }
56467
56468 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1write(JNIEnv *env, jclass clz, int64_t obj) {
56469         LDKTxAddOutput obj_conv;
56470         obj_conv.inner = untag_ptr(obj);
56471         obj_conv.is_owned = ptr_is_owned(obj);
56472         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56473         obj_conv.is_owned = false;
56474         LDKCVec_u8Z ret_var = TxAddOutput_write(&obj_conv);
56475         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56476         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56477         CVec_u8Z_free(ret_var);
56478         return ret_arr;
56479 }
56480
56481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56482         LDKu8slice ser_ref;
56483         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56484         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56485         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
56486         *ret_conv = TxAddOutput_read(ser_ref);
56487         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56488         return tag_ptr(ret_conv, true);
56489 }
56490
56491 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1write(JNIEnv *env, jclass clz, int64_t obj) {
56492         LDKTxRemoveInput obj_conv;
56493         obj_conv.inner = untag_ptr(obj);
56494         obj_conv.is_owned = ptr_is_owned(obj);
56495         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56496         obj_conv.is_owned = false;
56497         LDKCVec_u8Z ret_var = TxRemoveInput_write(&obj_conv);
56498         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56499         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56500         CVec_u8Z_free(ret_var);
56501         return ret_arr;
56502 }
56503
56504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56505         LDKu8slice ser_ref;
56506         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56507         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56508         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
56509         *ret_conv = TxRemoveInput_read(ser_ref);
56510         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56511         return tag_ptr(ret_conv, true);
56512 }
56513
56514 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1write(JNIEnv *env, jclass clz, int64_t obj) {
56515         LDKTxRemoveOutput obj_conv;
56516         obj_conv.inner = untag_ptr(obj);
56517         obj_conv.is_owned = ptr_is_owned(obj);
56518         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56519         obj_conv.is_owned = false;
56520         LDKCVec_u8Z ret_var = TxRemoveOutput_write(&obj_conv);
56521         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56522         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56523         CVec_u8Z_free(ret_var);
56524         return ret_arr;
56525 }
56526
56527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56528         LDKu8slice ser_ref;
56529         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56530         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56531         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
56532         *ret_conv = TxRemoveOutput_read(ser_ref);
56533         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56534         return tag_ptr(ret_conv, true);
56535 }
56536
56537 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxComplete_1write(JNIEnv *env, jclass clz, int64_t obj) {
56538         LDKTxComplete obj_conv;
56539         obj_conv.inner = untag_ptr(obj);
56540         obj_conv.is_owned = ptr_is_owned(obj);
56541         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56542         obj_conv.is_owned = false;
56543         LDKCVec_u8Z ret_var = TxComplete_write(&obj_conv);
56544         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56545         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56546         CVec_u8Z_free(ret_var);
56547         return ret_arr;
56548 }
56549
56550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56551         LDKu8slice ser_ref;
56552         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56553         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56554         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
56555         *ret_conv = TxComplete_read(ser_ref);
56556         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56557         return tag_ptr(ret_conv, true);
56558 }
56559
56560 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
56561         LDKTxSignatures obj_conv;
56562         obj_conv.inner = untag_ptr(obj);
56563         obj_conv.is_owned = ptr_is_owned(obj);
56564         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56565         obj_conv.is_owned = false;
56566         LDKCVec_u8Z ret_var = TxSignatures_write(&obj_conv);
56567         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56568         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56569         CVec_u8Z_free(ret_var);
56570         return ret_arr;
56571 }
56572
56573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56574         LDKu8slice ser_ref;
56575         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56576         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56577         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
56578         *ret_conv = TxSignatures_read(ser_ref);
56579         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56580         return tag_ptr(ret_conv, true);
56581 }
56582
56583 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1write(JNIEnv *env, jclass clz, int64_t obj) {
56584         LDKTxInitRbf obj_conv;
56585         obj_conv.inner = untag_ptr(obj);
56586         obj_conv.is_owned = ptr_is_owned(obj);
56587         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56588         obj_conv.is_owned = false;
56589         LDKCVec_u8Z ret_var = TxInitRbf_write(&obj_conv);
56590         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56591         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56592         CVec_u8Z_free(ret_var);
56593         return ret_arr;
56594 }
56595
56596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56597         LDKu8slice ser_ref;
56598         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56599         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56600         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
56601         *ret_conv = TxInitRbf_read(ser_ref);
56602         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56603         return tag_ptr(ret_conv, true);
56604 }
56605
56606 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1write(JNIEnv *env, jclass clz, int64_t obj) {
56607         LDKTxAckRbf obj_conv;
56608         obj_conv.inner = untag_ptr(obj);
56609         obj_conv.is_owned = ptr_is_owned(obj);
56610         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56611         obj_conv.is_owned = false;
56612         LDKCVec_u8Z ret_var = TxAckRbf_write(&obj_conv);
56613         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56614         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56615         CVec_u8Z_free(ret_var);
56616         return ret_arr;
56617 }
56618
56619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56620         LDKu8slice ser_ref;
56621         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56622         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56623         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
56624         *ret_conv = TxAckRbf_read(ser_ref);
56625         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56626         return tag_ptr(ret_conv, true);
56627 }
56628
56629 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAbort_1write(JNIEnv *env, jclass clz, int64_t obj) {
56630         LDKTxAbort obj_conv;
56631         obj_conv.inner = untag_ptr(obj);
56632         obj_conv.is_owned = ptr_is_owned(obj);
56633         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56634         obj_conv.is_owned = false;
56635         LDKCVec_u8Z ret_var = TxAbort_write(&obj_conv);
56636         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56637         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56638         CVec_u8Z_free(ret_var);
56639         return ret_arr;
56640 }
56641
56642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56643         LDKu8slice ser_ref;
56644         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56645         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56646         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
56647         *ret_conv = TxAbort_read(ser_ref);
56648         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56649         return tag_ptr(ret_conv, true);
56650 }
56651
56652 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
56653         LDKAnnouncementSignatures obj_conv;
56654         obj_conv.inner = untag_ptr(obj);
56655         obj_conv.is_owned = ptr_is_owned(obj);
56656         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56657         obj_conv.is_owned = false;
56658         LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
56659         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56660         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56661         CVec_u8Z_free(ret_var);
56662         return ret_arr;
56663 }
56664
56665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56666         LDKu8slice ser_ref;
56667         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56668         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56669         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
56670         *ret_conv = AnnouncementSignatures_read(ser_ref);
56671         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56672         return tag_ptr(ret_conv, true);
56673 }
56674
56675 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
56676         LDKChannelReestablish obj_conv;
56677         obj_conv.inner = untag_ptr(obj);
56678         obj_conv.is_owned = ptr_is_owned(obj);
56679         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56680         obj_conv.is_owned = false;
56681         LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
56682         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56683         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56684         CVec_u8Z_free(ret_var);
56685         return ret_arr;
56686 }
56687
56688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56689         LDKu8slice ser_ref;
56690         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56691         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56692         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
56693         *ret_conv = ChannelReestablish_read(ser_ref);
56694         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56695         return tag_ptr(ret_conv, true);
56696 }
56697
56698 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
56699         LDKClosingSigned obj_conv;
56700         obj_conv.inner = untag_ptr(obj);
56701         obj_conv.is_owned = ptr_is_owned(obj);
56702         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56703         obj_conv.is_owned = false;
56704         LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
56705         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56706         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56707         CVec_u8Z_free(ret_var);
56708         return ret_arr;
56709 }
56710
56711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56712         LDKu8slice ser_ref;
56713         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56714         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56715         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
56716         *ret_conv = ClosingSigned_read(ser_ref);
56717         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56718         return tag_ptr(ret_conv, true);
56719 }
56720
56721 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
56722         LDKClosingSignedFeeRange obj_conv;
56723         obj_conv.inner = untag_ptr(obj);
56724         obj_conv.is_owned = ptr_is_owned(obj);
56725         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56726         obj_conv.is_owned = false;
56727         LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
56728         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56729         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56730         CVec_u8Z_free(ret_var);
56731         return ret_arr;
56732 }
56733
56734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56735         LDKu8slice ser_ref;
56736         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56737         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56738         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
56739         *ret_conv = ClosingSignedFeeRange_read(ser_ref);
56740         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56741         return tag_ptr(ret_conv, true);
56742 }
56743
56744 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
56745         LDKCommitmentSigned obj_conv;
56746         obj_conv.inner = untag_ptr(obj);
56747         obj_conv.is_owned = ptr_is_owned(obj);
56748         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56749         obj_conv.is_owned = false;
56750         LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
56751         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56752         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56753         CVec_u8Z_free(ret_var);
56754         return ret_arr;
56755 }
56756
56757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56758         LDKu8slice ser_ref;
56759         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56760         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56761         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
56762         *ret_conv = CommitmentSigned_read(ser_ref);
56763         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56764         return tag_ptr(ret_conv, true);
56765 }
56766
56767 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
56768         LDKFundingCreated obj_conv;
56769         obj_conv.inner = untag_ptr(obj);
56770         obj_conv.is_owned = ptr_is_owned(obj);
56771         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56772         obj_conv.is_owned = false;
56773         LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
56774         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56775         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56776         CVec_u8Z_free(ret_var);
56777         return ret_arr;
56778 }
56779
56780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56781         LDKu8slice ser_ref;
56782         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56783         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56784         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
56785         *ret_conv = FundingCreated_read(ser_ref);
56786         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56787         return tag_ptr(ret_conv, true);
56788 }
56789
56790 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
56791         LDKFundingSigned obj_conv;
56792         obj_conv.inner = untag_ptr(obj);
56793         obj_conv.is_owned = ptr_is_owned(obj);
56794         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56795         obj_conv.is_owned = false;
56796         LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
56797         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56798         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56799         CVec_u8Z_free(ret_var);
56800         return ret_arr;
56801 }
56802
56803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56804         LDKu8slice ser_ref;
56805         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56806         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56807         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
56808         *ret_conv = FundingSigned_read(ser_ref);
56809         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56810         return tag_ptr(ret_conv, true);
56811 }
56812
56813 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1write(JNIEnv *env, jclass clz, int64_t obj) {
56814         LDKChannelReady obj_conv;
56815         obj_conv.inner = untag_ptr(obj);
56816         obj_conv.is_owned = ptr_is_owned(obj);
56817         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56818         obj_conv.is_owned = false;
56819         LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
56820         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56821         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56822         CVec_u8Z_free(ret_var);
56823         return ret_arr;
56824 }
56825
56826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56827         LDKu8slice ser_ref;
56828         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56829         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56830         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
56831         *ret_conv = ChannelReady_read(ser_ref);
56832         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56833         return tag_ptr(ret_conv, true);
56834 }
56835
56836 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
56837         LDKInit obj_conv;
56838         obj_conv.inner = untag_ptr(obj);
56839         obj_conv.is_owned = ptr_is_owned(obj);
56840         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56841         obj_conv.is_owned = false;
56842         LDKCVec_u8Z ret_var = Init_write(&obj_conv);
56843         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56844         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56845         CVec_u8Z_free(ret_var);
56846         return ret_arr;
56847 }
56848
56849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56850         LDKu8slice ser_ref;
56851         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56852         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56853         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
56854         *ret_conv = Init_read(ser_ref);
56855         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56856         return tag_ptr(ret_conv, true);
56857 }
56858
56859 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
56860         LDKOpenChannel obj_conv;
56861         obj_conv.inner = untag_ptr(obj);
56862         obj_conv.is_owned = ptr_is_owned(obj);
56863         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56864         obj_conv.is_owned = false;
56865         LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
56866         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56867         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56868         CVec_u8Z_free(ret_var);
56869         return ret_arr;
56870 }
56871
56872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56873         LDKu8slice ser_ref;
56874         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56875         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56876         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
56877         *ret_conv = OpenChannel_read(ser_ref);
56878         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56879         return tag_ptr(ret_conv, true);
56880 }
56881
56882 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1write(JNIEnv *env, jclass clz, int64_t obj) {
56883         LDKOpenChannelV2 obj_conv;
56884         obj_conv.inner = untag_ptr(obj);
56885         obj_conv.is_owned = ptr_is_owned(obj);
56886         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56887         obj_conv.is_owned = false;
56888         LDKCVec_u8Z ret_var = OpenChannelV2_write(&obj_conv);
56889         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56890         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56891         CVec_u8Z_free(ret_var);
56892         return ret_arr;
56893 }
56894
56895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56896         LDKu8slice ser_ref;
56897         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56898         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56899         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
56900         *ret_conv = OpenChannelV2_read(ser_ref);
56901         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56902         return tag_ptr(ret_conv, true);
56903 }
56904
56905 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
56906         LDKRevokeAndACK obj_conv;
56907         obj_conv.inner = untag_ptr(obj);
56908         obj_conv.is_owned = ptr_is_owned(obj);
56909         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56910         obj_conv.is_owned = false;
56911         LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
56912         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56913         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56914         CVec_u8Z_free(ret_var);
56915         return ret_arr;
56916 }
56917
56918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56919         LDKu8slice ser_ref;
56920         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56921         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56922         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
56923         *ret_conv = RevokeAndACK_read(ser_ref);
56924         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56925         return tag_ptr(ret_conv, true);
56926 }
56927
56928 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
56929         LDKShutdown obj_conv;
56930         obj_conv.inner = untag_ptr(obj);
56931         obj_conv.is_owned = ptr_is_owned(obj);
56932         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56933         obj_conv.is_owned = false;
56934         LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
56935         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56936         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56937         CVec_u8Z_free(ret_var);
56938         return ret_arr;
56939 }
56940
56941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56942         LDKu8slice ser_ref;
56943         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56944         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56945         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
56946         *ret_conv = Shutdown_read(ser_ref);
56947         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56948         return tag_ptr(ret_conv, true);
56949 }
56950
56951 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
56952         LDKUpdateFailHTLC obj_conv;
56953         obj_conv.inner = untag_ptr(obj);
56954         obj_conv.is_owned = ptr_is_owned(obj);
56955         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56956         obj_conv.is_owned = false;
56957         LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
56958         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56959         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56960         CVec_u8Z_free(ret_var);
56961         return ret_arr;
56962 }
56963
56964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56965         LDKu8slice ser_ref;
56966         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56967         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56968         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
56969         *ret_conv = UpdateFailHTLC_read(ser_ref);
56970         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56971         return tag_ptr(ret_conv, true);
56972 }
56973
56974 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
56975         LDKUpdateFailMalformedHTLC obj_conv;
56976         obj_conv.inner = untag_ptr(obj);
56977         obj_conv.is_owned = ptr_is_owned(obj);
56978         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56979         obj_conv.is_owned = false;
56980         LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
56981         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56982         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56983         CVec_u8Z_free(ret_var);
56984         return ret_arr;
56985 }
56986
56987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56988         LDKu8slice ser_ref;
56989         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56990         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56991         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
56992         *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
56993         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56994         return tag_ptr(ret_conv, true);
56995 }
56996
56997 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
56998         LDKUpdateFee obj_conv;
56999         obj_conv.inner = untag_ptr(obj);
57000         obj_conv.is_owned = ptr_is_owned(obj);
57001         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57002         obj_conv.is_owned = false;
57003         LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
57004         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57005         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57006         CVec_u8Z_free(ret_var);
57007         return ret_arr;
57008 }
57009
57010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57011         LDKu8slice ser_ref;
57012         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57013         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57014         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
57015         *ret_conv = UpdateFee_read(ser_ref);
57016         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57017         return tag_ptr(ret_conv, true);
57018 }
57019
57020 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
57021         LDKUpdateFulfillHTLC obj_conv;
57022         obj_conv.inner = untag_ptr(obj);
57023         obj_conv.is_owned = ptr_is_owned(obj);
57024         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57025         obj_conv.is_owned = false;
57026         LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
57027         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57028         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57029         CVec_u8Z_free(ret_var);
57030         return ret_arr;
57031 }
57032
57033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57034         LDKu8slice ser_ref;
57035         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57036         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57037         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
57038         *ret_conv = UpdateFulfillHTLC_read(ser_ref);
57039         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57040         return tag_ptr(ret_conv, true);
57041 }
57042
57043 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionPacket_1write(JNIEnv *env, jclass clz, int64_t obj) {
57044         LDKOnionPacket obj_conv;
57045         obj_conv.inner = untag_ptr(obj);
57046         obj_conv.is_owned = ptr_is_owned(obj);
57047         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57048         obj_conv.is_owned = false;
57049         LDKCVec_u8Z ret_var = OnionPacket_write(&obj_conv);
57050         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57051         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57052         CVec_u8Z_free(ret_var);
57053         return ret_arr;
57054 }
57055
57056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionPacket_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57057         LDKu8slice ser_ref;
57058         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57059         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57060         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
57061         *ret_conv = OnionPacket_read(ser_ref);
57062         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57063         return tag_ptr(ret_conv, true);
57064 }
57065
57066 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
57067         LDKUpdateAddHTLC obj_conv;
57068         obj_conv.inner = untag_ptr(obj);
57069         obj_conv.is_owned = ptr_is_owned(obj);
57070         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57071         obj_conv.is_owned = false;
57072         LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
57073         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57074         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57075         CVec_u8Z_free(ret_var);
57076         return ret_arr;
57077 }
57078
57079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57080         LDKu8slice ser_ref;
57081         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57082         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57083         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
57084         *ret_conv = UpdateAddHTLC_read(ser_ref);
57085         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57086         return tag_ptr(ret_conv, true);
57087 }
57088
57089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57090         LDKu8slice ser_ref;
57091         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57092         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57093         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
57094         *ret_conv = OnionMessage_read(ser_ref);
57095         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57096         return tag_ptr(ret_conv, true);
57097 }
57098
57099 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
57100         LDKOnionMessage obj_conv;
57101         obj_conv.inner = untag_ptr(obj);
57102         obj_conv.is_owned = ptr_is_owned(obj);
57103         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57104         obj_conv.is_owned = false;
57105         LDKCVec_u8Z ret_var = OnionMessage_write(&obj_conv);
57106         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57107         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57108         CVec_u8Z_free(ret_var);
57109         return ret_arr;
57110 }
57111
57112 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1write(JNIEnv *env, jclass clz, int64_t obj) {
57113         LDKFinalOnionHopData obj_conv;
57114         obj_conv.inner = untag_ptr(obj);
57115         obj_conv.is_owned = ptr_is_owned(obj);
57116         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57117         obj_conv.is_owned = false;
57118         LDKCVec_u8Z ret_var = FinalOnionHopData_write(&obj_conv);
57119         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57120         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57121         CVec_u8Z_free(ret_var);
57122         return ret_arr;
57123 }
57124
57125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57126         LDKu8slice ser_ref;
57127         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57128         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57129         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
57130         *ret_conv = FinalOnionHopData_read(ser_ref);
57131         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57132         return tag_ptr(ret_conv, true);
57133 }
57134
57135 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
57136         LDKPing obj_conv;
57137         obj_conv.inner = untag_ptr(obj);
57138         obj_conv.is_owned = ptr_is_owned(obj);
57139         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57140         obj_conv.is_owned = false;
57141         LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
57142         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57143         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57144         CVec_u8Z_free(ret_var);
57145         return ret_arr;
57146 }
57147
57148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57149         LDKu8slice ser_ref;
57150         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57151         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57152         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
57153         *ret_conv = Ping_read(ser_ref);
57154         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57155         return tag_ptr(ret_conv, true);
57156 }
57157
57158 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
57159         LDKPong obj_conv;
57160         obj_conv.inner = untag_ptr(obj);
57161         obj_conv.is_owned = ptr_is_owned(obj);
57162         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57163         obj_conv.is_owned = false;
57164         LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
57165         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57166         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57167         CVec_u8Z_free(ret_var);
57168         return ret_arr;
57169 }
57170
57171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57172         LDKu8slice ser_ref;
57173         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57174         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57175         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
57176         *ret_conv = Pong_read(ser_ref);
57177         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57178         return tag_ptr(ret_conv, true);
57179 }
57180
57181 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
57182         LDKUnsignedChannelAnnouncement obj_conv;
57183         obj_conv.inner = untag_ptr(obj);
57184         obj_conv.is_owned = ptr_is_owned(obj);
57185         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57186         obj_conv.is_owned = false;
57187         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
57188         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57189         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57190         CVec_u8Z_free(ret_var);
57191         return ret_arr;
57192 }
57193
57194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57195         LDKu8slice ser_ref;
57196         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57197         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57198         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
57199         *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
57200         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57201         return tag_ptr(ret_conv, true);
57202 }
57203
57204 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
57205         LDKChannelAnnouncement obj_conv;
57206         obj_conv.inner = untag_ptr(obj);
57207         obj_conv.is_owned = ptr_is_owned(obj);
57208         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57209         obj_conv.is_owned = false;
57210         LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
57211         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57212         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57213         CVec_u8Z_free(ret_var);
57214         return ret_arr;
57215 }
57216
57217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57218         LDKu8slice ser_ref;
57219         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57220         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57221         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
57222         *ret_conv = ChannelAnnouncement_read(ser_ref);
57223         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57224         return tag_ptr(ret_conv, true);
57225 }
57226
57227 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
57228         LDKUnsignedChannelUpdate obj_conv;
57229         obj_conv.inner = untag_ptr(obj);
57230         obj_conv.is_owned = ptr_is_owned(obj);
57231         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57232         obj_conv.is_owned = false;
57233         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
57234         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57235         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57236         CVec_u8Z_free(ret_var);
57237         return ret_arr;
57238 }
57239
57240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57241         LDKu8slice ser_ref;
57242         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57243         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57244         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
57245         *ret_conv = UnsignedChannelUpdate_read(ser_ref);
57246         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57247         return tag_ptr(ret_conv, true);
57248 }
57249
57250 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
57251         LDKChannelUpdate obj_conv;
57252         obj_conv.inner = untag_ptr(obj);
57253         obj_conv.is_owned = ptr_is_owned(obj);
57254         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57255         obj_conv.is_owned = false;
57256         LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
57257         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57258         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57259         CVec_u8Z_free(ret_var);
57260         return ret_arr;
57261 }
57262
57263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57264         LDKu8slice ser_ref;
57265         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57266         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57267         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
57268         *ret_conv = ChannelUpdate_read(ser_ref);
57269         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57270         return tag_ptr(ret_conv, true);
57271 }
57272
57273 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
57274         LDKErrorMessage obj_conv;
57275         obj_conv.inner = untag_ptr(obj);
57276         obj_conv.is_owned = ptr_is_owned(obj);
57277         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57278         obj_conv.is_owned = false;
57279         LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
57280         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57281         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57282         CVec_u8Z_free(ret_var);
57283         return ret_arr;
57284 }
57285
57286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57287         LDKu8slice ser_ref;
57288         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57289         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57290         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
57291         *ret_conv = ErrorMessage_read(ser_ref);
57292         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57293         return tag_ptr(ret_conv, true);
57294 }
57295
57296 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
57297         LDKWarningMessage obj_conv;
57298         obj_conv.inner = untag_ptr(obj);
57299         obj_conv.is_owned = ptr_is_owned(obj);
57300         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57301         obj_conv.is_owned = false;
57302         LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
57303         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57304         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57305         CVec_u8Z_free(ret_var);
57306         return ret_arr;
57307 }
57308
57309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57310         LDKu8slice ser_ref;
57311         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57312         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57313         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
57314         *ret_conv = WarningMessage_read(ser_ref);
57315         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57316         return tag_ptr(ret_conv, true);
57317 }
57318
57319 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
57320         LDKUnsignedNodeAnnouncement obj_conv;
57321         obj_conv.inner = untag_ptr(obj);
57322         obj_conv.is_owned = ptr_is_owned(obj);
57323         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57324         obj_conv.is_owned = false;
57325         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
57326         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57327         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57328         CVec_u8Z_free(ret_var);
57329         return ret_arr;
57330 }
57331
57332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57333         LDKu8slice ser_ref;
57334         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57335         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57336         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
57337         *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
57338         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57339         return tag_ptr(ret_conv, true);
57340 }
57341
57342 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
57343         LDKNodeAnnouncement obj_conv;
57344         obj_conv.inner = untag_ptr(obj);
57345         obj_conv.is_owned = ptr_is_owned(obj);
57346         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57347         obj_conv.is_owned = false;
57348         LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
57349         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57350         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57351         CVec_u8Z_free(ret_var);
57352         return ret_arr;
57353 }
57354
57355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57356         LDKu8slice ser_ref;
57357         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57358         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57359         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
57360         *ret_conv = NodeAnnouncement_read(ser_ref);
57361         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57362         return tag_ptr(ret_conv, true);
57363 }
57364
57365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57366         LDKu8slice ser_ref;
57367         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57368         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57369         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
57370         *ret_conv = QueryShortChannelIds_read(ser_ref);
57371         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57372         return tag_ptr(ret_conv, true);
57373 }
57374
57375 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
57376         LDKQueryShortChannelIds obj_conv;
57377         obj_conv.inner = untag_ptr(obj);
57378         obj_conv.is_owned = ptr_is_owned(obj);
57379         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57380         obj_conv.is_owned = false;
57381         LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
57382         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57383         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57384         CVec_u8Z_free(ret_var);
57385         return ret_arr;
57386 }
57387
57388 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
57389         LDKReplyShortChannelIdsEnd obj_conv;
57390         obj_conv.inner = untag_ptr(obj);
57391         obj_conv.is_owned = ptr_is_owned(obj);
57392         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57393         obj_conv.is_owned = false;
57394         LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
57395         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57396         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57397         CVec_u8Z_free(ret_var);
57398         return ret_arr;
57399 }
57400
57401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57402         LDKu8slice ser_ref;
57403         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57404         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57405         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
57406         *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
57407         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57408         return tag_ptr(ret_conv, true);
57409 }
57410
57411 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum(JNIEnv *env, jclass clz, int64_t this_arg) {
57412         LDKQueryChannelRange this_arg_conv;
57413         this_arg_conv.inner = untag_ptr(this_arg);
57414         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57416         this_arg_conv.is_owned = false;
57417         int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
57418         return ret_conv;
57419 }
57420
57421 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
57422         LDKQueryChannelRange obj_conv;
57423         obj_conv.inner = untag_ptr(obj);
57424         obj_conv.is_owned = ptr_is_owned(obj);
57425         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57426         obj_conv.is_owned = false;
57427         LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
57428         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57429         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57430         CVec_u8Z_free(ret_var);
57431         return ret_arr;
57432 }
57433
57434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57435         LDKu8slice ser_ref;
57436         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57437         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57438         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
57439         *ret_conv = QueryChannelRange_read(ser_ref);
57440         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57441         return tag_ptr(ret_conv, true);
57442 }
57443
57444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57445         LDKu8slice ser_ref;
57446         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57447         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57448         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
57449         *ret_conv = ReplyChannelRange_read(ser_ref);
57450         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57451         return tag_ptr(ret_conv, true);
57452 }
57453
57454 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
57455         LDKReplyChannelRange obj_conv;
57456         obj_conv.inner = untag_ptr(obj);
57457         obj_conv.is_owned = ptr_is_owned(obj);
57458         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57459         obj_conv.is_owned = false;
57460         LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
57461         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57462         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57463         CVec_u8Z_free(ret_var);
57464         return ret_arr;
57465 }
57466
57467 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
57468         LDKGossipTimestampFilter obj_conv;
57469         obj_conv.inner = untag_ptr(obj);
57470         obj_conv.is_owned = ptr_is_owned(obj);
57471         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57472         obj_conv.is_owned = false;
57473         LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
57474         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57475         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57476         CVec_u8Z_free(ret_var);
57477         return ret_arr;
57478 }
57479
57480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57481         LDKu8slice ser_ref;
57482         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57483         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57484         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
57485         *ret_conv = GossipTimestampFilter_read(ser_ref);
57486         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57487         return tag_ptr(ret_conv, true);
57488 }
57489
57490 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
57491         if (!ptr_is_owned(this_ptr)) return;
57492         void* this_ptr_ptr = untag_ptr(this_ptr);
57493         CHECK_ACCESS(this_ptr_ptr);
57494         LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
57495         FREE(untag_ptr(this_ptr));
57496         CustomMessageHandler_free(this_ptr_conv);
57497 }
57498
57499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
57500         LDKIgnoringMessageHandler this_obj_conv;
57501         this_obj_conv.inner = untag_ptr(this_obj);
57502         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57504         IgnoringMessageHandler_free(this_obj_conv);
57505 }
57506
57507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1new(JNIEnv *env, jclass clz) {
57508         LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
57509         int64_t ret_ref = 0;
57510         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57511         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57512         return ret_ref;
57513 }
57514
57515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
57516         LDKIgnoringMessageHandler this_arg_conv;
57517         this_arg_conv.inner = untag_ptr(this_arg);
57518         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57520         this_arg_conv.is_owned = false;
57521         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
57522         *ret_ret = IgnoringMessageHandler_as_EventsProvider(&this_arg_conv);
57523         return tag_ptr(ret_ret, true);
57524 }
57525
57526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
57527         LDKIgnoringMessageHandler this_arg_conv;
57528         this_arg_conv.inner = untag_ptr(this_arg);
57529         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57531         this_arg_conv.is_owned = false;
57532         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
57533         *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
57534         return tag_ptr(ret_ret, true);
57535 }
57536
57537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
57538         LDKIgnoringMessageHandler this_arg_conv;
57539         this_arg_conv.inner = untag_ptr(this_arg);
57540         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57542         this_arg_conv.is_owned = false;
57543         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
57544         *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
57545         return tag_ptr(ret_ret, true);
57546 }
57547
57548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1OnionMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
57549         LDKIgnoringMessageHandler this_arg_conv;
57550         this_arg_conv.inner = untag_ptr(this_arg);
57551         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57553         this_arg_conv.is_owned = false;
57554         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
57555         *ret_ret = IgnoringMessageHandler_as_OnionMessageHandler(&this_arg_conv);
57556         return tag_ptr(ret_ret, true);
57557 }
57558
57559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1OffersMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
57560         LDKIgnoringMessageHandler this_arg_conv;
57561         this_arg_conv.inner = untag_ptr(this_arg);
57562         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57564         this_arg_conv.is_owned = false;
57565         LDKOffersMessageHandler* ret_ret = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
57566         *ret_ret = IgnoringMessageHandler_as_OffersMessageHandler(&this_arg_conv);
57567         return tag_ptr(ret_ret, true);
57568 }
57569
57570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomOnionMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
57571         LDKIgnoringMessageHandler this_arg_conv;
57572         this_arg_conv.inner = untag_ptr(this_arg);
57573         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57575         this_arg_conv.is_owned = false;
57576         LDKCustomOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
57577         *ret_ret = IgnoringMessageHandler_as_CustomOnionMessageHandler(&this_arg_conv);
57578         return tag_ptr(ret_ret, true);
57579 }
57580
57581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t this_arg) {
57582         LDKIgnoringMessageHandler this_arg_conv;
57583         this_arg_conv.inner = untag_ptr(this_arg);
57584         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57586         this_arg_conv.is_owned = false;
57587         LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
57588         *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
57589         return tag_ptr(ret_ret, true);
57590 }
57591
57592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
57593         LDKIgnoringMessageHandler this_arg_conv;
57594         this_arg_conv.inner = untag_ptr(this_arg);
57595         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57597         this_arg_conv.is_owned = false;
57598         LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
57599         *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
57600         return tag_ptr(ret_ret, true);
57601 }
57602
57603 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
57604         LDKErroringMessageHandler this_obj_conv;
57605         this_obj_conv.inner = untag_ptr(this_obj);
57606         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57608         ErroringMessageHandler_free(this_obj_conv);
57609 }
57610
57611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1new(JNIEnv *env, jclass clz) {
57612         LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
57613         int64_t ret_ref = 0;
57614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57616         return ret_ref;
57617 }
57618
57619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
57620         LDKErroringMessageHandler this_arg_conv;
57621         this_arg_conv.inner = untag_ptr(this_arg);
57622         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57624         this_arg_conv.is_owned = false;
57625         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
57626         *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
57627         return tag_ptr(ret_ret, true);
57628 }
57629
57630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
57631         LDKErroringMessageHandler this_arg_conv;
57632         this_arg_conv.inner = untag_ptr(this_arg);
57633         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57635         this_arg_conv.is_owned = false;
57636         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
57637         *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
57638         return tag_ptr(ret_ret, true);
57639 }
57640
57641 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
57642         LDKMessageHandler this_obj_conv;
57643         this_obj_conv.inner = untag_ptr(this_obj);
57644         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57646         MessageHandler_free(this_obj_conv);
57647 }
57648
57649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
57650         LDKMessageHandler this_ptr_conv;
57651         this_ptr_conv.inner = untag_ptr(this_ptr);
57652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57654         this_ptr_conv.is_owned = false;
57655         // WARNING: This object doesn't live past this scope, needs clone!
57656         int64_t ret_ret = tag_ptr(MessageHandler_get_chan_handler(&this_ptr_conv), false);
57657         return ret_ret;
57658 }
57659
57660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57661         LDKMessageHandler this_ptr_conv;
57662         this_ptr_conv.inner = untag_ptr(this_ptr);
57663         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57665         this_ptr_conv.is_owned = false;
57666         void* val_ptr = untag_ptr(val);
57667         CHECK_ACCESS(val_ptr);
57668         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
57669         if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
57670                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57671                 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
57672         }
57673         MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
57674 }
57675
57676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
57677         LDKMessageHandler this_ptr_conv;
57678         this_ptr_conv.inner = untag_ptr(this_ptr);
57679         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57681         this_ptr_conv.is_owned = false;
57682         // WARNING: This object doesn't live past this scope, needs clone!
57683         int64_t ret_ret = tag_ptr(MessageHandler_get_route_handler(&this_ptr_conv), false);
57684         return ret_ret;
57685 }
57686
57687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57688         LDKMessageHandler this_ptr_conv;
57689         this_ptr_conv.inner = untag_ptr(this_ptr);
57690         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57692         this_ptr_conv.is_owned = false;
57693         void* val_ptr = untag_ptr(val);
57694         CHECK_ACCESS(val_ptr);
57695         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
57696         if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
57697                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57698                 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
57699         }
57700         MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
57701 }
57702
57703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1onion_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
57704         LDKMessageHandler this_ptr_conv;
57705         this_ptr_conv.inner = untag_ptr(this_ptr);
57706         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57708         this_ptr_conv.is_owned = false;
57709         // WARNING: This object doesn't live past this scope, needs clone!
57710         int64_t ret_ret = tag_ptr(MessageHandler_get_onion_message_handler(&this_ptr_conv), false);
57711         return ret_ret;
57712 }
57713
57714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1onion_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57715         LDKMessageHandler this_ptr_conv;
57716         this_ptr_conv.inner = untag_ptr(this_ptr);
57717         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57719         this_ptr_conv.is_owned = false;
57720         void* val_ptr = untag_ptr(val);
57721         CHECK_ACCESS(val_ptr);
57722         LDKOnionMessageHandler val_conv = *(LDKOnionMessageHandler*)(val_ptr);
57723         if (val_conv.free == LDKOnionMessageHandler_JCalls_free) {
57724                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57725                 LDKOnionMessageHandler_JCalls_cloned(&val_conv);
57726         }
57727         MessageHandler_set_onion_message_handler(&this_ptr_conv, val_conv);
57728 }
57729
57730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1custom_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
57731         LDKMessageHandler this_ptr_conv;
57732         this_ptr_conv.inner = untag_ptr(this_ptr);
57733         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57735         this_ptr_conv.is_owned = false;
57736         // WARNING: This object doesn't live past this scope, needs clone!
57737         int64_t ret_ret = tag_ptr(MessageHandler_get_custom_message_handler(&this_ptr_conv), false);
57738         return ret_ret;
57739 }
57740
57741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1custom_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57742         LDKMessageHandler this_ptr_conv;
57743         this_ptr_conv.inner = untag_ptr(this_ptr);
57744         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57746         this_ptr_conv.is_owned = false;
57747         void* val_ptr = untag_ptr(val);
57748         CHECK_ACCESS(val_ptr);
57749         LDKCustomMessageHandler val_conv = *(LDKCustomMessageHandler*)(val_ptr);
57750         if (val_conv.free == LDKCustomMessageHandler_JCalls_free) {
57751                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57752                 LDKCustomMessageHandler_JCalls_cloned(&val_conv);
57753         }
57754         MessageHandler_set_custom_message_handler(&this_ptr_conv, val_conv);
57755 }
57756
57757 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) {
57758         void* chan_handler_arg_ptr = untag_ptr(chan_handler_arg);
57759         CHECK_ACCESS(chan_handler_arg_ptr);
57760         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
57761         if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
57762                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57763                 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
57764         }
57765         void* route_handler_arg_ptr = untag_ptr(route_handler_arg);
57766         CHECK_ACCESS(route_handler_arg_ptr);
57767         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
57768         if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
57769                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57770                 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
57771         }
57772         void* onion_message_handler_arg_ptr = untag_ptr(onion_message_handler_arg);
57773         CHECK_ACCESS(onion_message_handler_arg_ptr);
57774         LDKOnionMessageHandler onion_message_handler_arg_conv = *(LDKOnionMessageHandler*)(onion_message_handler_arg_ptr);
57775         if (onion_message_handler_arg_conv.free == LDKOnionMessageHandler_JCalls_free) {
57776                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57777                 LDKOnionMessageHandler_JCalls_cloned(&onion_message_handler_arg_conv);
57778         }
57779         void* custom_message_handler_arg_ptr = untag_ptr(custom_message_handler_arg);
57780         CHECK_ACCESS(custom_message_handler_arg_ptr);
57781         LDKCustomMessageHandler custom_message_handler_arg_conv = *(LDKCustomMessageHandler*)(custom_message_handler_arg_ptr);
57782         if (custom_message_handler_arg_conv.free == LDKCustomMessageHandler_JCalls_free) {
57783                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57784                 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_arg_conv);
57785         }
57786         LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv, onion_message_handler_arg_conv, custom_message_handler_arg_conv);
57787         int64_t ret_ref = 0;
57788         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57789         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57790         return ret_ref;
57791 }
57792
57793 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
57794         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
57795         *ret_ret = SocketDescriptor_clone(arg);
57796         return tag_ptr(ret_ret, true);
57797 }
57798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
57799         void* arg_ptr = untag_ptr(arg);
57800         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
57801         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
57802         int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
57803         return ret_conv;
57804 }
57805
57806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
57807         void* orig_ptr = untag_ptr(orig);
57808         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
57809         LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
57810         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
57811         *ret_ret = SocketDescriptor_clone(orig_conv);
57812         return tag_ptr(ret_ret, true);
57813 }
57814
57815 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
57816         if (!ptr_is_owned(this_ptr)) return;
57817         void* this_ptr_ptr = untag_ptr(this_ptr);
57818         CHECK_ACCESS(this_ptr_ptr);
57819         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
57820         FREE(untag_ptr(this_ptr));
57821         SocketDescriptor_free(this_ptr_conv);
57822 }
57823
57824 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
57825         LDKPeerHandleError this_obj_conv;
57826         this_obj_conv.inner = untag_ptr(this_obj);
57827         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57829         PeerHandleError_free(this_obj_conv);
57830 }
57831
57832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz) {
57833         LDKPeerHandleError ret_var = PeerHandleError_new();
57834         int64_t ret_ref = 0;
57835         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57836         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57837         return ret_ref;
57838 }
57839
57840 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
57841         LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
57842         int64_t ret_ref = 0;
57843         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57844         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57845         return ret_ref;
57846 }
57847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
57848         LDKPeerHandleError arg_conv;
57849         arg_conv.inner = untag_ptr(arg);
57850         arg_conv.is_owned = ptr_is_owned(arg);
57851         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57852         arg_conv.is_owned = false;
57853         int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
57854         return ret_conv;
57855 }
57856
57857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
57858         LDKPeerHandleError orig_conv;
57859         orig_conv.inner = untag_ptr(orig);
57860         orig_conv.is_owned = ptr_is_owned(orig);
57861         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57862         orig_conv.is_owned = false;
57863         LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
57864         int64_t ret_ref = 0;
57865         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57866         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57867         return ret_ref;
57868 }
57869
57870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
57871         LDKPeerManager this_obj_conv;
57872         this_obj_conv.inner = untag_ptr(this_obj);
57873         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57875         PeerManager_free(this_obj_conv);
57876 }
57877
57878 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) {
57879         LDKMessageHandler message_handler_conv;
57880         message_handler_conv.inner = untag_ptr(message_handler);
57881         message_handler_conv.is_owned = ptr_is_owned(message_handler);
57882         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
57883         // WARNING: we need a move here but no clone is available for LDKMessageHandler
57884         
57885         uint8_t ephemeral_random_data_arr[32];
57886         CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
57887         (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
57888         uint8_t (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
57889         void* logger_ptr = untag_ptr(logger);
57890         CHECK_ACCESS(logger_ptr);
57891         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
57892         if (logger_conv.free == LDKLogger_JCalls_free) {
57893                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57894                 LDKLogger_JCalls_cloned(&logger_conv);
57895         }
57896         void* node_signer_ptr = untag_ptr(node_signer);
57897         CHECK_ACCESS(node_signer_ptr);
57898         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
57899         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
57900                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57901                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
57902         }
57903         LDKPeerManager ret_var = PeerManager_new(message_handler_conv, current_time, ephemeral_random_data_ref, logger_conv, node_signer_conv);
57904         int64_t ret_ref = 0;
57905         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57906         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57907         return ret_ref;
57908 }
57909
57910 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
57911         LDKPeerManager this_arg_conv;
57912         this_arg_conv.inner = untag_ptr(this_arg);
57913         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57915         this_arg_conv.is_owned = false;
57916         LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
57917         int64_tArray ret_arr = NULL;
57918         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
57919         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
57920         for (size_t r = 0; r < ret_var.datalen; r++) {
57921                 LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv_43_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
57922                 *ret_conv_43_conv = ret_var.data[r];
57923                 ret_arr_ptr[r] = tag_ptr(ret_conv_43_conv, true);
57924         }
57925         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
57926         FREE(ret_var.data);
57927         return ret_arr;
57928 }
57929
57930 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) {
57931         LDKPeerManager this_arg_conv;
57932         this_arg_conv.inner = untag_ptr(this_arg);
57933         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57935         this_arg_conv.is_owned = false;
57936         LDKPublicKey their_node_id_ref;
57937         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
57938         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
57939         void* descriptor_ptr = untag_ptr(descriptor);
57940         CHECK_ACCESS(descriptor_ptr);
57941         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
57942         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
57943                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57944                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
57945         }
57946         void* remote_network_address_ptr = untag_ptr(remote_network_address);
57947         CHECK_ACCESS(remote_network_address_ptr);
57948         LDKCOption_SocketAddressZ remote_network_address_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_ptr);
57949         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
57950         *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
57951         return tag_ptr(ret_conv, true);
57952 }
57953
57954 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) {
57955         LDKPeerManager this_arg_conv;
57956         this_arg_conv.inner = untag_ptr(this_arg);
57957         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57959         this_arg_conv.is_owned = false;
57960         void* descriptor_ptr = untag_ptr(descriptor);
57961         CHECK_ACCESS(descriptor_ptr);
57962         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
57963         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
57964                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57965                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
57966         }
57967         void* remote_network_address_ptr = untag_ptr(remote_network_address);
57968         CHECK_ACCESS(remote_network_address_ptr);
57969         LDKCOption_SocketAddressZ remote_network_address_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_ptr);
57970         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
57971         *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
57972         return tag_ptr(ret_conv, true);
57973 }
57974
57975 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) {
57976         LDKPeerManager this_arg_conv;
57977         this_arg_conv.inner = untag_ptr(this_arg);
57978         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57980         this_arg_conv.is_owned = false;
57981         void* descriptor_ptr = untag_ptr(descriptor);
57982         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
57983         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
57984         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
57985         *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
57986         return tag_ptr(ret_conv, true);
57987 }
57988
57989 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) {
57990         LDKPeerManager this_arg_conv;
57991         this_arg_conv.inner = untag_ptr(this_arg);
57992         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57994         this_arg_conv.is_owned = false;
57995         void* peer_descriptor_ptr = untag_ptr(peer_descriptor);
57996         if (ptr_is_owned(peer_descriptor)) { CHECK_ACCESS(peer_descriptor_ptr); }
57997         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
57998         LDKu8slice data_ref;
57999         data_ref.datalen = (*env)->GetArrayLength(env, data);
58000         data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
58001         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
58002         *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
58003         (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
58004         return tag_ptr(ret_conv, true);
58005 }
58006
58007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
58008         LDKPeerManager this_arg_conv;
58009         this_arg_conv.inner = untag_ptr(this_arg);
58010         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58012         this_arg_conv.is_owned = false;
58013         PeerManager_process_events(&this_arg_conv);
58014 }
58015
58016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
58017         LDKPeerManager this_arg_conv;
58018         this_arg_conv.inner = untag_ptr(this_arg);
58019         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58021         this_arg_conv.is_owned = false;
58022         void* descriptor_ptr = untag_ptr(descriptor);
58023         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
58024         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
58025         PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
58026 }
58027
58028 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) {
58029         LDKPeerManager this_arg_conv;
58030         this_arg_conv.inner = untag_ptr(this_arg);
58031         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58033         this_arg_conv.is_owned = false;
58034         LDKPublicKey node_id_ref;
58035         CHECK((*env)->GetArrayLength(env, node_id) == 33);
58036         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
58037         PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref);
58038 }
58039
58040 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1disconnect_1all_1peers(JNIEnv *env, jclass clz, int64_t this_arg) {
58041         LDKPeerManager this_arg_conv;
58042         this_arg_conv.inner = untag_ptr(this_arg);
58043         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58045         this_arg_conv.is_owned = false;
58046         PeerManager_disconnect_all_peers(&this_arg_conv);
58047 }
58048
58049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
58050         LDKPeerManager this_arg_conv;
58051         this_arg_conv.inner = untag_ptr(this_arg);
58052         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58054         this_arg_conv.is_owned = false;
58055         PeerManager_timer_tick_occurred(&this_arg_conv);
58056 }
58057
58058 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) {
58059         LDKPeerManager this_arg_conv;
58060         this_arg_conv.inner = untag_ptr(this_arg);
58061         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58063         this_arg_conv.is_owned = false;
58064         LDKThreeBytes rgb_ref;
58065         CHECK((*env)->GetArrayLength(env, rgb) == 3);
58066         (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
58067         LDKThirtyTwoBytes alias_ref;
58068         CHECK((*env)->GetArrayLength(env, alias) == 32);
58069         (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
58070         LDKCVec_SocketAddressZ addresses_constr;
58071         addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
58072         if (addresses_constr.datalen > 0)
58073                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
58074         else
58075                 addresses_constr.data = NULL;
58076         int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
58077         for (size_t p = 0; p < addresses_constr.datalen; p++) {
58078                 int64_t addresses_conv_15 = addresses_vals[p];
58079                 void* addresses_conv_15_ptr = untag_ptr(addresses_conv_15);
58080                 CHECK_ACCESS(addresses_conv_15_ptr);
58081                 LDKSocketAddress addresses_conv_15_conv = *(LDKSocketAddress*)(addresses_conv_15_ptr);
58082                 addresses_constr.data[p] = addresses_conv_15_conv;
58083         }
58084         (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
58085         PeerManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
58086 }
58087
58088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1success_1tx_1weight(JNIEnv *env, jclass clz, int64_t channel_type_features) {
58089         LDKChannelTypeFeatures channel_type_features_conv;
58090         channel_type_features_conv.inner = untag_ptr(channel_type_features);
58091         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
58092         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
58093         channel_type_features_conv.is_owned = false;
58094         int64_t ret_conv = htlc_success_tx_weight(&channel_type_features_conv);
58095         return ret_conv;
58096 }
58097
58098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1timeout_1tx_1weight(JNIEnv *env, jclass clz, int64_t channel_type_features) {
58099         LDKChannelTypeFeatures channel_type_features_conv;
58100         channel_type_features_conv.inner = untag_ptr(channel_type_features);
58101         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
58102         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
58103         channel_type_features_conv.is_owned = false;
58104         int64_t ret_conv = htlc_timeout_tx_weight(&channel_type_features_conv);
58105         return ret_conv;
58106 }
58107
58108 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58109         LDKHTLCClaim* orig_conv = (LDKHTLCClaim*)untag_ptr(orig);
58110         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_clone(orig_conv));
58111         return ret_conv;
58112 }
58113
58114 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1offered_1timeout(JNIEnv *env, jclass clz) {
58115         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_offered_timeout());
58116         return ret_conv;
58117 }
58118
58119 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1offered_1preimage(JNIEnv *env, jclass clz) {
58120         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_offered_preimage());
58121         return ret_conv;
58122 }
58123
58124 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1accepted_1timeout(JNIEnv *env, jclass clz) {
58125         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_accepted_timeout());
58126         return ret_conv;
58127 }
58128
58129 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1accepted_1preimage(JNIEnv *env, jclass clz) {
58130         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_accepted_preimage());
58131         return ret_conv;
58132 }
58133
58134 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1revocation(JNIEnv *env, jclass clz) {
58135         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_revocation());
58136         return ret_conv;
58137 }
58138
58139 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
58140         LDKHTLCClaim* a_conv = (LDKHTLCClaim*)untag_ptr(a);
58141         LDKHTLCClaim* b_conv = (LDKHTLCClaim*)untag_ptr(b);
58142         jboolean ret_conv = HTLCClaim_eq(a_conv, b_conv);
58143         return ret_conv;
58144 }
58145
58146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1from_1witness(JNIEnv *env, jclass clz, int8_tArray witness) {
58147         LDKWitness witness_ref;
58148         witness_ref.datalen = (*env)->GetArrayLength(env, witness);
58149         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
58150         (*env)->GetByteArrayRegion(env, witness, 0, witness_ref.datalen, witness_ref.data);
58151         witness_ref.data_is_owned = true;
58152         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
58153         *ret_copy = HTLCClaim_from_witness(witness_ref);
58154         int64_t ret_ref = tag_ptr(ret_copy, true);
58155         return ret_ref;
58156 }
58157
58158 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
58159         uint8_t commitment_seed_arr[32];
58160         CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
58161         (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
58162         uint8_t (*commitment_seed_ref)[32] = &commitment_seed_arr;
58163         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
58164         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
58165         return ret_arr;
58166 }
58167
58168 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) {
58169         LDKCVec_u8Z to_holder_script_ref;
58170         to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
58171         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
58172         (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
58173         LDKCVec_u8Z to_counterparty_script_ref;
58174         to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
58175         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
58176         (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
58177         LDKOutPoint funding_outpoint_conv;
58178         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
58179         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
58180         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
58181         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
58182         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);
58183         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
58184         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
58185         Transaction_free(ret_var);
58186         return ret_arr;
58187 }
58188
58189 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58190         LDKCounterpartyCommitmentSecrets this_obj_conv;
58191         this_obj_conv.inner = untag_ptr(this_obj);
58192         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58194         CounterpartyCommitmentSecrets_free(this_obj_conv);
58195 }
58196
58197 static inline uint64_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
58198         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
58199         int64_t ret_ref = 0;
58200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58202         return ret_ref;
58203 }
58204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58205         LDKCounterpartyCommitmentSecrets arg_conv;
58206         arg_conv.inner = untag_ptr(arg);
58207         arg_conv.is_owned = ptr_is_owned(arg);
58208         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58209         arg_conv.is_owned = false;
58210         int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
58211         return ret_conv;
58212 }
58213
58214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58215         LDKCounterpartyCommitmentSecrets orig_conv;
58216         orig_conv.inner = untag_ptr(orig);
58217         orig_conv.is_owned = ptr_is_owned(orig);
58218         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58219         orig_conv.is_owned = false;
58220         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
58221         int64_t ret_ref = 0;
58222         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58223         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58224         return ret_ref;
58225 }
58226
58227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1new(JNIEnv *env, jclass clz) {
58228         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
58229         int64_t ret_ref = 0;
58230         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58231         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58232         return ret_ref;
58233 }
58234
58235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1min_1seen_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
58236         LDKCounterpartyCommitmentSecrets this_arg_conv;
58237         this_arg_conv.inner = untag_ptr(this_arg);
58238         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58240         this_arg_conv.is_owned = false;
58241         int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
58242         return ret_conv;
58243 }
58244
58245 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) {
58246         LDKCounterpartyCommitmentSecrets this_arg_conv;
58247         this_arg_conv.inner = untag_ptr(this_arg);
58248         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58250         this_arg_conv.is_owned = false;
58251         LDKThirtyTwoBytes secret_ref;
58252         CHECK((*env)->GetArrayLength(env, secret) == 32);
58253         (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_ref.data);
58254         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
58255         *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
58256         return tag_ptr(ret_conv, true);
58257 }
58258
58259 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
58260         LDKCounterpartyCommitmentSecrets this_arg_conv;
58261         this_arg_conv.inner = untag_ptr(this_arg);
58262         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58264         this_arg_conv.is_owned = false;
58265         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
58266         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data);
58267         return ret_arr;
58268 }
58269
58270 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1write(JNIEnv *env, jclass clz, int64_t obj) {
58271         LDKCounterpartyCommitmentSecrets obj_conv;
58272         obj_conv.inner = untag_ptr(obj);
58273         obj_conv.is_owned = ptr_is_owned(obj);
58274         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58275         obj_conv.is_owned = false;
58276         LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
58277         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
58278         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
58279         CVec_u8Z_free(ret_var);
58280         return ret_arr;
58281 }
58282
58283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
58284         LDKu8slice ser_ref;
58285         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
58286         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
58287         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
58288         *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
58289         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
58290         return tag_ptr(ret_conv, true);
58291 }
58292
58293 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) {
58294         LDKPublicKey per_commitment_point_ref;
58295         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
58296         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
58297         uint8_t base_secret_arr[32];
58298         CHECK((*env)->GetArrayLength(env, base_secret) == 32);
58299         (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
58300         uint8_t (*base_secret_ref)[32] = &base_secret_arr;
58301         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
58302         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, derive_private_key(per_commitment_point_ref, base_secret_ref).bytes);
58303         return ret_arr;
58304 }
58305
58306 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) {
58307         uint8_t per_commitment_secret_arr[32];
58308         CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
58309         (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
58310         uint8_t (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
58311         uint8_t countersignatory_revocation_base_secret_arr[32];
58312         CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
58313         (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
58314         uint8_t (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
58315         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
58316         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref).bytes);
58317         return ret_arr;
58318 }
58319
58320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58321         LDKTxCreationKeys this_obj_conv;
58322         this_obj_conv.inner = untag_ptr(this_obj);
58323         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58325         TxCreationKeys_free(this_obj_conv);
58326 }
58327
58328 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
58329         LDKTxCreationKeys this_ptr_conv;
58330         this_ptr_conv.inner = untag_ptr(this_ptr);
58331         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58333         this_ptr_conv.is_owned = false;
58334         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
58335         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
58336         return ret_arr;
58337 }
58338
58339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
58340         LDKTxCreationKeys this_ptr_conv;
58341         this_ptr_conv.inner = untag_ptr(this_ptr);
58342         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58344         this_ptr_conv.is_owned = false;
58345         LDKPublicKey val_ref;
58346         CHECK((*env)->GetArrayLength(env, val) == 33);
58347         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
58348         TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
58349 }
58350
58351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
58352         LDKTxCreationKeys this_ptr_conv;
58353         this_ptr_conv.inner = untag_ptr(this_ptr);
58354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58356         this_ptr_conv.is_owned = false;
58357         LDKRevocationKey ret_var = TxCreationKeys_get_revocation_key(&this_ptr_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 void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58365         LDKTxCreationKeys this_ptr_conv;
58366         this_ptr_conv.inner = untag_ptr(this_ptr);
58367         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58369         this_ptr_conv.is_owned = false;
58370         LDKRevocationKey val_conv;
58371         val_conv.inner = untag_ptr(val);
58372         val_conv.is_owned = ptr_is_owned(val);
58373         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58374         val_conv = RevocationKey_clone(&val_conv);
58375         TxCreationKeys_set_revocation_key(&this_ptr_conv, val_conv);
58376 }
58377
58378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
58379         LDKTxCreationKeys this_ptr_conv;
58380         this_ptr_conv.inner = untag_ptr(this_ptr);
58381         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58383         this_ptr_conv.is_owned = false;
58384         LDKHtlcKey ret_var = TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv);
58385         int64_t ret_ref = 0;
58386         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58387         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58388         return ret_ref;
58389 }
58390
58391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58392         LDKTxCreationKeys this_ptr_conv;
58393         this_ptr_conv.inner = untag_ptr(this_ptr);
58394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58396         this_ptr_conv.is_owned = false;
58397         LDKHtlcKey val_conv;
58398         val_conv.inner = untag_ptr(val);
58399         val_conv.is_owned = ptr_is_owned(val);
58400         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58401         val_conv = HtlcKey_clone(&val_conv);
58402         TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_conv);
58403 }
58404
58405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
58406         LDKTxCreationKeys this_ptr_conv;
58407         this_ptr_conv.inner = untag_ptr(this_ptr);
58408         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58410         this_ptr_conv.is_owned = false;
58411         LDKHtlcKey ret_var = TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv);
58412         int64_t ret_ref = 0;
58413         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58414         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58415         return ret_ref;
58416 }
58417
58418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58419         LDKTxCreationKeys this_ptr_conv;
58420         this_ptr_conv.inner = untag_ptr(this_ptr);
58421         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58423         this_ptr_conv.is_owned = false;
58424         LDKHtlcKey val_conv;
58425         val_conv.inner = untag_ptr(val);
58426         val_conv.is_owned = ptr_is_owned(val);
58427         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58428         val_conv = HtlcKey_clone(&val_conv);
58429         TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_conv);
58430 }
58431
58432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
58433         LDKTxCreationKeys this_ptr_conv;
58434         this_ptr_conv.inner = untag_ptr(this_ptr);
58435         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58437         this_ptr_conv.is_owned = false;
58438         LDKDelayedPaymentKey ret_var = TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv);
58439         int64_t ret_ref = 0;
58440         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58441         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58442         return ret_ref;
58443 }
58444
58445 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) {
58446         LDKTxCreationKeys this_ptr_conv;
58447         this_ptr_conv.inner = untag_ptr(this_ptr);
58448         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58450         this_ptr_conv.is_owned = false;
58451         LDKDelayedPaymentKey val_conv;
58452         val_conv.inner = untag_ptr(val);
58453         val_conv.is_owned = ptr_is_owned(val);
58454         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58455         val_conv = DelayedPaymentKey_clone(&val_conv);
58456         TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_conv);
58457 }
58458
58459 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) {
58460         LDKPublicKey per_commitment_point_arg_ref;
58461         CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
58462         (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
58463         LDKRevocationKey revocation_key_arg_conv;
58464         revocation_key_arg_conv.inner = untag_ptr(revocation_key_arg);
58465         revocation_key_arg_conv.is_owned = ptr_is_owned(revocation_key_arg);
58466         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_key_arg_conv);
58467         revocation_key_arg_conv = RevocationKey_clone(&revocation_key_arg_conv);
58468         LDKHtlcKey broadcaster_htlc_key_arg_conv;
58469         broadcaster_htlc_key_arg_conv.inner = untag_ptr(broadcaster_htlc_key_arg);
58470         broadcaster_htlc_key_arg_conv.is_owned = ptr_is_owned(broadcaster_htlc_key_arg);
58471         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_htlc_key_arg_conv);
58472         broadcaster_htlc_key_arg_conv = HtlcKey_clone(&broadcaster_htlc_key_arg_conv);
58473         LDKHtlcKey countersignatory_htlc_key_arg_conv;
58474         countersignatory_htlc_key_arg_conv.inner = untag_ptr(countersignatory_htlc_key_arg);
58475         countersignatory_htlc_key_arg_conv.is_owned = ptr_is_owned(countersignatory_htlc_key_arg);
58476         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_htlc_key_arg_conv);
58477         countersignatory_htlc_key_arg_conv = HtlcKey_clone(&countersignatory_htlc_key_arg_conv);
58478         LDKDelayedPaymentKey broadcaster_delayed_payment_key_arg_conv;
58479         broadcaster_delayed_payment_key_arg_conv.inner = untag_ptr(broadcaster_delayed_payment_key_arg);
58480         broadcaster_delayed_payment_key_arg_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_key_arg);
58481         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_key_arg_conv);
58482         broadcaster_delayed_payment_key_arg_conv = DelayedPaymentKey_clone(&broadcaster_delayed_payment_key_arg_conv);
58483         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);
58484         int64_t ret_ref = 0;
58485         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58486         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58487         return ret_ref;
58488 }
58489
58490 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
58491         LDKTxCreationKeys a_conv;
58492         a_conv.inner = untag_ptr(a);
58493         a_conv.is_owned = ptr_is_owned(a);
58494         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58495         a_conv.is_owned = false;
58496         LDKTxCreationKeys b_conv;
58497         b_conv.inner = untag_ptr(b);
58498         b_conv.is_owned = ptr_is_owned(b);
58499         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58500         b_conv.is_owned = false;
58501         jboolean ret_conv = TxCreationKeys_eq(&a_conv, &b_conv);
58502         return ret_conv;
58503 }
58504
58505 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
58506         LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
58507         int64_t ret_ref = 0;
58508         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58509         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58510         return ret_ref;
58511 }
58512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58513         LDKTxCreationKeys arg_conv;
58514         arg_conv.inner = untag_ptr(arg);
58515         arg_conv.is_owned = ptr_is_owned(arg);
58516         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58517         arg_conv.is_owned = false;
58518         int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
58519         return ret_conv;
58520 }
58521
58522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58523         LDKTxCreationKeys orig_conv;
58524         orig_conv.inner = untag_ptr(orig);
58525         orig_conv.is_owned = ptr_is_owned(orig);
58526         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58527         orig_conv.is_owned = false;
58528         LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
58529         int64_t ret_ref = 0;
58530         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58531         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58532         return ret_ref;
58533 }
58534
58535 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
58536         LDKTxCreationKeys obj_conv;
58537         obj_conv.inner = untag_ptr(obj);
58538         obj_conv.is_owned = ptr_is_owned(obj);
58539         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58540         obj_conv.is_owned = false;
58541         LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
58542         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
58543         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
58544         CVec_u8Z_free(ret_var);
58545         return ret_arr;
58546 }
58547
58548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
58549         LDKu8slice ser_ref;
58550         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
58551         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
58552         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
58553         *ret_conv = TxCreationKeys_read(ser_ref);
58554         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
58555         return tag_ptr(ret_conv, true);
58556 }
58557
58558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58559         LDKChannelPublicKeys this_obj_conv;
58560         this_obj_conv.inner = untag_ptr(this_obj);
58561         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58563         ChannelPublicKeys_free(this_obj_conv);
58564 }
58565
58566 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
58567         LDKChannelPublicKeys this_ptr_conv;
58568         this_ptr_conv.inner = untag_ptr(this_ptr);
58569         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58571         this_ptr_conv.is_owned = false;
58572         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
58573         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
58574         return ret_arr;
58575 }
58576
58577 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
58578         LDKChannelPublicKeys this_ptr_conv;
58579         this_ptr_conv.inner = untag_ptr(this_ptr);
58580         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58582         this_ptr_conv.is_owned = false;
58583         LDKPublicKey val_ref;
58584         CHECK((*env)->GetArrayLength(env, val) == 33);
58585         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
58586         ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
58587 }
58588
58589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
58590         LDKChannelPublicKeys this_ptr_conv;
58591         this_ptr_conv.inner = untag_ptr(this_ptr);
58592         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58594         this_ptr_conv.is_owned = false;
58595         LDKRevocationBasepoint ret_var = ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv);
58596         int64_t ret_ref = 0;
58597         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58598         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58599         return ret_ref;
58600 }
58601
58602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58603         LDKChannelPublicKeys this_ptr_conv;
58604         this_ptr_conv.inner = untag_ptr(this_ptr);
58605         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58607         this_ptr_conv.is_owned = false;
58608         LDKRevocationBasepoint val_conv;
58609         val_conv.inner = untag_ptr(val);
58610         val_conv.is_owned = ptr_is_owned(val);
58611         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58612         val_conv = RevocationBasepoint_clone(&val_conv);
58613         ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_conv);
58614 }
58615
58616 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
58617         LDKChannelPublicKeys this_ptr_conv;
58618         this_ptr_conv.inner = untag_ptr(this_ptr);
58619         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58621         this_ptr_conv.is_owned = false;
58622         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
58623         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
58624         return ret_arr;
58625 }
58626
58627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
58628         LDKChannelPublicKeys this_ptr_conv;
58629         this_ptr_conv.inner = untag_ptr(this_ptr);
58630         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58632         this_ptr_conv.is_owned = false;
58633         LDKPublicKey val_ref;
58634         CHECK((*env)->GetArrayLength(env, val) == 33);
58635         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
58636         ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
58637 }
58638
58639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
58640         LDKChannelPublicKeys this_ptr_conv;
58641         this_ptr_conv.inner = untag_ptr(this_ptr);
58642         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58644         this_ptr_conv.is_owned = false;
58645         LDKDelayedPaymentBasepoint ret_var = ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv);
58646         int64_t ret_ref = 0;
58647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58649         return ret_ref;
58650 }
58651
58652 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58653         LDKChannelPublicKeys this_ptr_conv;
58654         this_ptr_conv.inner = untag_ptr(this_ptr);
58655         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58657         this_ptr_conv.is_owned = false;
58658         LDKDelayedPaymentBasepoint val_conv;
58659         val_conv.inner = untag_ptr(val);
58660         val_conv.is_owned = ptr_is_owned(val);
58661         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58662         val_conv = DelayedPaymentBasepoint_clone(&val_conv);
58663         ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_conv);
58664 }
58665
58666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
58667         LDKChannelPublicKeys this_ptr_conv;
58668         this_ptr_conv.inner = untag_ptr(this_ptr);
58669         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58671         this_ptr_conv.is_owned = false;
58672         LDKHtlcBasepoint ret_var = ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv);
58673         int64_t ret_ref = 0;
58674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58676         return ret_ref;
58677 }
58678
58679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58680         LDKChannelPublicKeys this_ptr_conv;
58681         this_ptr_conv.inner = untag_ptr(this_ptr);
58682         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58684         this_ptr_conv.is_owned = false;
58685         LDKHtlcBasepoint val_conv;
58686         val_conv.inner = untag_ptr(val);
58687         val_conv.is_owned = ptr_is_owned(val);
58688         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58689         val_conv = HtlcBasepoint_clone(&val_conv);
58690         ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_conv);
58691 }
58692
58693 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) {
58694         LDKPublicKey funding_pubkey_arg_ref;
58695         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
58696         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
58697         LDKRevocationBasepoint revocation_basepoint_arg_conv;
58698         revocation_basepoint_arg_conv.inner = untag_ptr(revocation_basepoint_arg);
58699         revocation_basepoint_arg_conv.is_owned = ptr_is_owned(revocation_basepoint_arg);
58700         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_basepoint_arg_conv);
58701         revocation_basepoint_arg_conv = RevocationBasepoint_clone(&revocation_basepoint_arg_conv);
58702         LDKPublicKey payment_point_arg_ref;
58703         CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
58704         (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
58705         LDKDelayedPaymentBasepoint delayed_payment_basepoint_arg_conv;
58706         delayed_payment_basepoint_arg_conv.inner = untag_ptr(delayed_payment_basepoint_arg);
58707         delayed_payment_basepoint_arg_conv.is_owned = ptr_is_owned(delayed_payment_basepoint_arg);
58708         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_basepoint_arg_conv);
58709         delayed_payment_basepoint_arg_conv = DelayedPaymentBasepoint_clone(&delayed_payment_basepoint_arg_conv);
58710         LDKHtlcBasepoint htlc_basepoint_arg_conv;
58711         htlc_basepoint_arg_conv.inner = untag_ptr(htlc_basepoint_arg);
58712         htlc_basepoint_arg_conv.is_owned = ptr_is_owned(htlc_basepoint_arg);
58713         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_basepoint_arg_conv);
58714         htlc_basepoint_arg_conv = HtlcBasepoint_clone(&htlc_basepoint_arg_conv);
58715         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);
58716         int64_t ret_ref = 0;
58717         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58718         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58719         return ret_ref;
58720 }
58721
58722 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
58723         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
58724         int64_t ret_ref = 0;
58725         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58726         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58727         return ret_ref;
58728 }
58729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58730         LDKChannelPublicKeys arg_conv;
58731         arg_conv.inner = untag_ptr(arg);
58732         arg_conv.is_owned = ptr_is_owned(arg);
58733         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58734         arg_conv.is_owned = false;
58735         int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
58736         return ret_conv;
58737 }
58738
58739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58740         LDKChannelPublicKeys orig_conv;
58741         orig_conv.inner = untag_ptr(orig);
58742         orig_conv.is_owned = ptr_is_owned(orig);
58743         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58744         orig_conv.is_owned = false;
58745         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
58746         int64_t ret_ref = 0;
58747         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58748         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58749         return ret_ref;
58750 }
58751
58752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1hash(JNIEnv *env, jclass clz, int64_t o) {
58753         LDKChannelPublicKeys o_conv;
58754         o_conv.inner = untag_ptr(o);
58755         o_conv.is_owned = ptr_is_owned(o);
58756         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
58757         o_conv.is_owned = false;
58758         int64_t ret_conv = ChannelPublicKeys_hash(&o_conv);
58759         return ret_conv;
58760 }
58761
58762 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
58763         LDKChannelPublicKeys a_conv;
58764         a_conv.inner = untag_ptr(a);
58765         a_conv.is_owned = ptr_is_owned(a);
58766         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58767         a_conv.is_owned = false;
58768         LDKChannelPublicKeys b_conv;
58769         b_conv.inner = untag_ptr(b);
58770         b_conv.is_owned = ptr_is_owned(b);
58771         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58772         b_conv.is_owned = false;
58773         jboolean ret_conv = ChannelPublicKeys_eq(&a_conv, &b_conv);
58774         return ret_conv;
58775 }
58776
58777 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
58778         LDKChannelPublicKeys obj_conv;
58779         obj_conv.inner = untag_ptr(obj);
58780         obj_conv.is_owned = ptr_is_owned(obj);
58781         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58782         obj_conv.is_owned = false;
58783         LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
58784         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
58785         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
58786         CVec_u8Z_free(ret_var);
58787         return ret_arr;
58788 }
58789
58790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
58791         LDKu8slice ser_ref;
58792         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
58793         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
58794         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
58795         *ret_conv = ChannelPublicKeys_read(ser_ref);
58796         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
58797         return tag_ptr(ret_conv, true);
58798 }
58799
58800 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) {
58801         LDKPublicKey per_commitment_point_ref;
58802         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
58803         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
58804         LDKDelayedPaymentBasepoint broadcaster_delayed_payment_base_conv;
58805         broadcaster_delayed_payment_base_conv.inner = untag_ptr(broadcaster_delayed_payment_base);
58806         broadcaster_delayed_payment_base_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_base);
58807         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_base_conv);
58808         broadcaster_delayed_payment_base_conv.is_owned = false;
58809         LDKHtlcBasepoint broadcaster_htlc_base_conv;
58810         broadcaster_htlc_base_conv.inner = untag_ptr(broadcaster_htlc_base);
58811         broadcaster_htlc_base_conv.is_owned = ptr_is_owned(broadcaster_htlc_base);
58812         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_htlc_base_conv);
58813         broadcaster_htlc_base_conv.is_owned = false;
58814         LDKRevocationBasepoint countersignatory_revocation_base_conv;
58815         countersignatory_revocation_base_conv.inner = untag_ptr(countersignatory_revocation_base);
58816         countersignatory_revocation_base_conv.is_owned = ptr_is_owned(countersignatory_revocation_base);
58817         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_revocation_base_conv);
58818         countersignatory_revocation_base_conv.is_owned = false;
58819         LDKHtlcBasepoint countersignatory_htlc_base_conv;
58820         countersignatory_htlc_base_conv.inner = untag_ptr(countersignatory_htlc_base);
58821         countersignatory_htlc_base_conv.is_owned = ptr_is_owned(countersignatory_htlc_base);
58822         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_htlc_base_conv);
58823         countersignatory_htlc_base_conv.is_owned = false;
58824         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);
58825         int64_t ret_ref = 0;
58826         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58827         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58828         return ret_ref;
58829 }
58830
58831 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) {
58832         LDKPublicKey per_commitment_point_ref;
58833         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
58834         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
58835         LDKChannelPublicKeys broadcaster_keys_conv;
58836         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
58837         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
58838         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
58839         broadcaster_keys_conv.is_owned = false;
58840         LDKChannelPublicKeys countersignatory_keys_conv;
58841         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
58842         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
58843         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
58844         countersignatory_keys_conv.is_owned = false;
58845         LDKTxCreationKeys ret_var = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
58846         int64_t ret_ref = 0;
58847         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58848         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58849         return ret_ref;
58850 }
58851
58852 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) {
58853         LDKRevocationKey revocation_key_conv;
58854         revocation_key_conv.inner = untag_ptr(revocation_key);
58855         revocation_key_conv.is_owned = ptr_is_owned(revocation_key);
58856         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_key_conv);
58857         revocation_key_conv.is_owned = false;
58858         LDKDelayedPaymentKey broadcaster_delayed_payment_key_conv;
58859         broadcaster_delayed_payment_key_conv.inner = untag_ptr(broadcaster_delayed_payment_key);
58860         broadcaster_delayed_payment_key_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_key);
58861         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_key_conv);
58862         broadcaster_delayed_payment_key_conv.is_owned = false;
58863         LDKCVec_u8Z ret_var = get_revokeable_redeemscript(&revocation_key_conv, contest_delay, &broadcaster_delayed_payment_key_conv);
58864         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
58865         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
58866         CVec_u8Z_free(ret_var);
58867         return ret_arr;
58868 }
58869
58870 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) {
58871         LDKChannelTypeFeatures channel_type_features_conv;
58872         channel_type_features_conv.inner = untag_ptr(channel_type_features);
58873         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
58874         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
58875         channel_type_features_conv.is_owned = false;
58876         LDKPublicKey payment_key_ref;
58877         CHECK((*env)->GetArrayLength(env, payment_key) == 33);
58878         (*env)->GetByteArrayRegion(env, payment_key, 0, 33, payment_key_ref.compressed_form);
58879         LDKCVec_u8Z ret_var = get_counterparty_payment_script(&channel_type_features_conv, payment_key_ref);
58880         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
58881         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
58882         CVec_u8Z_free(ret_var);
58883         return ret_arr;
58884 }
58885
58886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58887         LDKHTLCOutputInCommitment this_obj_conv;
58888         this_obj_conv.inner = untag_ptr(this_obj);
58889         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58891         HTLCOutputInCommitment_free(this_obj_conv);
58892 }
58893
58894 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
58895         LDKHTLCOutputInCommitment this_ptr_conv;
58896         this_ptr_conv.inner = untag_ptr(this_ptr);
58897         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58899         this_ptr_conv.is_owned = false;
58900         jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
58901         return ret_conv;
58902 }
58903
58904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
58905         LDKHTLCOutputInCommitment this_ptr_conv;
58906         this_ptr_conv.inner = untag_ptr(this_ptr);
58907         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58909         this_ptr_conv.is_owned = false;
58910         HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
58911 }
58912
58913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
58914         LDKHTLCOutputInCommitment this_ptr_conv;
58915         this_ptr_conv.inner = untag_ptr(this_ptr);
58916         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58918         this_ptr_conv.is_owned = false;
58919         int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
58920         return ret_conv;
58921 }
58922
58923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58924         LDKHTLCOutputInCommitment this_ptr_conv;
58925         this_ptr_conv.inner = untag_ptr(this_ptr);
58926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58928         this_ptr_conv.is_owned = false;
58929         HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
58930 }
58931
58932 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
58933         LDKHTLCOutputInCommitment this_ptr_conv;
58934         this_ptr_conv.inner = untag_ptr(this_ptr);
58935         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58937         this_ptr_conv.is_owned = false;
58938         int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
58939         return ret_conv;
58940 }
58941
58942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
58943         LDKHTLCOutputInCommitment this_ptr_conv;
58944         this_ptr_conv.inner = untag_ptr(this_ptr);
58945         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58947         this_ptr_conv.is_owned = false;
58948         HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
58949 }
58950
58951 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
58952         LDKHTLCOutputInCommitment 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         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
58958         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
58959         return ret_arr;
58960 }
58961
58962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
58963         LDKHTLCOutputInCommitment this_ptr_conv;
58964         this_ptr_conv.inner = untag_ptr(this_ptr);
58965         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58967         this_ptr_conv.is_owned = false;
58968         LDKThirtyTwoBytes val_ref;
58969         CHECK((*env)->GetArrayLength(env, val) == 32);
58970         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
58971         HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
58972 }
58973
58974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
58975         LDKHTLCOutputInCommitment this_ptr_conv;
58976         this_ptr_conv.inner = untag_ptr(this_ptr);
58977         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58979         this_ptr_conv.is_owned = false;
58980         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
58981         *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
58982         int64_t ret_ref = tag_ptr(ret_copy, true);
58983         return ret_ref;
58984 }
58985
58986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58987         LDKHTLCOutputInCommitment this_ptr_conv;
58988         this_ptr_conv.inner = untag_ptr(this_ptr);
58989         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58991         this_ptr_conv.is_owned = false;
58992         void* val_ptr = untag_ptr(val);
58993         CHECK_ACCESS(val_ptr);
58994         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
58995         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
58996         HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
58997 }
58998
58999 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) {
59000         LDKThirtyTwoBytes payment_hash_arg_ref;
59001         CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
59002         (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
59003         void* transaction_output_index_arg_ptr = untag_ptr(transaction_output_index_arg);
59004         CHECK_ACCESS(transaction_output_index_arg_ptr);
59005         LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
59006         transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(transaction_output_index_arg));
59007         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
59008         int64_t ret_ref = 0;
59009         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59010         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59011         return ret_ref;
59012 }
59013
59014 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
59015         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
59016         int64_t ret_ref = 0;
59017         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59018         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59019         return ret_ref;
59020 }
59021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59022         LDKHTLCOutputInCommitment arg_conv;
59023         arg_conv.inner = untag_ptr(arg);
59024         arg_conv.is_owned = ptr_is_owned(arg);
59025         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59026         arg_conv.is_owned = false;
59027         int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
59028         return ret_conv;
59029 }
59030
59031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59032         LDKHTLCOutputInCommitment orig_conv;
59033         orig_conv.inner = untag_ptr(orig);
59034         orig_conv.is_owned = ptr_is_owned(orig);
59035         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59036         orig_conv.is_owned = false;
59037         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
59038         int64_t ret_ref = 0;
59039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59041         return ret_ref;
59042 }
59043
59044 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
59045         LDKHTLCOutputInCommitment a_conv;
59046         a_conv.inner = untag_ptr(a);
59047         a_conv.is_owned = ptr_is_owned(a);
59048         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59049         a_conv.is_owned = false;
59050         LDKHTLCOutputInCommitment b_conv;
59051         b_conv.inner = untag_ptr(b);
59052         b_conv.is_owned = ptr_is_owned(b);
59053         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59054         b_conv.is_owned = false;
59055         jboolean ret_conv = HTLCOutputInCommitment_eq(&a_conv, &b_conv);
59056         return ret_conv;
59057 }
59058
59059 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
59060         LDKHTLCOutputInCommitment obj_conv;
59061         obj_conv.inner = untag_ptr(obj);
59062         obj_conv.is_owned = ptr_is_owned(obj);
59063         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59064         obj_conv.is_owned = false;
59065         LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
59066         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59067         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59068         CVec_u8Z_free(ret_var);
59069         return ret_arr;
59070 }
59071
59072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
59073         LDKu8slice ser_ref;
59074         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
59075         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
59076         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
59077         *ret_conv = HTLCOutputInCommitment_read(ser_ref);
59078         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
59079         return tag_ptr(ret_conv, true);
59080 }
59081
59082 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) {
59083         LDKHTLCOutputInCommitment htlc_conv;
59084         htlc_conv.inner = untag_ptr(htlc);
59085         htlc_conv.is_owned = ptr_is_owned(htlc);
59086         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
59087         htlc_conv.is_owned = false;
59088         LDKChannelTypeFeatures channel_type_features_conv;
59089         channel_type_features_conv.inner = untag_ptr(channel_type_features);
59090         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
59091         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
59092         channel_type_features_conv.is_owned = false;
59093         LDKTxCreationKeys keys_conv;
59094         keys_conv.inner = untag_ptr(keys);
59095         keys_conv.is_owned = ptr_is_owned(keys);
59096         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
59097         keys_conv.is_owned = false;
59098         LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &channel_type_features_conv, &keys_conv);
59099         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59100         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59101         CVec_u8Z_free(ret_var);
59102         return ret_arr;
59103 }
59104
59105 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
59106         LDKPublicKey broadcaster_ref;
59107         CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
59108         (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
59109         LDKPublicKey countersignatory_ref;
59110         CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
59111         (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
59112         LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
59113         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59114         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59115         CVec_u8Z_free(ret_var);
59116         return ret_arr;
59117 }
59118
59119 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) {
59120         uint8_t commitment_txid_arr[32];
59121         CHECK((*env)->GetArrayLength(env, commitment_txid) == 32);
59122         (*env)->GetByteArrayRegion(env, commitment_txid, 0, 32, commitment_txid_arr);
59123         uint8_t (*commitment_txid_ref)[32] = &commitment_txid_arr;
59124         LDKHTLCOutputInCommitment htlc_conv;
59125         htlc_conv.inner = untag_ptr(htlc);
59126         htlc_conv.is_owned = ptr_is_owned(htlc);
59127         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
59128         htlc_conv.is_owned = false;
59129         LDKChannelTypeFeatures channel_type_features_conv;
59130         channel_type_features_conv.inner = untag_ptr(channel_type_features);
59131         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
59132         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
59133         channel_type_features_conv.is_owned = false;
59134         LDKDelayedPaymentKey broadcaster_delayed_payment_key_conv;
59135         broadcaster_delayed_payment_key_conv.inner = untag_ptr(broadcaster_delayed_payment_key);
59136         broadcaster_delayed_payment_key_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_key);
59137         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_key_conv);
59138         broadcaster_delayed_payment_key_conv.is_owned = false;
59139         LDKRevocationKey revocation_key_conv;
59140         revocation_key_conv.inner = untag_ptr(revocation_key);
59141         revocation_key_conv.is_owned = ptr_is_owned(revocation_key);
59142         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_key_conv);
59143         revocation_key_conv.is_owned = false;
59144         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);
59145         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59146         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59147         Transaction_free(ret_var);
59148         return ret_arr;
59149 }
59150
59151 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) {
59152         LDKECDSASignature local_sig_ref;
59153         CHECK((*env)->GetArrayLength(env, local_sig) == 64);
59154         (*env)->GetByteArrayRegion(env, local_sig, 0, 64, local_sig_ref.compact_form);
59155         LDKECDSASignature remote_sig_ref;
59156         CHECK((*env)->GetArrayLength(env, remote_sig) == 64);
59157         (*env)->GetByteArrayRegion(env, remote_sig, 0, 64, remote_sig_ref.compact_form);
59158         void* preimage_ptr = untag_ptr(preimage);
59159         CHECK_ACCESS(preimage_ptr);
59160         LDKCOption_ThirtyTwoBytesZ preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(preimage_ptr);
59161         preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(preimage));
59162         LDKu8slice redeem_script_ref;
59163         redeem_script_ref.datalen = (*env)->GetArrayLength(env, redeem_script);
59164         redeem_script_ref.data = (*env)->GetByteArrayElements (env, redeem_script, NULL);
59165         LDKChannelTypeFeatures channel_type_features_conv;
59166         channel_type_features_conv.inner = untag_ptr(channel_type_features);
59167         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
59168         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
59169         channel_type_features_conv.is_owned = false;
59170         LDKWitness ret_var = build_htlc_input_witness(local_sig_ref, remote_sig_ref, preimage_conv, redeem_script_ref, &channel_type_features_conv);
59171         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59172         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59173         Witness_free(ret_var);
59174         (*env)->ReleaseByteArrayElements(env, redeem_script, (int8_t*)redeem_script_ref.data, 0);
59175         return ret_arr;
59176 }
59177
59178 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1to_1countersignatory_1with_1anchors_1redeemscript(JNIEnv *env, jclass clz, int8_tArray payment_point) {
59179         LDKPublicKey payment_point_ref;
59180         CHECK((*env)->GetArrayLength(env, payment_point) == 33);
59181         (*env)->GetByteArrayRegion(env, payment_point, 0, 33, payment_point_ref.compressed_form);
59182         LDKCVec_u8Z ret_var = get_to_countersignatory_with_anchors_redeemscript(payment_point_ref);
59183         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59184         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59185         CVec_u8Z_free(ret_var);
59186         return ret_arr;
59187 }
59188
59189 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1anchor_1redeemscript(JNIEnv *env, jclass clz, int8_tArray funding_pubkey) {
59190         LDKPublicKey funding_pubkey_ref;
59191         CHECK((*env)->GetArrayLength(env, funding_pubkey) == 33);
59192         (*env)->GetByteArrayRegion(env, funding_pubkey, 0, 33, funding_pubkey_ref.compressed_form);
59193         LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
59194         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59195         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59196         CVec_u8Z_free(ret_var);
59197         return ret_arr;
59198 }
59199
59200 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) {
59201         LDKPublicKey funding_key_ref;
59202         CHECK((*env)->GetArrayLength(env, funding_key) == 33);
59203         (*env)->GetByteArrayRegion(env, funding_key, 0, 33, funding_key_ref.compressed_form);
59204         LDKECDSASignature funding_sig_ref;
59205         CHECK((*env)->GetArrayLength(env, funding_sig) == 64);
59206         (*env)->GetByteArrayRegion(env, funding_sig, 0, 64, funding_sig_ref.compact_form);
59207         LDKWitness ret_var = build_anchor_input_witness(funding_key_ref, funding_sig_ref);
59208         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59209         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59210         Witness_free(ret_var);
59211         return ret_arr;
59212 }
59213
59214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59215         LDKChannelTransactionParameters this_obj_conv;
59216         this_obj_conv.inner = untag_ptr(this_obj);
59217         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59219         ChannelTransactionParameters_free(this_obj_conv);
59220 }
59221
59222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
59223         LDKChannelTransactionParameters this_ptr_conv;
59224         this_ptr_conv.inner = untag_ptr(this_ptr);
59225         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59227         this_ptr_conv.is_owned = false;
59228         LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
59229         int64_t ret_ref = 0;
59230         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59231         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59232         return ret_ref;
59233 }
59234
59235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59236         LDKChannelTransactionParameters this_ptr_conv;
59237         this_ptr_conv.inner = untag_ptr(this_ptr);
59238         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59240         this_ptr_conv.is_owned = false;
59241         LDKChannelPublicKeys val_conv;
59242         val_conv.inner = untag_ptr(val);
59243         val_conv.is_owned = ptr_is_owned(val);
59244         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59245         val_conv = ChannelPublicKeys_clone(&val_conv);
59246         ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
59247 }
59248
59249 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
59250         LDKChannelTransactionParameters this_ptr_conv;
59251         this_ptr_conv.inner = untag_ptr(this_ptr);
59252         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59254         this_ptr_conv.is_owned = false;
59255         int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
59256         return ret_conv;
59257 }
59258
59259 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) {
59260         LDKChannelTransactionParameters this_ptr_conv;
59261         this_ptr_conv.inner = untag_ptr(this_ptr);
59262         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59264         this_ptr_conv.is_owned = false;
59265         ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
59266 }
59267
59268 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
59269         LDKChannelTransactionParameters this_ptr_conv;
59270         this_ptr_conv.inner = untag_ptr(this_ptr);
59271         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59273         this_ptr_conv.is_owned = false;
59274         jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
59275         return ret_conv;
59276 }
59277
59278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
59279         LDKChannelTransactionParameters this_ptr_conv;
59280         this_ptr_conv.inner = untag_ptr(this_ptr);
59281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59283         this_ptr_conv.is_owned = false;
59284         ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
59285 }
59286
59287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
59288         LDKChannelTransactionParameters this_ptr_conv;
59289         this_ptr_conv.inner = untag_ptr(this_ptr);
59290         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59292         this_ptr_conv.is_owned = false;
59293         LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
59294         int64_t ret_ref = 0;
59295         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59296         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59297         return ret_ref;
59298 }
59299
59300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59301         LDKChannelTransactionParameters this_ptr_conv;
59302         this_ptr_conv.inner = untag_ptr(this_ptr);
59303         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59305         this_ptr_conv.is_owned = false;
59306         LDKCounterpartyChannelTransactionParameters val_conv;
59307         val_conv.inner = untag_ptr(val);
59308         val_conv.is_owned = ptr_is_owned(val);
59309         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59310         val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
59311         ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
59312 }
59313
59314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
59315         LDKChannelTransactionParameters this_ptr_conv;
59316         this_ptr_conv.inner = untag_ptr(this_ptr);
59317         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59319         this_ptr_conv.is_owned = false;
59320         LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
59321         int64_t ret_ref = 0;
59322         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59323         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59324         return ret_ref;
59325 }
59326
59327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59328         LDKChannelTransactionParameters this_ptr_conv;
59329         this_ptr_conv.inner = untag_ptr(this_ptr);
59330         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59332         this_ptr_conv.is_owned = false;
59333         LDKOutPoint val_conv;
59334         val_conv.inner = untag_ptr(val);
59335         val_conv.is_owned = ptr_is_owned(val);
59336         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59337         val_conv = OutPoint_clone(&val_conv);
59338         ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
59339 }
59340
59341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
59342         LDKChannelTransactionParameters this_ptr_conv;
59343         this_ptr_conv.inner = untag_ptr(this_ptr);
59344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59346         this_ptr_conv.is_owned = false;
59347         LDKChannelTypeFeatures ret_var = ChannelTransactionParameters_get_channel_type_features(&this_ptr_conv);
59348         int64_t ret_ref = 0;
59349         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59350         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59351         return ret_ref;
59352 }
59353
59354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59355         LDKChannelTransactionParameters this_ptr_conv;
59356         this_ptr_conv.inner = untag_ptr(this_ptr);
59357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59359         this_ptr_conv.is_owned = false;
59360         LDKChannelTypeFeatures val_conv;
59361         val_conv.inner = untag_ptr(val);
59362         val_conv.is_owned = ptr_is_owned(val);
59363         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59364         val_conv = ChannelTypeFeatures_clone(&val_conv);
59365         ChannelTransactionParameters_set_channel_type_features(&this_ptr_conv, val_conv);
59366 }
59367
59368 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) {
59369         LDKChannelPublicKeys holder_pubkeys_arg_conv;
59370         holder_pubkeys_arg_conv.inner = untag_ptr(holder_pubkeys_arg);
59371         holder_pubkeys_arg_conv.is_owned = ptr_is_owned(holder_pubkeys_arg);
59372         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
59373         holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
59374         LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
59375         counterparty_parameters_arg_conv.inner = untag_ptr(counterparty_parameters_arg);
59376         counterparty_parameters_arg_conv.is_owned = ptr_is_owned(counterparty_parameters_arg);
59377         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
59378         counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
59379         LDKOutPoint funding_outpoint_arg_conv;
59380         funding_outpoint_arg_conv.inner = untag_ptr(funding_outpoint_arg);
59381         funding_outpoint_arg_conv.is_owned = ptr_is_owned(funding_outpoint_arg);
59382         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
59383         funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
59384         LDKChannelTypeFeatures channel_type_features_arg_conv;
59385         channel_type_features_arg_conv.inner = untag_ptr(channel_type_features_arg);
59386         channel_type_features_arg_conv.is_owned = ptr_is_owned(channel_type_features_arg);
59387         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_arg_conv);
59388         channel_type_features_arg_conv = ChannelTypeFeatures_clone(&channel_type_features_arg_conv);
59389         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);
59390         int64_t ret_ref = 0;
59391         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59392         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59393         return ret_ref;
59394 }
59395
59396 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
59397         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
59398         int64_t ret_ref = 0;
59399         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59400         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59401         return ret_ref;
59402 }
59403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59404         LDKChannelTransactionParameters arg_conv;
59405         arg_conv.inner = untag_ptr(arg);
59406         arg_conv.is_owned = ptr_is_owned(arg);
59407         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59408         arg_conv.is_owned = false;
59409         int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
59410         return ret_conv;
59411 }
59412
59413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59414         LDKChannelTransactionParameters orig_conv;
59415         orig_conv.inner = untag_ptr(orig);
59416         orig_conv.is_owned = ptr_is_owned(orig);
59417         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59418         orig_conv.is_owned = false;
59419         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
59420         int64_t ret_ref = 0;
59421         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59422         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59423         return ret_ref;
59424 }
59425
59426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
59427         LDKChannelTransactionParameters o_conv;
59428         o_conv.inner = untag_ptr(o);
59429         o_conv.is_owned = ptr_is_owned(o);
59430         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59431         o_conv.is_owned = false;
59432         int64_t ret_conv = ChannelTransactionParameters_hash(&o_conv);
59433         return ret_conv;
59434 }
59435
59436 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
59437         LDKChannelTransactionParameters a_conv;
59438         a_conv.inner = untag_ptr(a);
59439         a_conv.is_owned = ptr_is_owned(a);
59440         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59441         a_conv.is_owned = false;
59442         LDKChannelTransactionParameters b_conv;
59443         b_conv.inner = untag_ptr(b);
59444         b_conv.is_owned = ptr_is_owned(b);
59445         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59446         b_conv.is_owned = false;
59447         jboolean ret_conv = ChannelTransactionParameters_eq(&a_conv, &b_conv);
59448         return ret_conv;
59449 }
59450
59451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59452         LDKCounterpartyChannelTransactionParameters this_obj_conv;
59453         this_obj_conv.inner = untag_ptr(this_obj);
59454         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59456         CounterpartyChannelTransactionParameters_free(this_obj_conv);
59457 }
59458
59459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
59460         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
59461         this_ptr_conv.inner = untag_ptr(this_ptr);
59462         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59464         this_ptr_conv.is_owned = false;
59465         LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
59466         int64_t ret_ref = 0;
59467         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59468         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59469         return ret_ref;
59470 }
59471
59472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59473         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
59474         this_ptr_conv.inner = untag_ptr(this_ptr);
59475         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59477         this_ptr_conv.is_owned = false;
59478         LDKChannelPublicKeys val_conv;
59479         val_conv.inner = untag_ptr(val);
59480         val_conv.is_owned = ptr_is_owned(val);
59481         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59482         val_conv = ChannelPublicKeys_clone(&val_conv);
59483         CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
59484 }
59485
59486 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
59487         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
59488         this_ptr_conv.inner = untag_ptr(this_ptr);
59489         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59491         this_ptr_conv.is_owned = false;
59492         int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
59493         return ret_conv;
59494 }
59495
59496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
59497         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
59498         this_ptr_conv.inner = untag_ptr(this_ptr);
59499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59501         this_ptr_conv.is_owned = false;
59502         CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
59503 }
59504
59505 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) {
59506         LDKChannelPublicKeys pubkeys_arg_conv;
59507         pubkeys_arg_conv.inner = untag_ptr(pubkeys_arg);
59508         pubkeys_arg_conv.is_owned = ptr_is_owned(pubkeys_arg);
59509         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
59510         pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
59511         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
59512         int64_t ret_ref = 0;
59513         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59514         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59515         return ret_ref;
59516 }
59517
59518 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
59519         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
59520         int64_t ret_ref = 0;
59521         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59522         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59523         return ret_ref;
59524 }
59525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59526         LDKCounterpartyChannelTransactionParameters arg_conv;
59527         arg_conv.inner = untag_ptr(arg);
59528         arg_conv.is_owned = ptr_is_owned(arg);
59529         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59530         arg_conv.is_owned = false;
59531         int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
59532         return ret_conv;
59533 }
59534
59535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59536         LDKCounterpartyChannelTransactionParameters orig_conv;
59537         orig_conv.inner = untag_ptr(orig);
59538         orig_conv.is_owned = ptr_is_owned(orig);
59539         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59540         orig_conv.is_owned = false;
59541         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
59542         int64_t ret_ref = 0;
59543         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59544         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59545         return ret_ref;
59546 }
59547
59548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
59549         LDKCounterpartyChannelTransactionParameters o_conv;
59550         o_conv.inner = untag_ptr(o);
59551         o_conv.is_owned = ptr_is_owned(o);
59552         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59553         o_conv.is_owned = false;
59554         int64_t ret_conv = CounterpartyChannelTransactionParameters_hash(&o_conv);
59555         return ret_conv;
59556 }
59557
59558 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
59559         LDKCounterpartyChannelTransactionParameters a_conv;
59560         a_conv.inner = untag_ptr(a);
59561         a_conv.is_owned = ptr_is_owned(a);
59562         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59563         a_conv.is_owned = false;
59564         LDKCounterpartyChannelTransactionParameters b_conv;
59565         b_conv.inner = untag_ptr(b);
59566         b_conv.is_owned = ptr_is_owned(b);
59567         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59568         b_conv.is_owned = false;
59569         jboolean ret_conv = CounterpartyChannelTransactionParameters_eq(&a_conv, &b_conv);
59570         return ret_conv;
59571 }
59572
59573 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
59574         LDKChannelTransactionParameters this_arg_conv;
59575         this_arg_conv.inner = untag_ptr(this_arg);
59576         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59578         this_arg_conv.is_owned = false;
59579         jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
59580         return ret_conv;
59581 }
59582
59583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
59584         LDKChannelTransactionParameters this_arg_conv;
59585         this_arg_conv.inner = untag_ptr(this_arg);
59586         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59588         this_arg_conv.is_owned = false;
59589         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
59590         int64_t ret_ref = 0;
59591         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59592         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59593         return ret_ref;
59594 }
59595
59596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
59597         LDKChannelTransactionParameters this_arg_conv;
59598         this_arg_conv.inner = untag_ptr(this_arg);
59599         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59601         this_arg_conv.is_owned = false;
59602         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
59603         int64_t ret_ref = 0;
59604         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59605         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59606         return ret_ref;
59607 }
59608
59609 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
59610         LDKCounterpartyChannelTransactionParameters obj_conv;
59611         obj_conv.inner = untag_ptr(obj);
59612         obj_conv.is_owned = ptr_is_owned(obj);
59613         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59614         obj_conv.is_owned = false;
59615         LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
59616         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59617         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59618         CVec_u8Z_free(ret_var);
59619         return ret_arr;
59620 }
59621
59622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
59623         LDKu8slice ser_ref;
59624         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
59625         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
59626         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
59627         *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
59628         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
59629         return tag_ptr(ret_conv, true);
59630 }
59631
59632 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
59633         LDKChannelTransactionParameters obj_conv;
59634         obj_conv.inner = untag_ptr(obj);
59635         obj_conv.is_owned = ptr_is_owned(obj);
59636         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59637         obj_conv.is_owned = false;
59638         LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
59639         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59640         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59641         CVec_u8Z_free(ret_var);
59642         return ret_arr;
59643 }
59644
59645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
59646         LDKu8slice ser_ref;
59647         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
59648         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
59649         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
59650         *ret_conv = ChannelTransactionParameters_read(ser_ref);
59651         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
59652         return tag_ptr(ret_conv, true);
59653 }
59654
59655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59656         LDKDirectedChannelTransactionParameters this_obj_conv;
59657         this_obj_conv.inner = untag_ptr(this_obj);
59658         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59660         DirectedChannelTransactionParameters_free(this_obj_conv);
59661 }
59662
59663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
59664         LDKDirectedChannelTransactionParameters this_arg_conv;
59665         this_arg_conv.inner = untag_ptr(this_arg);
59666         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59668         this_arg_conv.is_owned = false;
59669         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
59670         int64_t ret_ref = 0;
59671         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59672         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59673         return ret_ref;
59674 }
59675
59676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
59677         LDKDirectedChannelTransactionParameters this_arg_conv;
59678         this_arg_conv.inner = untag_ptr(this_arg);
59679         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59681         this_arg_conv.is_owned = false;
59682         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
59683         int64_t ret_ref = 0;
59684         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59685         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59686         return ret_ref;
59687 }
59688
59689 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
59690         LDKDirectedChannelTransactionParameters this_arg_conv;
59691         this_arg_conv.inner = untag_ptr(this_arg);
59692         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59694         this_arg_conv.is_owned = false;
59695         int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
59696         return ret_conv;
59697 }
59698
59699 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
59700         LDKDirectedChannelTransactionParameters this_arg_conv;
59701         this_arg_conv.inner = untag_ptr(this_arg);
59702         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59704         this_arg_conv.is_owned = false;
59705         jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
59706         return ret_conv;
59707 }
59708
59709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
59710         LDKDirectedChannelTransactionParameters this_arg_conv;
59711         this_arg_conv.inner = untag_ptr(this_arg);
59712         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59714         this_arg_conv.is_owned = false;
59715         LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
59716         int64_t ret_ref = 0;
59717         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59718         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59719         return ret_ref;
59720 }
59721
59722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
59723         LDKDirectedChannelTransactionParameters this_arg_conv;
59724         this_arg_conv.inner = untag_ptr(this_arg);
59725         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59727         this_arg_conv.is_owned = false;
59728         LDKChannelTypeFeatures ret_var = DirectedChannelTransactionParameters_channel_type_features(&this_arg_conv);
59729         int64_t ret_ref = 0;
59730         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59731         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59732         return ret_ref;
59733 }
59734
59735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59736         LDKHolderCommitmentTransaction this_obj_conv;
59737         this_obj_conv.inner = untag_ptr(this_obj);
59738         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59740         HolderCommitmentTransaction_free(this_obj_conv);
59741 }
59742
59743 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
59744         LDKHolderCommitmentTransaction this_ptr_conv;
59745         this_ptr_conv.inner = untag_ptr(this_ptr);
59746         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59748         this_ptr_conv.is_owned = false;
59749         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
59750         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
59751         return ret_arr;
59752 }
59753
59754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
59755         LDKHolderCommitmentTransaction this_ptr_conv;
59756         this_ptr_conv.inner = untag_ptr(this_ptr);
59757         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59759         this_ptr_conv.is_owned = false;
59760         LDKECDSASignature val_ref;
59761         CHECK((*env)->GetArrayLength(env, val) == 64);
59762         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
59763         HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
59764 }
59765
59766 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr) {
59767         LDKHolderCommitmentTransaction this_ptr_conv;
59768         this_ptr_conv.inner = untag_ptr(this_ptr);
59769         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59771         this_ptr_conv.is_owned = false;
59772         LDKCVec_ECDSASignatureZ ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
59773         jobjectArray ret_arr = NULL;
59774         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
59775         ;
59776         for (size_t i = 0; i < ret_var.datalen; i++) {
59777                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
59778                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
59779                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
59780         }
59781         
59782         FREE(ret_var.data);
59783         return ret_arr;
59784 }
59785
59786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
59787         LDKHolderCommitmentTransaction this_ptr_conv;
59788         this_ptr_conv.inner = untag_ptr(this_ptr);
59789         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59791         this_ptr_conv.is_owned = false;
59792         LDKCVec_ECDSASignatureZ val_constr;
59793         val_constr.datalen = (*env)->GetArrayLength(env, val);
59794         if (val_constr.datalen > 0)
59795                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
59796         else
59797                 val_constr.data = NULL;
59798         for (size_t i = 0; i < val_constr.datalen; i++) {
59799                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
59800                 LDKECDSASignature val_conv_8_ref;
59801                 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
59802                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
59803                 val_constr.data[i] = val_conv_8_ref;
59804         }
59805         HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
59806 }
59807
59808 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
59809         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
59810         int64_t ret_ref = 0;
59811         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59812         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59813         return ret_ref;
59814 }
59815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59816         LDKHolderCommitmentTransaction arg_conv;
59817         arg_conv.inner = untag_ptr(arg);
59818         arg_conv.is_owned = ptr_is_owned(arg);
59819         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59820         arg_conv.is_owned = false;
59821         int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
59822         return ret_conv;
59823 }
59824
59825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59826         LDKHolderCommitmentTransaction orig_conv;
59827         orig_conv.inner = untag_ptr(orig);
59828         orig_conv.is_owned = ptr_is_owned(orig);
59829         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59830         orig_conv.is_owned = false;
59831         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
59832         int64_t ret_ref = 0;
59833         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59834         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59835         return ret_ref;
59836 }
59837
59838 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
59839         LDKHolderCommitmentTransaction obj_conv;
59840         obj_conv.inner = untag_ptr(obj);
59841         obj_conv.is_owned = ptr_is_owned(obj);
59842         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59843         obj_conv.is_owned = false;
59844         LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
59845         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59846         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59847         CVec_u8Z_free(ret_var);
59848         return ret_arr;
59849 }
59850
59851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
59852         LDKu8slice ser_ref;
59853         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
59854         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
59855         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
59856         *ret_conv = HolderCommitmentTransaction_read(ser_ref);
59857         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
59858         return tag_ptr(ret_conv, true);
59859 }
59860
59861 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) {
59862         LDKCommitmentTransaction commitment_tx_conv;
59863         commitment_tx_conv.inner = untag_ptr(commitment_tx);
59864         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
59865         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
59866         commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
59867         LDKECDSASignature counterparty_sig_ref;
59868         CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
59869         (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
59870         LDKCVec_ECDSASignatureZ counterparty_htlc_sigs_constr;
59871         counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
59872         if (counterparty_htlc_sigs_constr.datalen > 0)
59873                 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
59874         else
59875                 counterparty_htlc_sigs_constr.data = NULL;
59876         for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
59877                 int8_tArray counterparty_htlc_sigs_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
59878                 LDKECDSASignature counterparty_htlc_sigs_conv_8_ref;
59879                 CHECK((*env)->GetArrayLength(env, counterparty_htlc_sigs_conv_8) == 64);
59880                 (*env)->GetByteArrayRegion(env, counterparty_htlc_sigs_conv_8, 0, 64, counterparty_htlc_sigs_conv_8_ref.compact_form);
59881                 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
59882         }
59883         LDKPublicKey holder_funding_key_ref;
59884         CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
59885         (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
59886         LDKPublicKey counterparty_funding_key_ref;
59887         CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
59888         (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
59889         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
59890         int64_t ret_ref = 0;
59891         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59892         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59893         return ret_ref;
59894 }
59895
59896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59897         LDKBuiltCommitmentTransaction this_obj_conv;
59898         this_obj_conv.inner = untag_ptr(this_obj);
59899         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59901         BuiltCommitmentTransaction_free(this_obj_conv);
59902 }
59903
59904 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
59905         LDKBuiltCommitmentTransaction this_ptr_conv;
59906         this_ptr_conv.inner = untag_ptr(this_ptr);
59907         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59909         this_ptr_conv.is_owned = false;
59910         LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
59911         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59912         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59913         Transaction_free(ret_var);
59914         return ret_arr;
59915 }
59916
59917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
59918         LDKBuiltCommitmentTransaction this_ptr_conv;
59919         this_ptr_conv.inner = untag_ptr(this_ptr);
59920         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59922         this_ptr_conv.is_owned = false;
59923         LDKTransaction val_ref;
59924         val_ref.datalen = (*env)->GetArrayLength(env, val);
59925         val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
59926         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
59927         val_ref.data_is_owned = true;
59928         BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
59929 }
59930
59931 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
59932         LDKBuiltCommitmentTransaction this_ptr_conv;
59933         this_ptr_conv.inner = untag_ptr(this_ptr);
59934         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59936         this_ptr_conv.is_owned = false;
59937         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
59938         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
59939         return ret_arr;
59940 }
59941
59942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
59943         LDKBuiltCommitmentTransaction 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         LDKThirtyTwoBytes val_ref;
59949         CHECK((*env)->GetArrayLength(env, val) == 32);
59950         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
59951         BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
59952 }
59953
59954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
59955         LDKTransaction transaction_arg_ref;
59956         transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
59957         transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
59958         (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
59959         transaction_arg_ref.data_is_owned = true;
59960         LDKThirtyTwoBytes txid_arg_ref;
59961         CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
59962         (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
59963         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
59964         int64_t ret_ref = 0;
59965         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59966         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59967         return ret_ref;
59968 }
59969
59970 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
59971         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
59972         int64_t ret_ref = 0;
59973         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59974         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59975         return ret_ref;
59976 }
59977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59978         LDKBuiltCommitmentTransaction arg_conv;
59979         arg_conv.inner = untag_ptr(arg);
59980         arg_conv.is_owned = ptr_is_owned(arg);
59981         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59982         arg_conv.is_owned = false;
59983         int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
59984         return ret_conv;
59985 }
59986
59987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59988         LDKBuiltCommitmentTransaction orig_conv;
59989         orig_conv.inner = untag_ptr(orig);
59990         orig_conv.is_owned = ptr_is_owned(orig);
59991         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59992         orig_conv.is_owned = false;
59993         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
59994         int64_t ret_ref = 0;
59995         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59996         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59997         return ret_ref;
59998 }
59999
60000 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
60001         LDKBuiltCommitmentTransaction obj_conv;
60002         obj_conv.inner = untag_ptr(obj);
60003         obj_conv.is_owned = ptr_is_owned(obj);
60004         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60005         obj_conv.is_owned = false;
60006         LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
60007         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60008         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60009         CVec_u8Z_free(ret_var);
60010         return ret_arr;
60011 }
60012
60013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60014         LDKu8slice ser_ref;
60015         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60016         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60017         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
60018         *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
60019         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60020         return tag_ptr(ret_conv, true);
60021 }
60022
60023 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) {
60024         LDKBuiltCommitmentTransaction this_arg_conv;
60025         this_arg_conv.inner = untag_ptr(this_arg);
60026         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60028         this_arg_conv.is_owned = false;
60029         LDKu8slice funding_redeemscript_ref;
60030         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
60031         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
60032         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
60033         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
60034         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
60035         return ret_arr;
60036 }
60037
60038 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) {
60039         LDKBuiltCommitmentTransaction this_arg_conv;
60040         this_arg_conv.inner = untag_ptr(this_arg);
60041         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60043         this_arg_conv.is_owned = false;
60044         uint8_t funding_key_arr[32];
60045         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
60046         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
60047         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
60048         LDKu8slice funding_redeemscript_ref;
60049         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
60050         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
60051         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
60052         (*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);
60053         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
60054         return ret_arr;
60055 }
60056
60057 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) {
60058         LDKBuiltCommitmentTransaction this_arg_conv;
60059         this_arg_conv.inner = untag_ptr(this_arg);
60060         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60062         this_arg_conv.is_owned = false;
60063         uint8_t funding_key_arr[32];
60064         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
60065         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
60066         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
60067         LDKu8slice funding_redeemscript_ref;
60068         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
60069         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
60070         void* entropy_source_ptr = untag_ptr(entropy_source);
60071         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
60072         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
60073         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
60074         (*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);
60075         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
60076         return ret_arr;
60077 }
60078
60079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
60080         LDKClosingTransaction this_obj_conv;
60081         this_obj_conv.inner = untag_ptr(this_obj);
60082         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60084         ClosingTransaction_free(this_obj_conv);
60085 }
60086
60087 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
60088         LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
60089         int64_t ret_ref = 0;
60090         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60091         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60092         return ret_ref;
60093 }
60094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60095         LDKClosingTransaction arg_conv;
60096         arg_conv.inner = untag_ptr(arg);
60097         arg_conv.is_owned = ptr_is_owned(arg);
60098         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60099         arg_conv.is_owned = false;
60100         int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
60101         return ret_conv;
60102 }
60103
60104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60105         LDKClosingTransaction orig_conv;
60106         orig_conv.inner = untag_ptr(orig);
60107         orig_conv.is_owned = ptr_is_owned(orig);
60108         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60109         orig_conv.is_owned = false;
60110         LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
60111         int64_t ret_ref = 0;
60112         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60113         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60114         return ret_ref;
60115 }
60116
60117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1hash(JNIEnv *env, jclass clz, int64_t o) {
60118         LDKClosingTransaction o_conv;
60119         o_conv.inner = untag_ptr(o);
60120         o_conv.is_owned = ptr_is_owned(o);
60121         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60122         o_conv.is_owned = false;
60123         int64_t ret_conv = ClosingTransaction_hash(&o_conv);
60124         return ret_conv;
60125 }
60126
60127 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
60128         LDKClosingTransaction a_conv;
60129         a_conv.inner = untag_ptr(a);
60130         a_conv.is_owned = ptr_is_owned(a);
60131         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60132         a_conv.is_owned = false;
60133         LDKClosingTransaction b_conv;
60134         b_conv.inner = untag_ptr(b);
60135         b_conv.is_owned = ptr_is_owned(b);
60136         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60137         b_conv.is_owned = false;
60138         jboolean ret_conv = ClosingTransaction_eq(&a_conv, &b_conv);
60139         return ret_conv;
60140 }
60141
60142 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) {
60143         LDKCVec_u8Z to_holder_script_ref;
60144         to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
60145         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
60146         (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
60147         LDKCVec_u8Z to_counterparty_script_ref;
60148         to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
60149         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
60150         (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
60151         LDKOutPoint funding_outpoint_conv;
60152         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
60153         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
60154         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
60155         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
60156         LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
60157         int64_t ret_ref = 0;
60158         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60159         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60160         return ret_ref;
60161 }
60162
60163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
60164         LDKClosingTransaction this_arg_conv;
60165         this_arg_conv.inner = untag_ptr(this_arg);
60166         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60168         this_arg_conv.is_owned = false;
60169         LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
60170         int64_t ret_ref = 0;
60171         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60172         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60173         return ret_ref;
60174 }
60175
60176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_outpoint) {
60177         LDKClosingTransaction this_arg_conv;
60178         this_arg_conv.inner = untag_ptr(this_arg);
60179         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60181         this_arg_conv.is_owned = false;
60182         LDKOutPoint funding_outpoint_conv;
60183         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
60184         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
60185         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
60186         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
60187         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
60188         *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
60189         return tag_ptr(ret_conv, true);
60190 }
60191
60192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
60193         LDKClosingTransaction this_arg_conv;
60194         this_arg_conv.inner = untag_ptr(this_arg);
60195         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60197         this_arg_conv.is_owned = false;
60198         int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
60199         return ret_conv;
60200 }
60201
60202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
60203         LDKClosingTransaction this_arg_conv;
60204         this_arg_conv.inner = untag_ptr(this_arg);
60205         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60207         this_arg_conv.is_owned = false;
60208         int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
60209         return ret_conv;
60210 }
60211
60212 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
60213         LDKClosingTransaction this_arg_conv;
60214         this_arg_conv.inner = untag_ptr(this_arg);
60215         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60217         this_arg_conv.is_owned = false;
60218         LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
60219         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60220         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60221         return ret_arr;
60222 }
60223
60224 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
60225         LDKClosingTransaction this_arg_conv;
60226         this_arg_conv.inner = untag_ptr(this_arg);
60227         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60229         this_arg_conv.is_owned = false;
60230         LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
60231         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60232         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60233         return ret_arr;
60234 }
60235
60236 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
60237         LDKTrustedClosingTransaction this_obj_conv;
60238         this_obj_conv.inner = untag_ptr(this_obj);
60239         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60241         TrustedClosingTransaction_free(this_obj_conv);
60242 }
60243
60244 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
60245         LDKTrustedClosingTransaction this_arg_conv;
60246         this_arg_conv.inner = untag_ptr(this_arg);
60247         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60249         this_arg_conv.is_owned = false;
60250         LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
60251         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60252         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60253         Transaction_free(ret_var);
60254         return ret_arr;
60255 }
60256
60257 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) {
60258         LDKTrustedClosingTransaction this_arg_conv;
60259         this_arg_conv.inner = untag_ptr(this_arg);
60260         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60262         this_arg_conv.is_owned = false;
60263         LDKu8slice funding_redeemscript_ref;
60264         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
60265         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
60266         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
60267         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
60268         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
60269         return ret_arr;
60270 }
60271
60272 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) {
60273         LDKTrustedClosingTransaction this_arg_conv;
60274         this_arg_conv.inner = untag_ptr(this_arg);
60275         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60277         this_arg_conv.is_owned = false;
60278         uint8_t funding_key_arr[32];
60279         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
60280         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
60281         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
60282         LDKu8slice funding_redeemscript_ref;
60283         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
60284         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
60285         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
60286         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
60287         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
60288         return ret_arr;
60289 }
60290
60291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
60292         LDKCommitmentTransaction this_obj_conv;
60293         this_obj_conv.inner = untag_ptr(this_obj);
60294         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60296         CommitmentTransaction_free(this_obj_conv);
60297 }
60298
60299 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
60300         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
60301         int64_t ret_ref = 0;
60302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60303         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60304         return ret_ref;
60305 }
60306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60307         LDKCommitmentTransaction arg_conv;
60308         arg_conv.inner = untag_ptr(arg);
60309         arg_conv.is_owned = ptr_is_owned(arg);
60310         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60311         arg_conv.is_owned = false;
60312         int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
60313         return ret_conv;
60314 }
60315
60316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60317         LDKCommitmentTransaction orig_conv;
60318         orig_conv.inner = untag_ptr(orig);
60319         orig_conv.is_owned = ptr_is_owned(orig);
60320         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60321         orig_conv.is_owned = false;
60322         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
60323         int64_t ret_ref = 0;
60324         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60325         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60326         return ret_ref;
60327 }
60328
60329 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
60330         LDKCommitmentTransaction obj_conv;
60331         obj_conv.inner = untag_ptr(obj);
60332         obj_conv.is_owned = ptr_is_owned(obj);
60333         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60334         obj_conv.is_owned = false;
60335         LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
60336         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60337         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60338         CVec_u8Z_free(ret_var);
60339         return ret_arr;
60340 }
60341
60342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60343         LDKu8slice ser_ref;
60344         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60345         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60346         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
60347         *ret_conv = CommitmentTransaction_read(ser_ref);
60348         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60349         return tag_ptr(ret_conv, true);
60350 }
60351
60352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
60353         LDKCommitmentTransaction this_arg_conv;
60354         this_arg_conv.inner = untag_ptr(this_arg);
60355         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60357         this_arg_conv.is_owned = false;
60358         int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
60359         return ret_conv;
60360 }
60361
60362 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_arg) {
60363         LDKCommitmentTransaction this_arg_conv;
60364         this_arg_conv.inner = untag_ptr(this_arg);
60365         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60367         this_arg_conv.is_owned = false;
60368         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
60369         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CommitmentTransaction_per_commitment_point(&this_arg_conv).compressed_form);
60370         return ret_arr;
60371 }
60372
60373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
60374         LDKCommitmentTransaction this_arg_conv;
60375         this_arg_conv.inner = untag_ptr(this_arg);
60376         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60378         this_arg_conv.is_owned = false;
60379         int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
60380         return ret_conv;
60381 }
60382
60383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
60384         LDKCommitmentTransaction this_arg_conv;
60385         this_arg_conv.inner = untag_ptr(this_arg);
60386         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60388         this_arg_conv.is_owned = false;
60389         int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
60390         return ret_conv;
60391 }
60392
60393 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
60394         LDKCommitmentTransaction this_arg_conv;
60395         this_arg_conv.inner = untag_ptr(this_arg);
60396         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60398         this_arg_conv.is_owned = false;
60399         int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
60400         return ret_conv;
60401 }
60402
60403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
60404         LDKCommitmentTransaction this_arg_conv;
60405         this_arg_conv.inner = untag_ptr(this_arg);
60406         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60408         this_arg_conv.is_owned = false;
60409         LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
60410         int64_t ret_ref = 0;
60411         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60412         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60413         return ret_ref;
60414 }
60415
60416 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) {
60417         LDKCommitmentTransaction this_arg_conv;
60418         this_arg_conv.inner = untag_ptr(this_arg);
60419         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60421         this_arg_conv.is_owned = false;
60422         LDKDirectedChannelTransactionParameters channel_parameters_conv;
60423         channel_parameters_conv.inner = untag_ptr(channel_parameters);
60424         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
60425         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
60426         channel_parameters_conv.is_owned = false;
60427         LDKChannelPublicKeys broadcaster_keys_conv;
60428         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
60429         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
60430         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
60431         broadcaster_keys_conv.is_owned = false;
60432         LDKChannelPublicKeys countersignatory_keys_conv;
60433         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
60434         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
60435         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
60436         countersignatory_keys_conv.is_owned = false;
60437         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
60438         *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
60439         return tag_ptr(ret_conv, true);
60440 }
60441
60442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
60443         LDKTrustedCommitmentTransaction this_obj_conv;
60444         this_obj_conv.inner = untag_ptr(this_obj);
60445         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60447         TrustedCommitmentTransaction_free(this_obj_conv);
60448 }
60449
60450 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
60451         LDKTrustedCommitmentTransaction this_arg_conv;
60452         this_arg_conv.inner = untag_ptr(this_arg);
60453         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60455         this_arg_conv.is_owned = false;
60456         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
60457         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
60458         return ret_arr;
60459 }
60460
60461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
60462         LDKTrustedCommitmentTransaction this_arg_conv;
60463         this_arg_conv.inner = untag_ptr(this_arg);
60464         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60466         this_arg_conv.is_owned = false;
60467         LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
60468         int64_t ret_ref = 0;
60469         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60470         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60471         return ret_ref;
60472 }
60473
60474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
60475         LDKTrustedCommitmentTransaction this_arg_conv;
60476         this_arg_conv.inner = untag_ptr(this_arg);
60477         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60479         this_arg_conv.is_owned = false;
60480         LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
60481         int64_t ret_ref = 0;
60482         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60483         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60484         return ret_ref;
60485 }
60486
60487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
60488         LDKTrustedCommitmentTransaction this_arg_conv;
60489         this_arg_conv.inner = untag_ptr(this_arg);
60490         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60492         this_arg_conv.is_owned = false;
60493         LDKChannelTypeFeatures ret_var = TrustedCommitmentTransaction_channel_type_features(&this_arg_conv);
60494         int64_t ret_ref = 0;
60495         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60496         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60497         return ret_ref;
60498 }
60499
60500 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) {
60501         LDKTrustedCommitmentTransaction this_arg_conv;
60502         this_arg_conv.inner = untag_ptr(this_arg);
60503         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60505         this_arg_conv.is_owned = false;
60506         uint8_t htlc_base_key_arr[32];
60507         CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
60508         (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
60509         uint8_t (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
60510         LDKDirectedChannelTransactionParameters channel_parameters_conv;
60511         channel_parameters_conv.inner = untag_ptr(channel_parameters);
60512         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
60513         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
60514         channel_parameters_conv.is_owned = false;
60515         void* entropy_source_ptr = untag_ptr(entropy_source);
60516         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
60517         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
60518         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
60519         *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv, entropy_source_conv);
60520         return tag_ptr(ret_conv, true);
60521 }
60522
60523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1revokeable_1output_1index(JNIEnv *env, jclass clz, int64_t this_arg) {
60524         LDKTrustedCommitmentTransaction this_arg_conv;
60525         this_arg_conv.inner = untag_ptr(this_arg);
60526         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60528         this_arg_conv.is_owned = false;
60529         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
60530         *ret_copy = TrustedCommitmentTransaction_revokeable_output_index(&this_arg_conv);
60531         int64_t ret_ref = tag_ptr(ret_copy, true);
60532         return ret_ref;
60533 }
60534
60535 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) {
60536         LDKTrustedCommitmentTransaction this_arg_conv;
60537         this_arg_conv.inner = untag_ptr(this_arg);
60538         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60540         this_arg_conv.is_owned = false;
60541         LDKCVec_u8Z destination_script_ref;
60542         destination_script_ref.datalen = (*env)->GetArrayLength(env, destination_script);
60543         destination_script_ref.data = MALLOC(destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
60544         (*env)->GetByteArrayRegion(env, destination_script, 0, destination_script_ref.datalen, destination_script_ref.data);
60545         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
60546         *ret_conv = TrustedCommitmentTransaction_build_to_local_justice_tx(&this_arg_conv, feerate_per_kw, destination_script_ref);
60547         return tag_ptr(ret_conv, true);
60548 }
60549
60550 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) {
60551         LDKPublicKey broadcaster_payment_basepoint_ref;
60552         CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
60553         (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
60554         LDKPublicKey countersignatory_payment_basepoint_ref;
60555         CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
60556         (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
60557         int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
60558         return ret_conv;
60559 }
60560
60561 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
60562         LDKInitFeatures a_conv;
60563         a_conv.inner = untag_ptr(a);
60564         a_conv.is_owned = ptr_is_owned(a);
60565         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60566         a_conv.is_owned = false;
60567         LDKInitFeatures b_conv;
60568         b_conv.inner = untag_ptr(b);
60569         b_conv.is_owned = ptr_is_owned(b);
60570         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60571         b_conv.is_owned = false;
60572         jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
60573         return ret_conv;
60574 }
60575
60576 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
60577         LDKNodeFeatures a_conv;
60578         a_conv.inner = untag_ptr(a);
60579         a_conv.is_owned = ptr_is_owned(a);
60580         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60581         a_conv.is_owned = false;
60582         LDKNodeFeatures b_conv;
60583         b_conv.inner = untag_ptr(b);
60584         b_conv.is_owned = ptr_is_owned(b);
60585         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60586         b_conv.is_owned = false;
60587         jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
60588         return ret_conv;
60589 }
60590
60591 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
60592         LDKChannelFeatures a_conv;
60593         a_conv.inner = untag_ptr(a);
60594         a_conv.is_owned = ptr_is_owned(a);
60595         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60596         a_conv.is_owned = false;
60597         LDKChannelFeatures b_conv;
60598         b_conv.inner = untag_ptr(b);
60599         b_conv.is_owned = ptr_is_owned(b);
60600         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60601         b_conv.is_owned = false;
60602         jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
60603         return ret_conv;
60604 }
60605
60606 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
60607         LDKBolt11InvoiceFeatures a_conv;
60608         a_conv.inner = untag_ptr(a);
60609         a_conv.is_owned = ptr_is_owned(a);
60610         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60611         a_conv.is_owned = false;
60612         LDKBolt11InvoiceFeatures b_conv;
60613         b_conv.inner = untag_ptr(b);
60614         b_conv.is_owned = ptr_is_owned(b);
60615         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60616         b_conv.is_owned = false;
60617         jboolean ret_conv = Bolt11InvoiceFeatures_eq(&a_conv, &b_conv);
60618         return ret_conv;
60619 }
60620
60621 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
60622         LDKOfferFeatures a_conv;
60623         a_conv.inner = untag_ptr(a);
60624         a_conv.is_owned = ptr_is_owned(a);
60625         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60626         a_conv.is_owned = false;
60627         LDKOfferFeatures b_conv;
60628         b_conv.inner = untag_ptr(b);
60629         b_conv.is_owned = ptr_is_owned(b);
60630         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60631         b_conv.is_owned = false;
60632         jboolean ret_conv = OfferFeatures_eq(&a_conv, &b_conv);
60633         return ret_conv;
60634 }
60635
60636 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
60637         LDKInvoiceRequestFeatures a_conv;
60638         a_conv.inner = untag_ptr(a);
60639         a_conv.is_owned = ptr_is_owned(a);
60640         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60641         a_conv.is_owned = false;
60642         LDKInvoiceRequestFeatures b_conv;
60643         b_conv.inner = untag_ptr(b);
60644         b_conv.is_owned = ptr_is_owned(b);
60645         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60646         b_conv.is_owned = false;
60647         jboolean ret_conv = InvoiceRequestFeatures_eq(&a_conv, &b_conv);
60648         return ret_conv;
60649 }
60650
60651 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
60652         LDKBolt12InvoiceFeatures a_conv;
60653         a_conv.inner = untag_ptr(a);
60654         a_conv.is_owned = ptr_is_owned(a);
60655         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60656         a_conv.is_owned = false;
60657         LDKBolt12InvoiceFeatures b_conv;
60658         b_conv.inner = untag_ptr(b);
60659         b_conv.is_owned = ptr_is_owned(b);
60660         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60661         b_conv.is_owned = false;
60662         jboolean ret_conv = Bolt12InvoiceFeatures_eq(&a_conv, &b_conv);
60663         return ret_conv;
60664 }
60665
60666 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
60667         LDKBlindedHopFeatures a_conv;
60668         a_conv.inner = untag_ptr(a);
60669         a_conv.is_owned = ptr_is_owned(a);
60670         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60671         a_conv.is_owned = false;
60672         LDKBlindedHopFeatures b_conv;
60673         b_conv.inner = untag_ptr(b);
60674         b_conv.is_owned = ptr_is_owned(b);
60675         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60676         b_conv.is_owned = false;
60677         jboolean ret_conv = BlindedHopFeatures_eq(&a_conv, &b_conv);
60678         return ret_conv;
60679 }
60680
60681 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
60682         LDKChannelTypeFeatures a_conv;
60683         a_conv.inner = untag_ptr(a);
60684         a_conv.is_owned = ptr_is_owned(a);
60685         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60686         a_conv.is_owned = false;
60687         LDKChannelTypeFeatures b_conv;
60688         b_conv.inner = untag_ptr(b);
60689         b_conv.is_owned = ptr_is_owned(b);
60690         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60691         b_conv.is_owned = false;
60692         jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
60693         return ret_conv;
60694 }
60695
60696 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
60697         LDKInitFeatures ret_var = InitFeatures_clone(arg);
60698         int64_t ret_ref = 0;
60699         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60700         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60701         return ret_ref;
60702 }
60703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60704         LDKInitFeatures arg_conv;
60705         arg_conv.inner = untag_ptr(arg);
60706         arg_conv.is_owned = ptr_is_owned(arg);
60707         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60708         arg_conv.is_owned = false;
60709         int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
60710         return ret_conv;
60711 }
60712
60713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60714         LDKInitFeatures orig_conv;
60715         orig_conv.inner = untag_ptr(orig);
60716         orig_conv.is_owned = ptr_is_owned(orig);
60717         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60718         orig_conv.is_owned = false;
60719         LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
60720         int64_t ret_ref = 0;
60721         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60722         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60723         return ret_ref;
60724 }
60725
60726 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
60727         LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
60728         int64_t ret_ref = 0;
60729         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60730         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60731         return ret_ref;
60732 }
60733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60734         LDKNodeFeatures arg_conv;
60735         arg_conv.inner = untag_ptr(arg);
60736         arg_conv.is_owned = ptr_is_owned(arg);
60737         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60738         arg_conv.is_owned = false;
60739         int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
60740         return ret_conv;
60741 }
60742
60743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60744         LDKNodeFeatures orig_conv;
60745         orig_conv.inner = untag_ptr(orig);
60746         orig_conv.is_owned = ptr_is_owned(orig);
60747         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60748         orig_conv.is_owned = false;
60749         LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
60750         int64_t ret_ref = 0;
60751         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60752         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60753         return ret_ref;
60754 }
60755
60756 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
60757         LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
60758         int64_t ret_ref = 0;
60759         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60760         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60761         return ret_ref;
60762 }
60763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60764         LDKChannelFeatures arg_conv;
60765         arg_conv.inner = untag_ptr(arg);
60766         arg_conv.is_owned = ptr_is_owned(arg);
60767         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60768         arg_conv.is_owned = false;
60769         int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
60770         return ret_conv;
60771 }
60772
60773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60774         LDKChannelFeatures orig_conv;
60775         orig_conv.inner = untag_ptr(orig);
60776         orig_conv.is_owned = ptr_is_owned(orig);
60777         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60778         orig_conv.is_owned = false;
60779         LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
60780         int64_t ret_ref = 0;
60781         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60782         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60783         return ret_ref;
60784 }
60785
60786 static inline uint64_t Bolt11InvoiceFeatures_clone_ptr(LDKBolt11InvoiceFeatures *NONNULL_PTR arg) {
60787         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(arg);
60788         int64_t ret_ref = 0;
60789         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60790         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60791         return ret_ref;
60792 }
60793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60794         LDKBolt11InvoiceFeatures arg_conv;
60795         arg_conv.inner = untag_ptr(arg);
60796         arg_conv.is_owned = ptr_is_owned(arg);
60797         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60798         arg_conv.is_owned = false;
60799         int64_t ret_conv = Bolt11InvoiceFeatures_clone_ptr(&arg_conv);
60800         return ret_conv;
60801 }
60802
60803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60804         LDKBolt11InvoiceFeatures orig_conv;
60805         orig_conv.inner = untag_ptr(orig);
60806         orig_conv.is_owned = ptr_is_owned(orig);
60807         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60808         orig_conv.is_owned = false;
60809         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(&orig_conv);
60810         int64_t ret_ref = 0;
60811         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60812         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60813         return ret_ref;
60814 }
60815
60816 static inline uint64_t OfferFeatures_clone_ptr(LDKOfferFeatures *NONNULL_PTR arg) {
60817         LDKOfferFeatures ret_var = OfferFeatures_clone(arg);
60818         int64_t ret_ref = 0;
60819         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60820         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60821         return ret_ref;
60822 }
60823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60824         LDKOfferFeatures arg_conv;
60825         arg_conv.inner = untag_ptr(arg);
60826         arg_conv.is_owned = ptr_is_owned(arg);
60827         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60828         arg_conv.is_owned = false;
60829         int64_t ret_conv = OfferFeatures_clone_ptr(&arg_conv);
60830         return ret_conv;
60831 }
60832
60833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60834         LDKOfferFeatures orig_conv;
60835         orig_conv.inner = untag_ptr(orig);
60836         orig_conv.is_owned = ptr_is_owned(orig);
60837         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60838         orig_conv.is_owned = false;
60839         LDKOfferFeatures ret_var = OfferFeatures_clone(&orig_conv);
60840         int64_t ret_ref = 0;
60841         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60842         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60843         return ret_ref;
60844 }
60845
60846 static inline uint64_t InvoiceRequestFeatures_clone_ptr(LDKInvoiceRequestFeatures *NONNULL_PTR arg) {
60847         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(arg);
60848         int64_t ret_ref = 0;
60849         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60850         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60851         return ret_ref;
60852 }
60853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60854         LDKInvoiceRequestFeatures arg_conv;
60855         arg_conv.inner = untag_ptr(arg);
60856         arg_conv.is_owned = ptr_is_owned(arg);
60857         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60858         arg_conv.is_owned = false;
60859         int64_t ret_conv = InvoiceRequestFeatures_clone_ptr(&arg_conv);
60860         return ret_conv;
60861 }
60862
60863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60864         LDKInvoiceRequestFeatures orig_conv;
60865         orig_conv.inner = untag_ptr(orig);
60866         orig_conv.is_owned = ptr_is_owned(orig);
60867         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60868         orig_conv.is_owned = false;
60869         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(&orig_conv);
60870         int64_t ret_ref = 0;
60871         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60872         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60873         return ret_ref;
60874 }
60875
60876 static inline uint64_t Bolt12InvoiceFeatures_clone_ptr(LDKBolt12InvoiceFeatures *NONNULL_PTR arg) {
60877         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(arg);
60878         int64_t ret_ref = 0;
60879         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60880         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60881         return ret_ref;
60882 }
60883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60884         LDKBolt12InvoiceFeatures arg_conv;
60885         arg_conv.inner = untag_ptr(arg);
60886         arg_conv.is_owned = ptr_is_owned(arg);
60887         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60888         arg_conv.is_owned = false;
60889         int64_t ret_conv = Bolt12InvoiceFeatures_clone_ptr(&arg_conv);
60890         return ret_conv;
60891 }
60892
60893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60894         LDKBolt12InvoiceFeatures orig_conv;
60895         orig_conv.inner = untag_ptr(orig);
60896         orig_conv.is_owned = ptr_is_owned(orig);
60897         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60898         orig_conv.is_owned = false;
60899         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(&orig_conv);
60900         int64_t ret_ref = 0;
60901         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60902         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60903         return ret_ref;
60904 }
60905
60906 static inline uint64_t BlindedHopFeatures_clone_ptr(LDKBlindedHopFeatures *NONNULL_PTR arg) {
60907         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(arg);
60908         int64_t ret_ref = 0;
60909         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60910         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60911         return ret_ref;
60912 }
60913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60914         LDKBlindedHopFeatures arg_conv;
60915         arg_conv.inner = untag_ptr(arg);
60916         arg_conv.is_owned = ptr_is_owned(arg);
60917         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60918         arg_conv.is_owned = false;
60919         int64_t ret_conv = BlindedHopFeatures_clone_ptr(&arg_conv);
60920         return ret_conv;
60921 }
60922
60923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60924         LDKBlindedHopFeatures orig_conv;
60925         orig_conv.inner = untag_ptr(orig);
60926         orig_conv.is_owned = ptr_is_owned(orig);
60927         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60928         orig_conv.is_owned = false;
60929         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(&orig_conv);
60930         int64_t ret_ref = 0;
60931         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60932         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60933         return ret_ref;
60934 }
60935
60936 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
60937         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
60938         int64_t ret_ref = 0;
60939         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60940         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60941         return ret_ref;
60942 }
60943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60944         LDKChannelTypeFeatures arg_conv;
60945         arg_conv.inner = untag_ptr(arg);
60946         arg_conv.is_owned = ptr_is_owned(arg);
60947         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60948         arg_conv.is_owned = false;
60949         int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
60950         return ret_conv;
60951 }
60952
60953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60954         LDKChannelTypeFeatures orig_conv;
60955         orig_conv.inner = untag_ptr(orig);
60956         orig_conv.is_owned = ptr_is_owned(orig);
60957         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60958         orig_conv.is_owned = false;
60959         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
60960         int64_t ret_ref = 0;
60961         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60962         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60963         return ret_ref;
60964 }
60965
60966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
60967         LDKInitFeatures o_conv;
60968         o_conv.inner = untag_ptr(o);
60969         o_conv.is_owned = ptr_is_owned(o);
60970         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60971         o_conv.is_owned = false;
60972         int64_t ret_conv = InitFeatures_hash(&o_conv);
60973         return ret_conv;
60974 }
60975
60976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
60977         LDKNodeFeatures o_conv;
60978         o_conv.inner = untag_ptr(o);
60979         o_conv.is_owned = ptr_is_owned(o);
60980         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60981         o_conv.is_owned = false;
60982         int64_t ret_conv = NodeFeatures_hash(&o_conv);
60983         return ret_conv;
60984 }
60985
60986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
60987         LDKChannelFeatures o_conv;
60988         o_conv.inner = untag_ptr(o);
60989         o_conv.is_owned = ptr_is_owned(o);
60990         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60991         o_conv.is_owned = false;
60992         int64_t ret_conv = ChannelFeatures_hash(&o_conv);
60993         return ret_conv;
60994 }
60995
60996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
60997         LDKBolt11InvoiceFeatures o_conv;
60998         o_conv.inner = untag_ptr(o);
60999         o_conv.is_owned = ptr_is_owned(o);
61000         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
61001         o_conv.is_owned = false;
61002         int64_t ret_conv = Bolt11InvoiceFeatures_hash(&o_conv);
61003         return ret_conv;
61004 }
61005
61006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
61007         LDKOfferFeatures o_conv;
61008         o_conv.inner = untag_ptr(o);
61009         o_conv.is_owned = ptr_is_owned(o);
61010         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
61011         o_conv.is_owned = false;
61012         int64_t ret_conv = OfferFeatures_hash(&o_conv);
61013         return ret_conv;
61014 }
61015
61016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
61017         LDKInvoiceRequestFeatures o_conv;
61018         o_conv.inner = untag_ptr(o);
61019         o_conv.is_owned = ptr_is_owned(o);
61020         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
61021         o_conv.is_owned = false;
61022         int64_t ret_conv = InvoiceRequestFeatures_hash(&o_conv);
61023         return ret_conv;
61024 }
61025
61026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
61027         LDKBolt12InvoiceFeatures o_conv;
61028         o_conv.inner = untag_ptr(o);
61029         o_conv.is_owned = ptr_is_owned(o);
61030         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
61031         o_conv.is_owned = false;
61032         int64_t ret_conv = Bolt12InvoiceFeatures_hash(&o_conv);
61033         return ret_conv;
61034 }
61035
61036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
61037         LDKBlindedHopFeatures o_conv;
61038         o_conv.inner = untag_ptr(o);
61039         o_conv.is_owned = ptr_is_owned(o);
61040         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
61041         o_conv.is_owned = false;
61042         int64_t ret_conv = BlindedHopFeatures_hash(&o_conv);
61043         return ret_conv;
61044 }
61045
61046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
61047         LDKChannelTypeFeatures o_conv;
61048         o_conv.inner = untag_ptr(o);
61049         o_conv.is_owned = ptr_is_owned(o);
61050         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
61051         o_conv.is_owned = false;
61052         int64_t ret_conv = ChannelTypeFeatures_hash(&o_conv);
61053         return ret_conv;
61054 }
61055
61056 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61057         LDKInitFeatures this_obj_conv;
61058         this_obj_conv.inner = untag_ptr(this_obj);
61059         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61061         InitFeatures_free(this_obj_conv);
61062 }
61063
61064 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61065         LDKNodeFeatures this_obj_conv;
61066         this_obj_conv.inner = untag_ptr(this_obj);
61067         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61069         NodeFeatures_free(this_obj_conv);
61070 }
61071
61072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61073         LDKChannelFeatures this_obj_conv;
61074         this_obj_conv.inner = untag_ptr(this_obj);
61075         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61077         ChannelFeatures_free(this_obj_conv);
61078 }
61079
61080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61081         LDKBolt11InvoiceFeatures this_obj_conv;
61082         this_obj_conv.inner = untag_ptr(this_obj);
61083         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61085         Bolt11InvoiceFeatures_free(this_obj_conv);
61086 }
61087
61088 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61089         LDKOfferFeatures this_obj_conv;
61090         this_obj_conv.inner = untag_ptr(this_obj);
61091         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61093         OfferFeatures_free(this_obj_conv);
61094 }
61095
61096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61097         LDKInvoiceRequestFeatures this_obj_conv;
61098         this_obj_conv.inner = untag_ptr(this_obj);
61099         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61101         InvoiceRequestFeatures_free(this_obj_conv);
61102 }
61103
61104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61105         LDKBolt12InvoiceFeatures this_obj_conv;
61106         this_obj_conv.inner = untag_ptr(this_obj);
61107         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61109         Bolt12InvoiceFeatures_free(this_obj_conv);
61110 }
61111
61112 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61113         LDKBlindedHopFeatures this_obj_conv;
61114         this_obj_conv.inner = untag_ptr(this_obj);
61115         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61117         BlindedHopFeatures_free(this_obj_conv);
61118 }
61119
61120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61121         LDKChannelTypeFeatures this_obj_conv;
61122         this_obj_conv.inner = untag_ptr(this_obj);
61123         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61125         ChannelTypeFeatures_free(this_obj_conv);
61126 }
61127
61128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) {
61129         LDKInitFeatures ret_var = InitFeatures_empty();
61130         int64_t ret_ref = 0;
61131         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61132         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61133         return ret_ref;
61134 }
61135
61136 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
61137         LDKInitFeatures this_arg_conv;
61138         this_arg_conv.inner = untag_ptr(this_arg);
61139         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61141         this_arg_conv.is_owned = false;
61142         LDKInitFeatures other_conv;
61143         other_conv.inner = untag_ptr(other);
61144         other_conv.is_owned = ptr_is_owned(other);
61145         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
61146         other_conv.is_owned = false;
61147         jboolean ret_conv = InitFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
61148         return ret_conv;
61149 }
61150
61151 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
61152         LDKInitFeatures this_arg_conv;
61153         this_arg_conv.inner = untag_ptr(this_arg);
61154         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61156         this_arg_conv.is_owned = false;
61157         jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
61158         return ret_conv;
61159 }
61160
61161 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) {
61162         LDKInitFeatures this_arg_conv;
61163         this_arg_conv.inner = untag_ptr(this_arg);
61164         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61166         this_arg_conv.is_owned = false;
61167         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61168         *ret_conv = InitFeatures_set_required_feature_bit(&this_arg_conv, bit);
61169         return tag_ptr(ret_conv, true);
61170 }
61171
61172 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) {
61173         LDKInitFeatures this_arg_conv;
61174         this_arg_conv.inner = untag_ptr(this_arg);
61175         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61177         this_arg_conv.is_owned = false;
61178         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61179         *ret_conv = InitFeatures_set_optional_feature_bit(&this_arg_conv, bit);
61180         return tag_ptr(ret_conv, true);
61181 }
61182
61183 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) {
61184         LDKInitFeatures this_arg_conv;
61185         this_arg_conv.inner = untag_ptr(this_arg);
61186         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61188         this_arg_conv.is_owned = false;
61189         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61190         *ret_conv = InitFeatures_set_required_custom_bit(&this_arg_conv, bit);
61191         return tag_ptr(ret_conv, true);
61192 }
61193
61194 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) {
61195         LDKInitFeatures this_arg_conv;
61196         this_arg_conv.inner = untag_ptr(this_arg);
61197         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61199         this_arg_conv.is_owned = false;
61200         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61201         *ret_conv = InitFeatures_set_optional_custom_bit(&this_arg_conv, bit);
61202         return tag_ptr(ret_conv, true);
61203 }
61204
61205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
61206         LDKNodeFeatures ret_var = NodeFeatures_empty();
61207         int64_t ret_ref = 0;
61208         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61209         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61210         return ret_ref;
61211 }
61212
61213 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
61214         LDKNodeFeatures this_arg_conv;
61215         this_arg_conv.inner = untag_ptr(this_arg);
61216         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61218         this_arg_conv.is_owned = false;
61219         LDKNodeFeatures other_conv;
61220         other_conv.inner = untag_ptr(other);
61221         other_conv.is_owned = ptr_is_owned(other);
61222         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
61223         other_conv.is_owned = false;
61224         jboolean ret_conv = NodeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
61225         return ret_conv;
61226 }
61227
61228 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
61229         LDKNodeFeatures this_arg_conv;
61230         this_arg_conv.inner = untag_ptr(this_arg);
61231         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61233         this_arg_conv.is_owned = false;
61234         jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
61235         return ret_conv;
61236 }
61237
61238 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) {
61239         LDKNodeFeatures this_arg_conv;
61240         this_arg_conv.inner = untag_ptr(this_arg);
61241         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61243         this_arg_conv.is_owned = false;
61244         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61245         *ret_conv = NodeFeatures_set_required_feature_bit(&this_arg_conv, bit);
61246         return tag_ptr(ret_conv, true);
61247 }
61248
61249 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) {
61250         LDKNodeFeatures this_arg_conv;
61251         this_arg_conv.inner = untag_ptr(this_arg);
61252         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61254         this_arg_conv.is_owned = false;
61255         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61256         *ret_conv = NodeFeatures_set_optional_feature_bit(&this_arg_conv, bit);
61257         return tag_ptr(ret_conv, true);
61258 }
61259
61260 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) {
61261         LDKNodeFeatures this_arg_conv;
61262         this_arg_conv.inner = untag_ptr(this_arg);
61263         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61265         this_arg_conv.is_owned = false;
61266         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61267         *ret_conv = NodeFeatures_set_required_custom_bit(&this_arg_conv, bit);
61268         return tag_ptr(ret_conv, true);
61269 }
61270
61271 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) {
61272         LDKNodeFeatures this_arg_conv;
61273         this_arg_conv.inner = untag_ptr(this_arg);
61274         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61276         this_arg_conv.is_owned = false;
61277         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61278         *ret_conv = NodeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
61279         return tag_ptr(ret_conv, true);
61280 }
61281
61282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
61283         LDKChannelFeatures ret_var = ChannelFeatures_empty();
61284         int64_t ret_ref = 0;
61285         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61286         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61287         return ret_ref;
61288 }
61289
61290 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
61291         LDKChannelFeatures this_arg_conv;
61292         this_arg_conv.inner = untag_ptr(this_arg);
61293         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61295         this_arg_conv.is_owned = false;
61296         LDKChannelFeatures other_conv;
61297         other_conv.inner = untag_ptr(other);
61298         other_conv.is_owned = ptr_is_owned(other);
61299         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
61300         other_conv.is_owned = false;
61301         jboolean ret_conv = ChannelFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
61302         return ret_conv;
61303 }
61304
61305 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
61306         LDKChannelFeatures this_arg_conv;
61307         this_arg_conv.inner = untag_ptr(this_arg);
61308         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61310         this_arg_conv.is_owned = false;
61311         jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
61312         return ret_conv;
61313 }
61314
61315 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) {
61316         LDKChannelFeatures this_arg_conv;
61317         this_arg_conv.inner = untag_ptr(this_arg);
61318         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61320         this_arg_conv.is_owned = false;
61321         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61322         *ret_conv = ChannelFeatures_set_required_feature_bit(&this_arg_conv, bit);
61323         return tag_ptr(ret_conv, true);
61324 }
61325
61326 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) {
61327         LDKChannelFeatures this_arg_conv;
61328         this_arg_conv.inner = untag_ptr(this_arg);
61329         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61331         this_arg_conv.is_owned = false;
61332         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61333         *ret_conv = ChannelFeatures_set_optional_feature_bit(&this_arg_conv, bit);
61334         return tag_ptr(ret_conv, true);
61335 }
61336
61337 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) {
61338         LDKChannelFeatures this_arg_conv;
61339         this_arg_conv.inner = untag_ptr(this_arg);
61340         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61342         this_arg_conv.is_owned = false;
61343         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61344         *ret_conv = ChannelFeatures_set_required_custom_bit(&this_arg_conv, bit);
61345         return tag_ptr(ret_conv, true);
61346 }
61347
61348 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) {
61349         LDKChannelFeatures this_arg_conv;
61350         this_arg_conv.inner = untag_ptr(this_arg);
61351         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61353         this_arg_conv.is_owned = false;
61354         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61355         *ret_conv = ChannelFeatures_set_optional_custom_bit(&this_arg_conv, bit);
61356         return tag_ptr(ret_conv, true);
61357 }
61358
61359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
61360         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_empty();
61361         int64_t ret_ref = 0;
61362         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61363         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61364         return ret_ref;
61365 }
61366
61367 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
61368         LDKBolt11InvoiceFeatures this_arg_conv;
61369         this_arg_conv.inner = untag_ptr(this_arg);
61370         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61372         this_arg_conv.is_owned = false;
61373         LDKBolt11InvoiceFeatures other_conv;
61374         other_conv.inner = untag_ptr(other);
61375         other_conv.is_owned = ptr_is_owned(other);
61376         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
61377         other_conv.is_owned = false;
61378         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
61379         return ret_conv;
61380 }
61381
61382 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
61383         LDKBolt11InvoiceFeatures this_arg_conv;
61384         this_arg_conv.inner = untag_ptr(this_arg);
61385         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61387         this_arg_conv.is_owned = false;
61388         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
61389         return ret_conv;
61390 }
61391
61392 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) {
61393         LDKBolt11InvoiceFeatures this_arg_conv;
61394         this_arg_conv.inner = untag_ptr(this_arg);
61395         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61397         this_arg_conv.is_owned = false;
61398         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61399         *ret_conv = Bolt11InvoiceFeatures_set_required_feature_bit(&this_arg_conv, bit);
61400         return tag_ptr(ret_conv, true);
61401 }
61402
61403 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) {
61404         LDKBolt11InvoiceFeatures this_arg_conv;
61405         this_arg_conv.inner = untag_ptr(this_arg);
61406         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61408         this_arg_conv.is_owned = false;
61409         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61410         *ret_conv = Bolt11InvoiceFeatures_set_optional_feature_bit(&this_arg_conv, bit);
61411         return tag_ptr(ret_conv, true);
61412 }
61413
61414 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) {
61415         LDKBolt11InvoiceFeatures this_arg_conv;
61416         this_arg_conv.inner = untag_ptr(this_arg);
61417         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61419         this_arg_conv.is_owned = false;
61420         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61421         *ret_conv = Bolt11InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
61422         return tag_ptr(ret_conv, true);
61423 }
61424
61425 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) {
61426         LDKBolt11InvoiceFeatures this_arg_conv;
61427         this_arg_conv.inner = untag_ptr(this_arg);
61428         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61430         this_arg_conv.is_owned = false;
61431         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61432         *ret_conv = Bolt11InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
61433         return tag_ptr(ret_conv, true);
61434 }
61435
61436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1empty(JNIEnv *env, jclass clz) {
61437         LDKOfferFeatures ret_var = OfferFeatures_empty();
61438         int64_t ret_ref = 0;
61439         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61440         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61441         return ret_ref;
61442 }
61443
61444 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
61445         LDKOfferFeatures this_arg_conv;
61446         this_arg_conv.inner = untag_ptr(this_arg);
61447         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61449         this_arg_conv.is_owned = false;
61450         LDKOfferFeatures other_conv;
61451         other_conv.inner = untag_ptr(other);
61452         other_conv.is_owned = ptr_is_owned(other);
61453         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
61454         other_conv.is_owned = false;
61455         jboolean ret_conv = OfferFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
61456         return ret_conv;
61457 }
61458
61459 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
61460         LDKOfferFeatures this_arg_conv;
61461         this_arg_conv.inner = untag_ptr(this_arg);
61462         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61464         this_arg_conv.is_owned = false;
61465         jboolean ret_conv = OfferFeatures_requires_unknown_bits(&this_arg_conv);
61466         return ret_conv;
61467 }
61468
61469 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) {
61470         LDKOfferFeatures this_arg_conv;
61471         this_arg_conv.inner = untag_ptr(this_arg);
61472         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61474         this_arg_conv.is_owned = false;
61475         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61476         *ret_conv = OfferFeatures_set_required_feature_bit(&this_arg_conv, bit);
61477         return tag_ptr(ret_conv, true);
61478 }
61479
61480 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) {
61481         LDKOfferFeatures this_arg_conv;
61482         this_arg_conv.inner = untag_ptr(this_arg);
61483         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61485         this_arg_conv.is_owned = false;
61486         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61487         *ret_conv = OfferFeatures_set_optional_feature_bit(&this_arg_conv, bit);
61488         return tag_ptr(ret_conv, true);
61489 }
61490
61491 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) {
61492         LDKOfferFeatures this_arg_conv;
61493         this_arg_conv.inner = untag_ptr(this_arg);
61494         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61496         this_arg_conv.is_owned = false;
61497         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61498         *ret_conv = OfferFeatures_set_required_custom_bit(&this_arg_conv, bit);
61499         return tag_ptr(ret_conv, true);
61500 }
61501
61502 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) {
61503         LDKOfferFeatures this_arg_conv;
61504         this_arg_conv.inner = untag_ptr(this_arg);
61505         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61507         this_arg_conv.is_owned = false;
61508         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61509         *ret_conv = OfferFeatures_set_optional_custom_bit(&this_arg_conv, bit);
61510         return tag_ptr(ret_conv, true);
61511 }
61512
61513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1empty(JNIEnv *env, jclass clz) {
61514         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_empty();
61515         int64_t ret_ref = 0;
61516         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61517         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61518         return ret_ref;
61519 }
61520
61521 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
61522         LDKInvoiceRequestFeatures this_arg_conv;
61523         this_arg_conv.inner = untag_ptr(this_arg);
61524         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61526         this_arg_conv.is_owned = false;
61527         LDKInvoiceRequestFeatures other_conv;
61528         other_conv.inner = untag_ptr(other);
61529         other_conv.is_owned = ptr_is_owned(other);
61530         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
61531         other_conv.is_owned = false;
61532         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
61533         return ret_conv;
61534 }
61535
61536 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
61537         LDKInvoiceRequestFeatures this_arg_conv;
61538         this_arg_conv.inner = untag_ptr(this_arg);
61539         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61541         this_arg_conv.is_owned = false;
61542         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits(&this_arg_conv);
61543         return ret_conv;
61544 }
61545
61546 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) {
61547         LDKInvoiceRequestFeatures this_arg_conv;
61548         this_arg_conv.inner = untag_ptr(this_arg);
61549         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61551         this_arg_conv.is_owned = false;
61552         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61553         *ret_conv = InvoiceRequestFeatures_set_required_feature_bit(&this_arg_conv, bit);
61554         return tag_ptr(ret_conv, true);
61555 }
61556
61557 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) {
61558         LDKInvoiceRequestFeatures this_arg_conv;
61559         this_arg_conv.inner = untag_ptr(this_arg);
61560         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61562         this_arg_conv.is_owned = false;
61563         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61564         *ret_conv = InvoiceRequestFeatures_set_optional_feature_bit(&this_arg_conv, bit);
61565         return tag_ptr(ret_conv, true);
61566 }
61567
61568 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) {
61569         LDKInvoiceRequestFeatures this_arg_conv;
61570         this_arg_conv.inner = untag_ptr(this_arg);
61571         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61573         this_arg_conv.is_owned = false;
61574         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61575         *ret_conv = InvoiceRequestFeatures_set_required_custom_bit(&this_arg_conv, bit);
61576         return tag_ptr(ret_conv, true);
61577 }
61578
61579 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) {
61580         LDKInvoiceRequestFeatures this_arg_conv;
61581         this_arg_conv.inner = untag_ptr(this_arg);
61582         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61584         this_arg_conv.is_owned = false;
61585         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61586         *ret_conv = InvoiceRequestFeatures_set_optional_custom_bit(&this_arg_conv, bit);
61587         return tag_ptr(ret_conv, true);
61588 }
61589
61590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
61591         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_empty();
61592         int64_t ret_ref = 0;
61593         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61594         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61595         return ret_ref;
61596 }
61597
61598 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
61599         LDKBolt12InvoiceFeatures this_arg_conv;
61600         this_arg_conv.inner = untag_ptr(this_arg);
61601         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61603         this_arg_conv.is_owned = false;
61604         LDKBolt12InvoiceFeatures other_conv;
61605         other_conv.inner = untag_ptr(other);
61606         other_conv.is_owned = ptr_is_owned(other);
61607         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
61608         other_conv.is_owned = false;
61609         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
61610         return ret_conv;
61611 }
61612
61613 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
61614         LDKBolt12InvoiceFeatures this_arg_conv;
61615         this_arg_conv.inner = untag_ptr(this_arg);
61616         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61618         this_arg_conv.is_owned = false;
61619         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
61620         return ret_conv;
61621 }
61622
61623 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) {
61624         LDKBolt12InvoiceFeatures this_arg_conv;
61625         this_arg_conv.inner = untag_ptr(this_arg);
61626         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61628         this_arg_conv.is_owned = false;
61629         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61630         *ret_conv = Bolt12InvoiceFeatures_set_required_feature_bit(&this_arg_conv, bit);
61631         return tag_ptr(ret_conv, true);
61632 }
61633
61634 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) {
61635         LDKBolt12InvoiceFeatures this_arg_conv;
61636         this_arg_conv.inner = untag_ptr(this_arg);
61637         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61639         this_arg_conv.is_owned = false;
61640         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61641         *ret_conv = Bolt12InvoiceFeatures_set_optional_feature_bit(&this_arg_conv, bit);
61642         return tag_ptr(ret_conv, true);
61643 }
61644
61645 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) {
61646         LDKBolt12InvoiceFeatures this_arg_conv;
61647         this_arg_conv.inner = untag_ptr(this_arg);
61648         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61650         this_arg_conv.is_owned = false;
61651         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61652         *ret_conv = Bolt12InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
61653         return tag_ptr(ret_conv, true);
61654 }
61655
61656 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) {
61657         LDKBolt12InvoiceFeatures this_arg_conv;
61658         this_arg_conv.inner = untag_ptr(this_arg);
61659         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61661         this_arg_conv.is_owned = false;
61662         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61663         *ret_conv = Bolt12InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
61664         return tag_ptr(ret_conv, true);
61665 }
61666
61667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1empty(JNIEnv *env, jclass clz) {
61668         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_empty();
61669         int64_t ret_ref = 0;
61670         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61671         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61672         return ret_ref;
61673 }
61674
61675 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
61676         LDKBlindedHopFeatures this_arg_conv;
61677         this_arg_conv.inner = untag_ptr(this_arg);
61678         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61680         this_arg_conv.is_owned = false;
61681         LDKBlindedHopFeatures other_conv;
61682         other_conv.inner = untag_ptr(other);
61683         other_conv.is_owned = ptr_is_owned(other);
61684         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
61685         other_conv.is_owned = false;
61686         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
61687         return ret_conv;
61688 }
61689
61690 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
61691         LDKBlindedHopFeatures this_arg_conv;
61692         this_arg_conv.inner = untag_ptr(this_arg);
61693         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61695         this_arg_conv.is_owned = false;
61696         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits(&this_arg_conv);
61697         return ret_conv;
61698 }
61699
61700 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) {
61701         LDKBlindedHopFeatures this_arg_conv;
61702         this_arg_conv.inner = untag_ptr(this_arg);
61703         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61705         this_arg_conv.is_owned = false;
61706         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61707         *ret_conv = BlindedHopFeatures_set_required_feature_bit(&this_arg_conv, bit);
61708         return tag_ptr(ret_conv, true);
61709 }
61710
61711 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) {
61712         LDKBlindedHopFeatures this_arg_conv;
61713         this_arg_conv.inner = untag_ptr(this_arg);
61714         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61716         this_arg_conv.is_owned = false;
61717         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61718         *ret_conv = BlindedHopFeatures_set_optional_feature_bit(&this_arg_conv, bit);
61719         return tag_ptr(ret_conv, true);
61720 }
61721
61722 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) {
61723         LDKBlindedHopFeatures this_arg_conv;
61724         this_arg_conv.inner = untag_ptr(this_arg);
61725         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61727         this_arg_conv.is_owned = false;
61728         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61729         *ret_conv = BlindedHopFeatures_set_required_custom_bit(&this_arg_conv, bit);
61730         return tag_ptr(ret_conv, true);
61731 }
61732
61733 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) {
61734         LDKBlindedHopFeatures this_arg_conv;
61735         this_arg_conv.inner = untag_ptr(this_arg);
61736         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61738         this_arg_conv.is_owned = false;
61739         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61740         *ret_conv = BlindedHopFeatures_set_optional_custom_bit(&this_arg_conv, bit);
61741         return tag_ptr(ret_conv, true);
61742 }
61743
61744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1empty(JNIEnv *env, jclass clz) {
61745         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
61746         int64_t ret_ref = 0;
61747         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61748         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61749         return ret_ref;
61750 }
61751
61752 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
61753         LDKChannelTypeFeatures this_arg_conv;
61754         this_arg_conv.inner = untag_ptr(this_arg);
61755         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61757         this_arg_conv.is_owned = false;
61758         LDKChannelTypeFeatures other_conv;
61759         other_conv.inner = untag_ptr(other);
61760         other_conv.is_owned = ptr_is_owned(other);
61761         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
61762         other_conv.is_owned = false;
61763         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
61764         return ret_conv;
61765 }
61766
61767 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
61768         LDKChannelTypeFeatures this_arg_conv;
61769         this_arg_conv.inner = untag_ptr(this_arg);
61770         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61772         this_arg_conv.is_owned = false;
61773         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
61774         return ret_conv;
61775 }
61776
61777 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) {
61778         LDKChannelTypeFeatures 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         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61784         *ret_conv = ChannelTypeFeatures_set_required_feature_bit(&this_arg_conv, bit);
61785         return tag_ptr(ret_conv, true);
61786 }
61787
61788 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) {
61789         LDKChannelTypeFeatures 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         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61795         *ret_conv = ChannelTypeFeatures_set_optional_feature_bit(&this_arg_conv, bit);
61796         return tag_ptr(ret_conv, true);
61797 }
61798
61799 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) {
61800         LDKChannelTypeFeatures 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         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61806         *ret_conv = ChannelTypeFeatures_set_required_custom_bit(&this_arg_conv, bit);
61807         return tag_ptr(ret_conv, true);
61808 }
61809
61810 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) {
61811         LDKChannelTypeFeatures 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         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61817         *ret_conv = ChannelTypeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
61818         return tag_ptr(ret_conv, true);
61819 }
61820
61821 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
61822         LDKInitFeatures obj_conv;
61823         obj_conv.inner = untag_ptr(obj);
61824         obj_conv.is_owned = ptr_is_owned(obj);
61825         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61826         obj_conv.is_owned = false;
61827         LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
61828         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61829         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61830         CVec_u8Z_free(ret_var);
61831         return ret_arr;
61832 }
61833
61834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61835         LDKu8slice ser_ref;
61836         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61837         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61838         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
61839         *ret_conv = InitFeatures_read(ser_ref);
61840         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61841         return tag_ptr(ret_conv, true);
61842 }
61843
61844 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
61845         LDKChannelFeatures obj_conv;
61846         obj_conv.inner = untag_ptr(obj);
61847         obj_conv.is_owned = ptr_is_owned(obj);
61848         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61849         obj_conv.is_owned = false;
61850         LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
61851         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61852         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61853         CVec_u8Z_free(ret_var);
61854         return ret_arr;
61855 }
61856
61857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61858         LDKu8slice ser_ref;
61859         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61860         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61861         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
61862         *ret_conv = ChannelFeatures_read(ser_ref);
61863         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61864         return tag_ptr(ret_conv, true);
61865 }
61866
61867 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
61868         LDKNodeFeatures obj_conv;
61869         obj_conv.inner = untag_ptr(obj);
61870         obj_conv.is_owned = ptr_is_owned(obj);
61871         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61872         obj_conv.is_owned = false;
61873         LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
61874         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61875         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61876         CVec_u8Z_free(ret_var);
61877         return ret_arr;
61878 }
61879
61880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61881         LDKu8slice ser_ref;
61882         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61883         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61884         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
61885         *ret_conv = NodeFeatures_read(ser_ref);
61886         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61887         return tag_ptr(ret_conv, true);
61888 }
61889
61890 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
61891         LDKBolt11InvoiceFeatures obj_conv;
61892         obj_conv.inner = untag_ptr(obj);
61893         obj_conv.is_owned = ptr_is_owned(obj);
61894         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61895         obj_conv.is_owned = false;
61896         LDKCVec_u8Z ret_var = Bolt11InvoiceFeatures_write(&obj_conv);
61897         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61898         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61899         CVec_u8Z_free(ret_var);
61900         return ret_arr;
61901 }
61902
61903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61904         LDKu8slice ser_ref;
61905         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61906         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61907         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
61908         *ret_conv = Bolt11InvoiceFeatures_read(ser_ref);
61909         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61910         return tag_ptr(ret_conv, true);
61911 }
61912
61913 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
61914         LDKBolt12InvoiceFeatures obj_conv;
61915         obj_conv.inner = untag_ptr(obj);
61916         obj_conv.is_owned = ptr_is_owned(obj);
61917         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61918         obj_conv.is_owned = false;
61919         LDKCVec_u8Z ret_var = Bolt12InvoiceFeatures_write(&obj_conv);
61920         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61921         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61922         CVec_u8Z_free(ret_var);
61923         return ret_arr;
61924 }
61925
61926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61927         LDKu8slice ser_ref;
61928         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61929         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61930         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
61931         *ret_conv = Bolt12InvoiceFeatures_read(ser_ref);
61932         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61933         return tag_ptr(ret_conv, true);
61934 }
61935
61936 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
61937         LDKBlindedHopFeatures obj_conv;
61938         obj_conv.inner = untag_ptr(obj);
61939         obj_conv.is_owned = ptr_is_owned(obj);
61940         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61941         obj_conv.is_owned = false;
61942         LDKCVec_u8Z ret_var = BlindedHopFeatures_write(&obj_conv);
61943         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61944         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61945         CVec_u8Z_free(ret_var);
61946         return ret_arr;
61947 }
61948
61949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61950         LDKu8slice ser_ref;
61951         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61952         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61953         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
61954         *ret_conv = BlindedHopFeatures_read(ser_ref);
61955         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61956         return tag_ptr(ret_conv, true);
61957 }
61958
61959 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
61960         LDKChannelTypeFeatures obj_conv;
61961         obj_conv.inner = untag_ptr(obj);
61962         obj_conv.is_owned = ptr_is_owned(obj);
61963         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61964         obj_conv.is_owned = false;
61965         LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
61966         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61967         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61968         CVec_u8Z_free(ret_var);
61969         return ret_arr;
61970 }
61971
61972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61973         LDKu8slice ser_ref;
61974         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61975         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61976         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
61977         *ret_conv = ChannelTypeFeatures_read(ser_ref);
61978         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61979         return tag_ptr(ret_conv, true);
61980 }
61981
61982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1data_1loss_1protect_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
61983         LDKInitFeatures this_arg_conv;
61984         this_arg_conv.inner = untag_ptr(this_arg);
61985         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61987         this_arg_conv.is_owned = false;
61988         InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
61989 }
61990
61991 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1data_1loss_1protect_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
61992         LDKInitFeatures this_arg_conv;
61993         this_arg_conv.inner = untag_ptr(this_arg);
61994         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61996         this_arg_conv.is_owned = false;
61997         InitFeatures_set_data_loss_protect_required(&this_arg_conv);
61998 }
61999
62000 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
62001         LDKInitFeatures this_arg_conv;
62002         this_arg_conv.inner = untag_ptr(this_arg);
62003         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62005         this_arg_conv.is_owned = false;
62006         jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
62007         return ret_conv;
62008 }
62009
62010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1data_1loss_1protect_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62011         LDKNodeFeatures this_arg_conv;
62012         this_arg_conv.inner = untag_ptr(this_arg);
62013         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62015         this_arg_conv.is_owned = false;
62016         NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
62017 }
62018
62019 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1data_1loss_1protect_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62020         LDKNodeFeatures this_arg_conv;
62021         this_arg_conv.inner = untag_ptr(this_arg);
62022         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62024         this_arg_conv.is_owned = false;
62025         NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
62026 }
62027
62028 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
62029         LDKNodeFeatures this_arg_conv;
62030         this_arg_conv.inner = untag_ptr(this_arg);
62031         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62033         this_arg_conv.is_owned = false;
62034         jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
62035         return ret_conv;
62036 }
62037
62038 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
62039         LDKInitFeatures this_arg_conv;
62040         this_arg_conv.inner = untag_ptr(this_arg);
62041         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62043         this_arg_conv.is_owned = false;
62044         jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
62045         return ret_conv;
62046 }
62047
62048 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
62049         LDKNodeFeatures this_arg_conv;
62050         this_arg_conv.inner = untag_ptr(this_arg);
62051         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62053         this_arg_conv.is_owned = false;
62054         jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
62055         return ret_conv;
62056 }
62057
62058 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1initial_1routing_1sync_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62059         LDKInitFeatures this_arg_conv;
62060         this_arg_conv.inner = untag_ptr(this_arg);
62061         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62063         this_arg_conv.is_owned = false;
62064         InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
62065 }
62066
62067 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1initial_1routing_1sync_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62068         LDKInitFeatures this_arg_conv;
62069         this_arg_conv.inner = untag_ptr(this_arg);
62070         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62072         this_arg_conv.is_owned = false;
62073         InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
62074 }
62075
62076 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1initial_1routing_1sync(JNIEnv *env, jclass clz, int64_t this_arg) {
62077         LDKInitFeatures this_arg_conv;
62078         this_arg_conv.inner = untag_ptr(this_arg);
62079         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62081         this_arg_conv.is_owned = false;
62082         jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
62083         return ret_conv;
62084 }
62085
62086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1upfront_1shutdown_1script_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62087         LDKInitFeatures this_arg_conv;
62088         this_arg_conv.inner = untag_ptr(this_arg);
62089         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62091         this_arg_conv.is_owned = false;
62092         InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
62093 }
62094
62095 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1upfront_1shutdown_1script_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62096         LDKInitFeatures this_arg_conv;
62097         this_arg_conv.inner = untag_ptr(this_arg);
62098         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62100         this_arg_conv.is_owned = false;
62101         InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
62102 }
62103
62104 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
62105         LDKInitFeatures this_arg_conv;
62106         this_arg_conv.inner = untag_ptr(this_arg);
62107         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62109         this_arg_conv.is_owned = false;
62110         jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
62111         return ret_conv;
62112 }
62113
62114 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1upfront_1shutdown_1script_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62115         LDKNodeFeatures this_arg_conv;
62116         this_arg_conv.inner = untag_ptr(this_arg);
62117         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62119         this_arg_conv.is_owned = false;
62120         NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
62121 }
62122
62123 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1upfront_1shutdown_1script_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62124         LDKNodeFeatures this_arg_conv;
62125         this_arg_conv.inner = untag_ptr(this_arg);
62126         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62128         this_arg_conv.is_owned = false;
62129         NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
62130 }
62131
62132 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
62133         LDKNodeFeatures this_arg_conv;
62134         this_arg_conv.inner = untag_ptr(this_arg);
62135         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62137         this_arg_conv.is_owned = false;
62138         jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
62139         return ret_conv;
62140 }
62141
62142 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
62143         LDKInitFeatures this_arg_conv;
62144         this_arg_conv.inner = untag_ptr(this_arg);
62145         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62147         this_arg_conv.is_owned = false;
62148         jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
62149         return ret_conv;
62150 }
62151
62152 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
62153         LDKNodeFeatures this_arg_conv;
62154         this_arg_conv.inner = untag_ptr(this_arg);
62155         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62157         this_arg_conv.is_owned = false;
62158         jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
62159         return ret_conv;
62160 }
62161
62162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1gossip_1queries_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62163         LDKInitFeatures this_arg_conv;
62164         this_arg_conv.inner = untag_ptr(this_arg);
62165         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62167         this_arg_conv.is_owned = false;
62168         InitFeatures_set_gossip_queries_optional(&this_arg_conv);
62169 }
62170
62171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1gossip_1queries_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62172         LDKInitFeatures this_arg_conv;
62173         this_arg_conv.inner = untag_ptr(this_arg);
62174         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62176         this_arg_conv.is_owned = false;
62177         InitFeatures_set_gossip_queries_required(&this_arg_conv);
62178 }
62179
62180 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
62181         LDKInitFeatures this_arg_conv;
62182         this_arg_conv.inner = untag_ptr(this_arg);
62183         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62185         this_arg_conv.is_owned = false;
62186         jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
62187         return ret_conv;
62188 }
62189
62190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1gossip_1queries_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62191         LDKNodeFeatures this_arg_conv;
62192         this_arg_conv.inner = untag_ptr(this_arg);
62193         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62195         this_arg_conv.is_owned = false;
62196         NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
62197 }
62198
62199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1gossip_1queries_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62200         LDKNodeFeatures this_arg_conv;
62201         this_arg_conv.inner = untag_ptr(this_arg);
62202         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62204         this_arg_conv.is_owned = false;
62205         NodeFeatures_set_gossip_queries_required(&this_arg_conv);
62206 }
62207
62208 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
62209         LDKNodeFeatures this_arg_conv;
62210         this_arg_conv.inner = untag_ptr(this_arg);
62211         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62213         this_arg_conv.is_owned = false;
62214         jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
62215         return ret_conv;
62216 }
62217
62218 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
62219         LDKInitFeatures this_arg_conv;
62220         this_arg_conv.inner = untag_ptr(this_arg);
62221         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62223         this_arg_conv.is_owned = false;
62224         jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
62225         return ret_conv;
62226 }
62227
62228 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
62229         LDKNodeFeatures this_arg_conv;
62230         this_arg_conv.inner = untag_ptr(this_arg);
62231         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62233         this_arg_conv.is_owned = false;
62234         jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
62235         return ret_conv;
62236 }
62237
62238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62239         LDKInitFeatures this_arg_conv;
62240         this_arg_conv.inner = untag_ptr(this_arg);
62241         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62243         this_arg_conv.is_owned = false;
62244         InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
62245 }
62246
62247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62248         LDKInitFeatures this_arg_conv;
62249         this_arg_conv.inner = untag_ptr(this_arg);
62250         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62252         this_arg_conv.is_owned = false;
62253         InitFeatures_set_variable_length_onion_required(&this_arg_conv);
62254 }
62255
62256 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
62257         LDKInitFeatures this_arg_conv;
62258         this_arg_conv.inner = untag_ptr(this_arg);
62259         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62261         this_arg_conv.is_owned = false;
62262         jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
62263         return ret_conv;
62264 }
62265
62266 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62267         LDKNodeFeatures this_arg_conv;
62268         this_arg_conv.inner = untag_ptr(this_arg);
62269         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62271         this_arg_conv.is_owned = false;
62272         NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
62273 }
62274
62275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62276         LDKNodeFeatures this_arg_conv;
62277         this_arg_conv.inner = untag_ptr(this_arg);
62278         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62280         this_arg_conv.is_owned = false;
62281         NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
62282 }
62283
62284 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
62285         LDKNodeFeatures this_arg_conv;
62286         this_arg_conv.inner = untag_ptr(this_arg);
62287         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62289         this_arg_conv.is_owned = false;
62290         jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
62291         return ret_conv;
62292 }
62293
62294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62295         LDKBolt11InvoiceFeatures this_arg_conv;
62296         this_arg_conv.inner = untag_ptr(this_arg);
62297         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62299         this_arg_conv.is_owned = false;
62300         Bolt11InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
62301 }
62302
62303 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62304         LDKBolt11InvoiceFeatures this_arg_conv;
62305         this_arg_conv.inner = untag_ptr(this_arg);
62306         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62308         this_arg_conv.is_owned = false;
62309         Bolt11InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
62310 }
62311
62312 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
62313         LDKBolt11InvoiceFeatures this_arg_conv;
62314         this_arg_conv.inner = untag_ptr(this_arg);
62315         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62317         this_arg_conv.is_owned = false;
62318         jboolean ret_conv = Bolt11InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
62319         return ret_conv;
62320 }
62321
62322 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
62323         LDKInitFeatures this_arg_conv;
62324         this_arg_conv.inner = untag_ptr(this_arg);
62325         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62327         this_arg_conv.is_owned = false;
62328         jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
62329         return ret_conv;
62330 }
62331
62332 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
62333         LDKNodeFeatures this_arg_conv;
62334         this_arg_conv.inner = untag_ptr(this_arg);
62335         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62337         this_arg_conv.is_owned = false;
62338         jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
62339         return ret_conv;
62340 }
62341
62342 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
62343         LDKBolt11InvoiceFeatures this_arg_conv;
62344         this_arg_conv.inner = untag_ptr(this_arg);
62345         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62347         this_arg_conv.is_owned = false;
62348         jboolean ret_conv = Bolt11InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
62349         return ret_conv;
62350 }
62351
62352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62353         LDKInitFeatures this_arg_conv;
62354         this_arg_conv.inner = untag_ptr(this_arg);
62355         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62357         this_arg_conv.is_owned = false;
62358         InitFeatures_set_static_remote_key_optional(&this_arg_conv);
62359 }
62360
62361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62362         LDKInitFeatures this_arg_conv;
62363         this_arg_conv.inner = untag_ptr(this_arg);
62364         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62366         this_arg_conv.is_owned = false;
62367         InitFeatures_set_static_remote_key_required(&this_arg_conv);
62368 }
62369
62370 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
62371         LDKInitFeatures this_arg_conv;
62372         this_arg_conv.inner = untag_ptr(this_arg);
62373         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62375         this_arg_conv.is_owned = false;
62376         jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
62377         return ret_conv;
62378 }
62379
62380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62381         LDKNodeFeatures this_arg_conv;
62382         this_arg_conv.inner = untag_ptr(this_arg);
62383         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62385         this_arg_conv.is_owned = false;
62386         NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
62387 }
62388
62389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62390         LDKNodeFeatures this_arg_conv;
62391         this_arg_conv.inner = untag_ptr(this_arg);
62392         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62394         this_arg_conv.is_owned = false;
62395         NodeFeatures_set_static_remote_key_required(&this_arg_conv);
62396 }
62397
62398 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
62399         LDKNodeFeatures this_arg_conv;
62400         this_arg_conv.inner = untag_ptr(this_arg);
62401         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62403         this_arg_conv.is_owned = false;
62404         jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
62405         return ret_conv;
62406 }
62407
62408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62409         LDKChannelTypeFeatures 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         ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
62415 }
62416
62417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62418         LDKChannelTypeFeatures 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         ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
62424 }
62425
62426 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
62427         LDKChannelTypeFeatures this_arg_conv;
62428         this_arg_conv.inner = untag_ptr(this_arg);
62429         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62431         this_arg_conv.is_owned = false;
62432         jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
62433         return ret_conv;
62434 }
62435
62436 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
62437         LDKInitFeatures this_arg_conv;
62438         this_arg_conv.inner = untag_ptr(this_arg);
62439         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62441         this_arg_conv.is_owned = false;
62442         jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
62443         return ret_conv;
62444 }
62445
62446 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
62447         LDKNodeFeatures this_arg_conv;
62448         this_arg_conv.inner = untag_ptr(this_arg);
62449         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62451         this_arg_conv.is_owned = false;
62452         jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
62453         return ret_conv;
62454 }
62455
62456 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
62457         LDKChannelTypeFeatures this_arg_conv;
62458         this_arg_conv.inner = untag_ptr(this_arg);
62459         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62461         this_arg_conv.is_owned = false;
62462         jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
62463         return ret_conv;
62464 }
62465
62466 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62467         LDKInitFeatures this_arg_conv;
62468         this_arg_conv.inner = untag_ptr(this_arg);
62469         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62471         this_arg_conv.is_owned = false;
62472         InitFeatures_set_payment_secret_optional(&this_arg_conv);
62473 }
62474
62475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62476         LDKInitFeatures this_arg_conv;
62477         this_arg_conv.inner = untag_ptr(this_arg);
62478         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62480         this_arg_conv.is_owned = false;
62481         InitFeatures_set_payment_secret_required(&this_arg_conv);
62482 }
62483
62484 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
62485         LDKInitFeatures this_arg_conv;
62486         this_arg_conv.inner = untag_ptr(this_arg);
62487         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62489         this_arg_conv.is_owned = false;
62490         jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
62491         return ret_conv;
62492 }
62493
62494 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62495         LDKNodeFeatures this_arg_conv;
62496         this_arg_conv.inner = untag_ptr(this_arg);
62497         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62499         this_arg_conv.is_owned = false;
62500         NodeFeatures_set_payment_secret_optional(&this_arg_conv);
62501 }
62502
62503 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62504         LDKNodeFeatures this_arg_conv;
62505         this_arg_conv.inner = untag_ptr(this_arg);
62506         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62508         this_arg_conv.is_owned = false;
62509         NodeFeatures_set_payment_secret_required(&this_arg_conv);
62510 }
62511
62512 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
62513         LDKNodeFeatures this_arg_conv;
62514         this_arg_conv.inner = untag_ptr(this_arg);
62515         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62517         this_arg_conv.is_owned = false;
62518         jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
62519         return ret_conv;
62520 }
62521
62522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62523         LDKBolt11InvoiceFeatures this_arg_conv;
62524         this_arg_conv.inner = untag_ptr(this_arg);
62525         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62527         this_arg_conv.is_owned = false;
62528         Bolt11InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
62529 }
62530
62531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62532         LDKBolt11InvoiceFeatures this_arg_conv;
62533         this_arg_conv.inner = untag_ptr(this_arg);
62534         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62536         this_arg_conv.is_owned = false;
62537         Bolt11InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
62538 }
62539
62540 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
62541         LDKBolt11InvoiceFeatures this_arg_conv;
62542         this_arg_conv.inner = untag_ptr(this_arg);
62543         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62545         this_arg_conv.is_owned = false;
62546         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_secret(&this_arg_conv);
62547         return ret_conv;
62548 }
62549
62550 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
62551         LDKInitFeatures this_arg_conv;
62552         this_arg_conv.inner = untag_ptr(this_arg);
62553         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62555         this_arg_conv.is_owned = false;
62556         jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
62557         return ret_conv;
62558 }
62559
62560 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
62561         LDKNodeFeatures this_arg_conv;
62562         this_arg_conv.inner = untag_ptr(this_arg);
62563         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62565         this_arg_conv.is_owned = false;
62566         jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
62567         return ret_conv;
62568 }
62569
62570 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
62571         LDKBolt11InvoiceFeatures this_arg_conv;
62572         this_arg_conv.inner = untag_ptr(this_arg);
62573         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62575         this_arg_conv.is_owned = false;
62576         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_secret(&this_arg_conv);
62577         return ret_conv;
62578 }
62579
62580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62581         LDKInitFeatures this_arg_conv;
62582         this_arg_conv.inner = untag_ptr(this_arg);
62583         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62585         this_arg_conv.is_owned = false;
62586         InitFeatures_set_basic_mpp_optional(&this_arg_conv);
62587 }
62588
62589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62590         LDKInitFeatures this_arg_conv;
62591         this_arg_conv.inner = untag_ptr(this_arg);
62592         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62594         this_arg_conv.is_owned = false;
62595         InitFeatures_set_basic_mpp_required(&this_arg_conv);
62596 }
62597
62598 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
62599         LDKInitFeatures this_arg_conv;
62600         this_arg_conv.inner = untag_ptr(this_arg);
62601         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62603         this_arg_conv.is_owned = false;
62604         jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
62605         return ret_conv;
62606 }
62607
62608 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62609         LDKNodeFeatures this_arg_conv;
62610         this_arg_conv.inner = untag_ptr(this_arg);
62611         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62613         this_arg_conv.is_owned = false;
62614         NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
62615 }
62616
62617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62618         LDKNodeFeatures this_arg_conv;
62619         this_arg_conv.inner = untag_ptr(this_arg);
62620         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62622         this_arg_conv.is_owned = false;
62623         NodeFeatures_set_basic_mpp_required(&this_arg_conv);
62624 }
62625
62626 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
62627         LDKNodeFeatures this_arg_conv;
62628         this_arg_conv.inner = untag_ptr(this_arg);
62629         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62631         this_arg_conv.is_owned = false;
62632         jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
62633         return ret_conv;
62634 }
62635
62636 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62637         LDKBolt11InvoiceFeatures 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         Bolt11InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
62643 }
62644
62645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62646         LDKBolt11InvoiceFeatures this_arg_conv;
62647         this_arg_conv.inner = untag_ptr(this_arg);
62648         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62650         this_arg_conv.is_owned = false;
62651         Bolt11InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
62652 }
62653
62654 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
62655         LDKBolt11InvoiceFeatures this_arg_conv;
62656         this_arg_conv.inner = untag_ptr(this_arg);
62657         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62659         this_arg_conv.is_owned = false;
62660         jboolean ret_conv = Bolt11InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
62661         return ret_conv;
62662 }
62663
62664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62665         LDKBolt12InvoiceFeatures this_arg_conv;
62666         this_arg_conv.inner = untag_ptr(this_arg);
62667         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62669         this_arg_conv.is_owned = false;
62670         Bolt12InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
62671 }
62672
62673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62674         LDKBolt12InvoiceFeatures this_arg_conv;
62675         this_arg_conv.inner = untag_ptr(this_arg);
62676         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62678         this_arg_conv.is_owned = false;
62679         Bolt12InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
62680 }
62681
62682 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
62683         LDKBolt12InvoiceFeatures this_arg_conv;
62684         this_arg_conv.inner = untag_ptr(this_arg);
62685         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62687         this_arg_conv.is_owned = false;
62688         jboolean ret_conv = Bolt12InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
62689         return ret_conv;
62690 }
62691
62692 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
62693         LDKInitFeatures this_arg_conv;
62694         this_arg_conv.inner = untag_ptr(this_arg);
62695         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62697         this_arg_conv.is_owned = false;
62698         jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
62699         return ret_conv;
62700 }
62701
62702 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
62703         LDKNodeFeatures this_arg_conv;
62704         this_arg_conv.inner = untag_ptr(this_arg);
62705         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62707         this_arg_conv.is_owned = false;
62708         jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
62709         return ret_conv;
62710 }
62711
62712 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
62713         LDKBolt11InvoiceFeatures this_arg_conv;
62714         this_arg_conv.inner = untag_ptr(this_arg);
62715         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62717         this_arg_conv.is_owned = false;
62718         jboolean ret_conv = Bolt11InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
62719         return ret_conv;
62720 }
62721
62722 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
62723         LDKBolt12InvoiceFeatures this_arg_conv;
62724         this_arg_conv.inner = untag_ptr(this_arg);
62725         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62727         this_arg_conv.is_owned = false;
62728         jboolean ret_conv = Bolt12InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
62729         return ret_conv;
62730 }
62731
62732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1wumbo_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62733         LDKInitFeatures this_arg_conv;
62734         this_arg_conv.inner = untag_ptr(this_arg);
62735         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62737         this_arg_conv.is_owned = false;
62738         InitFeatures_set_wumbo_optional(&this_arg_conv);
62739 }
62740
62741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1wumbo_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62742         LDKInitFeatures this_arg_conv;
62743         this_arg_conv.inner = untag_ptr(this_arg);
62744         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62746         this_arg_conv.is_owned = false;
62747         InitFeatures_set_wumbo_required(&this_arg_conv);
62748 }
62749
62750 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
62751         LDKInitFeatures this_arg_conv;
62752         this_arg_conv.inner = untag_ptr(this_arg);
62753         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62755         this_arg_conv.is_owned = false;
62756         jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
62757         return ret_conv;
62758 }
62759
62760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1wumbo_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62761         LDKNodeFeatures this_arg_conv;
62762         this_arg_conv.inner = untag_ptr(this_arg);
62763         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62765         this_arg_conv.is_owned = false;
62766         NodeFeatures_set_wumbo_optional(&this_arg_conv);
62767 }
62768
62769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1wumbo_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62770         LDKNodeFeatures this_arg_conv;
62771         this_arg_conv.inner = untag_ptr(this_arg);
62772         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62774         this_arg_conv.is_owned = false;
62775         NodeFeatures_set_wumbo_required(&this_arg_conv);
62776 }
62777
62778 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
62779         LDKNodeFeatures this_arg_conv;
62780         this_arg_conv.inner = untag_ptr(this_arg);
62781         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62783         this_arg_conv.is_owned = false;
62784         jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
62785         return ret_conv;
62786 }
62787
62788 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
62789         LDKInitFeatures this_arg_conv;
62790         this_arg_conv.inner = untag_ptr(this_arg);
62791         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62793         this_arg_conv.is_owned = false;
62794         jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
62795         return ret_conv;
62796 }
62797
62798 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
62799         LDKNodeFeatures this_arg_conv;
62800         this_arg_conv.inner = untag_ptr(this_arg);
62801         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62803         this_arg_conv.is_owned = false;
62804         jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
62805         return ret_conv;
62806 }
62807
62808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62809         LDKInitFeatures this_arg_conv;
62810         this_arg_conv.inner = untag_ptr(this_arg);
62811         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62813         this_arg_conv.is_owned = false;
62814         InitFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
62815 }
62816
62817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62818         LDKInitFeatures this_arg_conv;
62819         this_arg_conv.inner = untag_ptr(this_arg);
62820         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62822         this_arg_conv.is_owned = false;
62823         InitFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
62824 }
62825
62826 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
62827         LDKInitFeatures this_arg_conv;
62828         this_arg_conv.inner = untag_ptr(this_arg);
62829         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62831         this_arg_conv.is_owned = false;
62832         jboolean ret_conv = InitFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
62833         return ret_conv;
62834 }
62835
62836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62837         LDKNodeFeatures this_arg_conv;
62838         this_arg_conv.inner = untag_ptr(this_arg);
62839         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62841         this_arg_conv.is_owned = false;
62842         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
62843 }
62844
62845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62846         LDKNodeFeatures this_arg_conv;
62847         this_arg_conv.inner = untag_ptr(this_arg);
62848         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62850         this_arg_conv.is_owned = false;
62851         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
62852 }
62853
62854 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
62855         LDKNodeFeatures this_arg_conv;
62856         this_arg_conv.inner = untag_ptr(this_arg);
62857         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62859         this_arg_conv.is_owned = false;
62860         jboolean ret_conv = NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
62861         return ret_conv;
62862 }
62863
62864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62865         LDKChannelTypeFeatures this_arg_conv;
62866         this_arg_conv.inner = untag_ptr(this_arg);
62867         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62869         this_arg_conv.is_owned = false;
62870         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
62871 }
62872
62873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62874         LDKChannelTypeFeatures this_arg_conv;
62875         this_arg_conv.inner = untag_ptr(this_arg);
62876         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62878         this_arg_conv.is_owned = false;
62879         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
62880 }
62881
62882 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
62883         LDKChannelTypeFeatures this_arg_conv;
62884         this_arg_conv.inner = untag_ptr(this_arg);
62885         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62887         this_arg_conv.is_owned = false;
62888         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
62889         return ret_conv;
62890 }
62891
62892 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
62893         LDKInitFeatures this_arg_conv;
62894         this_arg_conv.inner = untag_ptr(this_arg);
62895         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62897         this_arg_conv.is_owned = false;
62898         jboolean ret_conv = InitFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
62899         return ret_conv;
62900 }
62901
62902 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
62903         LDKNodeFeatures this_arg_conv;
62904         this_arg_conv.inner = untag_ptr(this_arg);
62905         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62907         this_arg_conv.is_owned = false;
62908         jboolean ret_conv = NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
62909         return ret_conv;
62910 }
62911
62912 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
62913         LDKChannelTypeFeatures this_arg_conv;
62914         this_arg_conv.inner = untag_ptr(this_arg);
62915         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62917         this_arg_conv.is_owned = false;
62918         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
62919         return ret_conv;
62920 }
62921
62922 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62923         LDKInitFeatures this_arg_conv;
62924         this_arg_conv.inner = untag_ptr(this_arg);
62925         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62927         this_arg_conv.is_owned = false;
62928         InitFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
62929 }
62930
62931 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62932         LDKInitFeatures this_arg_conv;
62933         this_arg_conv.inner = untag_ptr(this_arg);
62934         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62936         this_arg_conv.is_owned = false;
62937         InitFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
62938 }
62939
62940 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
62941         LDKInitFeatures this_arg_conv;
62942         this_arg_conv.inner = untag_ptr(this_arg);
62943         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62945         this_arg_conv.is_owned = false;
62946         jboolean ret_conv = InitFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
62947         return ret_conv;
62948 }
62949
62950 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62951         LDKNodeFeatures this_arg_conv;
62952         this_arg_conv.inner = untag_ptr(this_arg);
62953         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62955         this_arg_conv.is_owned = false;
62956         NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
62957 }
62958
62959 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62960         LDKNodeFeatures this_arg_conv;
62961         this_arg_conv.inner = untag_ptr(this_arg);
62962         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62964         this_arg_conv.is_owned = false;
62965         NodeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
62966 }
62967
62968 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
62969         LDKNodeFeatures this_arg_conv;
62970         this_arg_conv.inner = untag_ptr(this_arg);
62971         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62973         this_arg_conv.is_owned = false;
62974         jboolean ret_conv = NodeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
62975         return ret_conv;
62976 }
62977
62978 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62979         LDKChannelTypeFeatures this_arg_conv;
62980         this_arg_conv.inner = untag_ptr(this_arg);
62981         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62983         this_arg_conv.is_owned = false;
62984         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
62985 }
62986
62987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62988         LDKChannelTypeFeatures this_arg_conv;
62989         this_arg_conv.inner = untag_ptr(this_arg);
62990         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62992         this_arg_conv.is_owned = false;
62993         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
62994 }
62995
62996 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
62997         LDKChannelTypeFeatures this_arg_conv;
62998         this_arg_conv.inner = untag_ptr(this_arg);
62999         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63001         this_arg_conv.is_owned = false;
63002         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
63003         return ret_conv;
63004 }
63005
63006 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
63007         LDKInitFeatures this_arg_conv;
63008         this_arg_conv.inner = untag_ptr(this_arg);
63009         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63011         this_arg_conv.is_owned = false;
63012         jboolean ret_conv = InitFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
63013         return ret_conv;
63014 }
63015
63016 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
63017         LDKNodeFeatures this_arg_conv;
63018         this_arg_conv.inner = untag_ptr(this_arg);
63019         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63021         this_arg_conv.is_owned = false;
63022         jboolean ret_conv = NodeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
63023         return ret_conv;
63024 }
63025
63026 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
63027         LDKChannelTypeFeatures this_arg_conv;
63028         this_arg_conv.inner = untag_ptr(this_arg);
63029         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63031         this_arg_conv.is_owned = false;
63032         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
63033         return ret_conv;
63034 }
63035
63036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1route_1blinding_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
63037         LDKInitFeatures this_arg_conv;
63038         this_arg_conv.inner = untag_ptr(this_arg);
63039         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63041         this_arg_conv.is_owned = false;
63042         InitFeatures_set_route_blinding_optional(&this_arg_conv);
63043 }
63044
63045 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1route_1blinding_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
63046         LDKInitFeatures this_arg_conv;
63047         this_arg_conv.inner = untag_ptr(this_arg);
63048         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63050         this_arg_conv.is_owned = false;
63051         InitFeatures_set_route_blinding_required(&this_arg_conv);
63052 }
63053
63054 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1route_1blinding(JNIEnv *env, jclass clz, int64_t this_arg) {
63055         LDKInitFeatures this_arg_conv;
63056         this_arg_conv.inner = untag_ptr(this_arg);
63057         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63059         this_arg_conv.is_owned = false;
63060         jboolean ret_conv = InitFeatures_supports_route_blinding(&this_arg_conv);
63061         return ret_conv;
63062 }
63063
63064 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1route_1blinding_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
63065         LDKNodeFeatures this_arg_conv;
63066         this_arg_conv.inner = untag_ptr(this_arg);
63067         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63069         this_arg_conv.is_owned = false;
63070         NodeFeatures_set_route_blinding_optional(&this_arg_conv);
63071 }
63072
63073 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1route_1blinding_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
63074         LDKNodeFeatures this_arg_conv;
63075         this_arg_conv.inner = untag_ptr(this_arg);
63076         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63078         this_arg_conv.is_owned = false;
63079         NodeFeatures_set_route_blinding_required(&this_arg_conv);
63080 }
63081
63082 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1route_1blinding(JNIEnv *env, jclass clz, int64_t this_arg) {
63083         LDKNodeFeatures this_arg_conv;
63084         this_arg_conv.inner = untag_ptr(this_arg);
63085         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63087         this_arg_conv.is_owned = false;
63088         jboolean ret_conv = NodeFeatures_supports_route_blinding(&this_arg_conv);
63089         return ret_conv;
63090 }
63091
63092 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1route_1blinding(JNIEnv *env, jclass clz, int64_t this_arg) {
63093         LDKInitFeatures this_arg_conv;
63094         this_arg_conv.inner = untag_ptr(this_arg);
63095         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63097         this_arg_conv.is_owned = false;
63098         jboolean ret_conv = InitFeatures_requires_route_blinding(&this_arg_conv);
63099         return ret_conv;
63100 }
63101
63102 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1route_1blinding(JNIEnv *env, jclass clz, int64_t this_arg) {
63103         LDKNodeFeatures this_arg_conv;
63104         this_arg_conv.inner = untag_ptr(this_arg);
63105         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63107         this_arg_conv.is_owned = false;
63108         jboolean ret_conv = NodeFeatures_requires_route_blinding(&this_arg_conv);
63109         return ret_conv;
63110 }
63111
63112 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1shutdown_1any_1segwit_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
63113         LDKInitFeatures this_arg_conv;
63114         this_arg_conv.inner = untag_ptr(this_arg);
63115         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63117         this_arg_conv.is_owned = false;
63118         InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
63119 }
63120
63121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1shutdown_1any_1segwit_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
63122         LDKInitFeatures this_arg_conv;
63123         this_arg_conv.inner = untag_ptr(this_arg);
63124         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63126         this_arg_conv.is_owned = false;
63127         InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
63128 }
63129
63130 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
63131         LDKInitFeatures this_arg_conv;
63132         this_arg_conv.inner = untag_ptr(this_arg);
63133         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63135         this_arg_conv.is_owned = false;
63136         jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
63137         return ret_conv;
63138 }
63139
63140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1shutdown_1any_1segwit_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
63141         LDKNodeFeatures this_arg_conv;
63142         this_arg_conv.inner = untag_ptr(this_arg);
63143         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63145         this_arg_conv.is_owned = false;
63146         NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
63147 }
63148
63149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1shutdown_1any_1segwit_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
63150         LDKNodeFeatures this_arg_conv;
63151         this_arg_conv.inner = untag_ptr(this_arg);
63152         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63154         this_arg_conv.is_owned = false;
63155         NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
63156 }
63157
63158 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
63159         LDKNodeFeatures this_arg_conv;
63160         this_arg_conv.inner = untag_ptr(this_arg);
63161         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63163         this_arg_conv.is_owned = false;
63164         jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
63165         return ret_conv;
63166 }
63167
63168 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
63169         LDKInitFeatures this_arg_conv;
63170         this_arg_conv.inner = untag_ptr(this_arg);
63171         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63173         this_arg_conv.is_owned = false;
63174         jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
63175         return ret_conv;
63176 }
63177
63178 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
63179         LDKNodeFeatures this_arg_conv;
63180         this_arg_conv.inner = untag_ptr(this_arg);
63181         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63183         this_arg_conv.is_owned = false;
63184         jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
63185         return ret_conv;
63186 }
63187
63188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1taproot_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
63189         LDKInitFeatures this_arg_conv;
63190         this_arg_conv.inner = untag_ptr(this_arg);
63191         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63193         this_arg_conv.is_owned = false;
63194         InitFeatures_set_taproot_optional(&this_arg_conv);
63195 }
63196
63197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1taproot_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
63198         LDKInitFeatures this_arg_conv;
63199         this_arg_conv.inner = untag_ptr(this_arg);
63200         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63202         this_arg_conv.is_owned = false;
63203         InitFeatures_set_taproot_required(&this_arg_conv);
63204 }
63205
63206 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
63207         LDKInitFeatures this_arg_conv;
63208         this_arg_conv.inner = untag_ptr(this_arg);
63209         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63211         this_arg_conv.is_owned = false;
63212         jboolean ret_conv = InitFeatures_supports_taproot(&this_arg_conv);
63213         return ret_conv;
63214 }
63215
63216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1taproot_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
63217         LDKNodeFeatures this_arg_conv;
63218         this_arg_conv.inner = untag_ptr(this_arg);
63219         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63221         this_arg_conv.is_owned = false;
63222         NodeFeatures_set_taproot_optional(&this_arg_conv);
63223 }
63224
63225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1taproot_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
63226         LDKNodeFeatures this_arg_conv;
63227         this_arg_conv.inner = untag_ptr(this_arg);
63228         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63230         this_arg_conv.is_owned = false;
63231         NodeFeatures_set_taproot_required(&this_arg_conv);
63232 }
63233
63234 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
63235         LDKNodeFeatures this_arg_conv;
63236         this_arg_conv.inner = untag_ptr(this_arg);
63237         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63239         this_arg_conv.is_owned = false;
63240         jboolean ret_conv = NodeFeatures_supports_taproot(&this_arg_conv);
63241         return ret_conv;
63242 }
63243
63244 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1taproot_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
63245         LDKChannelTypeFeatures this_arg_conv;
63246         this_arg_conv.inner = untag_ptr(this_arg);
63247         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63249         this_arg_conv.is_owned = false;
63250         ChannelTypeFeatures_set_taproot_optional(&this_arg_conv);
63251 }
63252
63253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1taproot_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
63254         LDKChannelTypeFeatures this_arg_conv;
63255         this_arg_conv.inner = untag_ptr(this_arg);
63256         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63258         this_arg_conv.is_owned = false;
63259         ChannelTypeFeatures_set_taproot_required(&this_arg_conv);
63260 }
63261
63262 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
63263         LDKChannelTypeFeatures this_arg_conv;
63264         this_arg_conv.inner = untag_ptr(this_arg);
63265         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63267         this_arg_conv.is_owned = false;
63268         jboolean ret_conv = ChannelTypeFeatures_supports_taproot(&this_arg_conv);
63269         return ret_conv;
63270 }
63271
63272 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
63273         LDKInitFeatures this_arg_conv;
63274         this_arg_conv.inner = untag_ptr(this_arg);
63275         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63277         this_arg_conv.is_owned = false;
63278         jboolean ret_conv = InitFeatures_requires_taproot(&this_arg_conv);
63279         return ret_conv;
63280 }
63281
63282 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
63283         LDKNodeFeatures this_arg_conv;
63284         this_arg_conv.inner = untag_ptr(this_arg);
63285         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63287         this_arg_conv.is_owned = false;
63288         jboolean ret_conv = NodeFeatures_requires_taproot(&this_arg_conv);
63289         return ret_conv;
63290 }
63291
63292 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
63293         LDKChannelTypeFeatures this_arg_conv;
63294         this_arg_conv.inner = untag_ptr(this_arg);
63295         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63297         this_arg_conv.is_owned = false;
63298         jboolean ret_conv = ChannelTypeFeatures_requires_taproot(&this_arg_conv);
63299         return ret_conv;
63300 }
63301
63302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1onion_1messages_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
63303         LDKInitFeatures this_arg_conv;
63304         this_arg_conv.inner = untag_ptr(this_arg);
63305         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63307         this_arg_conv.is_owned = false;
63308         InitFeatures_set_onion_messages_optional(&this_arg_conv);
63309 }
63310
63311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1onion_1messages_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
63312         LDKInitFeatures this_arg_conv;
63313         this_arg_conv.inner = untag_ptr(this_arg);
63314         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63316         this_arg_conv.is_owned = false;
63317         InitFeatures_set_onion_messages_required(&this_arg_conv);
63318 }
63319
63320 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
63321         LDKInitFeatures this_arg_conv;
63322         this_arg_conv.inner = untag_ptr(this_arg);
63323         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63325         this_arg_conv.is_owned = false;
63326         jboolean ret_conv = InitFeatures_supports_onion_messages(&this_arg_conv);
63327         return ret_conv;
63328 }
63329
63330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1onion_1messages_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
63331         LDKNodeFeatures this_arg_conv;
63332         this_arg_conv.inner = untag_ptr(this_arg);
63333         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63335         this_arg_conv.is_owned = false;
63336         NodeFeatures_set_onion_messages_optional(&this_arg_conv);
63337 }
63338
63339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1onion_1messages_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
63340         LDKNodeFeatures this_arg_conv;
63341         this_arg_conv.inner = untag_ptr(this_arg);
63342         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63344         this_arg_conv.is_owned = false;
63345         NodeFeatures_set_onion_messages_required(&this_arg_conv);
63346 }
63347
63348 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
63349         LDKNodeFeatures this_arg_conv;
63350         this_arg_conv.inner = untag_ptr(this_arg);
63351         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63353         this_arg_conv.is_owned = false;
63354         jboolean ret_conv = NodeFeatures_supports_onion_messages(&this_arg_conv);
63355         return ret_conv;
63356 }
63357
63358 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
63359         LDKInitFeatures this_arg_conv;
63360         this_arg_conv.inner = untag_ptr(this_arg);
63361         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63363         this_arg_conv.is_owned = false;
63364         jboolean ret_conv = InitFeatures_requires_onion_messages(&this_arg_conv);
63365         return ret_conv;
63366 }
63367
63368 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
63369         LDKNodeFeatures this_arg_conv;
63370         this_arg_conv.inner = untag_ptr(this_arg);
63371         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63373         this_arg_conv.is_owned = false;
63374         jboolean ret_conv = NodeFeatures_requires_onion_messages(&this_arg_conv);
63375         return ret_conv;
63376 }
63377
63378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1channel_1type_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
63379         LDKInitFeatures this_arg_conv;
63380         this_arg_conv.inner = untag_ptr(this_arg);
63381         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63383         this_arg_conv.is_owned = false;
63384         InitFeatures_set_channel_type_optional(&this_arg_conv);
63385 }
63386
63387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1channel_1type_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
63388         LDKInitFeatures this_arg_conv;
63389         this_arg_conv.inner = untag_ptr(this_arg);
63390         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63392         this_arg_conv.is_owned = false;
63393         InitFeatures_set_channel_type_required(&this_arg_conv);
63394 }
63395
63396 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
63397         LDKInitFeatures this_arg_conv;
63398         this_arg_conv.inner = untag_ptr(this_arg);
63399         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63401         this_arg_conv.is_owned = false;
63402         jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
63403         return ret_conv;
63404 }
63405
63406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1channel_1type_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
63407         LDKNodeFeatures this_arg_conv;
63408         this_arg_conv.inner = untag_ptr(this_arg);
63409         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63411         this_arg_conv.is_owned = false;
63412         NodeFeatures_set_channel_type_optional(&this_arg_conv);
63413 }
63414
63415 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1channel_1type_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
63416         LDKNodeFeatures this_arg_conv;
63417         this_arg_conv.inner = untag_ptr(this_arg);
63418         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63420         this_arg_conv.is_owned = false;
63421         NodeFeatures_set_channel_type_required(&this_arg_conv);
63422 }
63423
63424 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
63425         LDKNodeFeatures this_arg_conv;
63426         this_arg_conv.inner = untag_ptr(this_arg);
63427         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63429         this_arg_conv.is_owned = false;
63430         jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
63431         return ret_conv;
63432 }
63433
63434 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
63435         LDKInitFeatures this_arg_conv;
63436         this_arg_conv.inner = untag_ptr(this_arg);
63437         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63439         this_arg_conv.is_owned = false;
63440         jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
63441         return ret_conv;
63442 }
63443
63444 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
63445         LDKNodeFeatures this_arg_conv;
63446         this_arg_conv.inner = untag_ptr(this_arg);
63447         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63449         this_arg_conv.is_owned = false;
63450         jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
63451         return ret_conv;
63452 }
63453
63454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
63455         LDKInitFeatures this_arg_conv;
63456         this_arg_conv.inner = untag_ptr(this_arg);
63457         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63459         this_arg_conv.is_owned = false;
63460         InitFeatures_set_scid_privacy_optional(&this_arg_conv);
63461 }
63462
63463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
63464         LDKInitFeatures this_arg_conv;
63465         this_arg_conv.inner = untag_ptr(this_arg);
63466         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63468         this_arg_conv.is_owned = false;
63469         InitFeatures_set_scid_privacy_required(&this_arg_conv);
63470 }
63471
63472 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
63473         LDKInitFeatures this_arg_conv;
63474         this_arg_conv.inner = untag_ptr(this_arg);
63475         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63477         this_arg_conv.is_owned = false;
63478         jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
63479         return ret_conv;
63480 }
63481
63482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
63483         LDKNodeFeatures this_arg_conv;
63484         this_arg_conv.inner = untag_ptr(this_arg);
63485         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63487         this_arg_conv.is_owned = false;
63488         NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
63489 }
63490
63491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
63492         LDKNodeFeatures this_arg_conv;
63493         this_arg_conv.inner = untag_ptr(this_arg);
63494         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63496         this_arg_conv.is_owned = false;
63497         NodeFeatures_set_scid_privacy_required(&this_arg_conv);
63498 }
63499
63500 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
63501         LDKNodeFeatures this_arg_conv;
63502         this_arg_conv.inner = untag_ptr(this_arg);
63503         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63505         this_arg_conv.is_owned = false;
63506         jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
63507         return ret_conv;
63508 }
63509
63510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
63511         LDKChannelTypeFeatures this_arg_conv;
63512         this_arg_conv.inner = untag_ptr(this_arg);
63513         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63515         this_arg_conv.is_owned = false;
63516         ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
63517 }
63518
63519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
63520         LDKChannelTypeFeatures this_arg_conv;
63521         this_arg_conv.inner = untag_ptr(this_arg);
63522         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63524         this_arg_conv.is_owned = false;
63525         ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
63526 }
63527
63528 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
63529         LDKChannelTypeFeatures this_arg_conv;
63530         this_arg_conv.inner = untag_ptr(this_arg);
63531         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63533         this_arg_conv.is_owned = false;
63534         jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
63535         return ret_conv;
63536 }
63537
63538 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
63539         LDKInitFeatures this_arg_conv;
63540         this_arg_conv.inner = untag_ptr(this_arg);
63541         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63543         this_arg_conv.is_owned = false;
63544         jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
63545         return ret_conv;
63546 }
63547
63548 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
63549         LDKNodeFeatures this_arg_conv;
63550         this_arg_conv.inner = untag_ptr(this_arg);
63551         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63553         this_arg_conv.is_owned = false;
63554         jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
63555         return ret_conv;
63556 }
63557
63558 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
63559         LDKChannelTypeFeatures this_arg_conv;
63560         this_arg_conv.inner = untag_ptr(this_arg);
63561         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63563         this_arg_conv.is_owned = false;
63564         jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
63565         return ret_conv;
63566 }
63567
63568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1payment_1metadata_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
63569         LDKBolt11InvoiceFeatures this_arg_conv;
63570         this_arg_conv.inner = untag_ptr(this_arg);
63571         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63573         this_arg_conv.is_owned = false;
63574         Bolt11InvoiceFeatures_set_payment_metadata_optional(&this_arg_conv);
63575 }
63576
63577 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1payment_1metadata_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
63578         LDKBolt11InvoiceFeatures this_arg_conv;
63579         this_arg_conv.inner = untag_ptr(this_arg);
63580         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63582         this_arg_conv.is_owned = false;
63583         Bolt11InvoiceFeatures_set_payment_metadata_required(&this_arg_conv);
63584 }
63585
63586 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
63587         LDKBolt11InvoiceFeatures this_arg_conv;
63588         this_arg_conv.inner = untag_ptr(this_arg);
63589         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63591         this_arg_conv.is_owned = false;
63592         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_metadata(&this_arg_conv);
63593         return ret_conv;
63594 }
63595
63596 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
63597         LDKBolt11InvoiceFeatures this_arg_conv;
63598         this_arg_conv.inner = untag_ptr(this_arg);
63599         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63601         this_arg_conv.is_owned = false;
63602         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_metadata(&this_arg_conv);
63603         return ret_conv;
63604 }
63605
63606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
63607         LDKInitFeatures this_arg_conv;
63608         this_arg_conv.inner = untag_ptr(this_arg);
63609         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63611         this_arg_conv.is_owned = false;
63612         InitFeatures_set_zero_conf_optional(&this_arg_conv);
63613 }
63614
63615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
63616         LDKInitFeatures this_arg_conv;
63617         this_arg_conv.inner = untag_ptr(this_arg);
63618         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63620         this_arg_conv.is_owned = false;
63621         InitFeatures_set_zero_conf_required(&this_arg_conv);
63622 }
63623
63624 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
63625         LDKInitFeatures this_arg_conv;
63626         this_arg_conv.inner = untag_ptr(this_arg);
63627         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63629         this_arg_conv.is_owned = false;
63630         jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
63631         return ret_conv;
63632 }
63633
63634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
63635         LDKNodeFeatures this_arg_conv;
63636         this_arg_conv.inner = untag_ptr(this_arg);
63637         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63639         this_arg_conv.is_owned = false;
63640         NodeFeatures_set_zero_conf_optional(&this_arg_conv);
63641 }
63642
63643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
63644         LDKNodeFeatures this_arg_conv;
63645         this_arg_conv.inner = untag_ptr(this_arg);
63646         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63648         this_arg_conv.is_owned = false;
63649         NodeFeatures_set_zero_conf_required(&this_arg_conv);
63650 }
63651
63652 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
63653         LDKNodeFeatures this_arg_conv;
63654         this_arg_conv.inner = untag_ptr(this_arg);
63655         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63657         this_arg_conv.is_owned = false;
63658         jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
63659         return ret_conv;
63660 }
63661
63662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
63663         LDKChannelTypeFeatures this_arg_conv;
63664         this_arg_conv.inner = untag_ptr(this_arg);
63665         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63667         this_arg_conv.is_owned = false;
63668         ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
63669 }
63670
63671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
63672         LDKChannelTypeFeatures this_arg_conv;
63673         this_arg_conv.inner = untag_ptr(this_arg);
63674         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63676         this_arg_conv.is_owned = false;
63677         ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
63678 }
63679
63680 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
63681         LDKChannelTypeFeatures this_arg_conv;
63682         this_arg_conv.inner = untag_ptr(this_arg);
63683         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63685         this_arg_conv.is_owned = false;
63686         jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
63687         return ret_conv;
63688 }
63689
63690 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
63691         LDKInitFeatures this_arg_conv;
63692         this_arg_conv.inner = untag_ptr(this_arg);
63693         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63695         this_arg_conv.is_owned = false;
63696         jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
63697         return ret_conv;
63698 }
63699
63700 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
63701         LDKNodeFeatures this_arg_conv;
63702         this_arg_conv.inner = untag_ptr(this_arg);
63703         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63705         this_arg_conv.is_owned = false;
63706         jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
63707         return ret_conv;
63708 }
63709
63710 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
63711         LDKChannelTypeFeatures this_arg_conv;
63712         this_arg_conv.inner = untag_ptr(this_arg);
63713         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63715         this_arg_conv.is_owned = false;
63716         jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
63717         return ret_conv;
63718 }
63719
63720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1keysend_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
63721         LDKNodeFeatures this_arg_conv;
63722         this_arg_conv.inner = untag_ptr(this_arg);
63723         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63725         this_arg_conv.is_owned = false;
63726         NodeFeatures_set_keysend_optional(&this_arg_conv);
63727 }
63728
63729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1keysend_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
63730         LDKNodeFeatures this_arg_conv;
63731         this_arg_conv.inner = untag_ptr(this_arg);
63732         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63734         this_arg_conv.is_owned = false;
63735         NodeFeatures_set_keysend_required(&this_arg_conv);
63736 }
63737
63738 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1keysend(JNIEnv *env, jclass clz, int64_t this_arg) {
63739         LDKNodeFeatures this_arg_conv;
63740         this_arg_conv.inner = untag_ptr(this_arg);
63741         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63743         this_arg_conv.is_owned = false;
63744         jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
63745         return ret_conv;
63746 }
63747
63748 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1keysend(JNIEnv *env, jclass clz, int64_t this_arg) {
63749         LDKNodeFeatures this_arg_conv;
63750         this_arg_conv.inner = untag_ptr(this_arg);
63751         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63753         this_arg_conv.is_owned = false;
63754         jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
63755         return ret_conv;
63756 }
63757
63758 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63759         LDKShutdownScript this_obj_conv;
63760         this_obj_conv.inner = untag_ptr(this_obj);
63761         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63763         ShutdownScript_free(this_obj_conv);
63764 }
63765
63766 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
63767         LDKShutdownScript ret_var = ShutdownScript_clone(arg);
63768         int64_t ret_ref = 0;
63769         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63770         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63771         return ret_ref;
63772 }
63773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
63774         LDKShutdownScript arg_conv;
63775         arg_conv.inner = untag_ptr(arg);
63776         arg_conv.is_owned = ptr_is_owned(arg);
63777         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63778         arg_conv.is_owned = false;
63779         int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
63780         return ret_conv;
63781 }
63782
63783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
63784         LDKShutdownScript orig_conv;
63785         orig_conv.inner = untag_ptr(orig);
63786         orig_conv.is_owned = ptr_is_owned(orig);
63787         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63788         orig_conv.is_owned = false;
63789         LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
63790         int64_t ret_ref = 0;
63791         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63792         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63793         return ret_ref;
63794 }
63795
63796 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
63797         LDKShutdownScript a_conv;
63798         a_conv.inner = untag_ptr(a);
63799         a_conv.is_owned = ptr_is_owned(a);
63800         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63801         a_conv.is_owned = false;
63802         LDKShutdownScript b_conv;
63803         b_conv.inner = untag_ptr(b);
63804         b_conv.is_owned = ptr_is_owned(b);
63805         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63806         b_conv.is_owned = false;
63807         jboolean ret_conv = ShutdownScript_eq(&a_conv, &b_conv);
63808         return ret_conv;
63809 }
63810
63811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63812         LDKInvalidShutdownScript this_obj_conv;
63813         this_obj_conv.inner = untag_ptr(this_obj);
63814         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63816         InvalidShutdownScript_free(this_obj_conv);
63817 }
63818
63819 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
63820         LDKInvalidShutdownScript this_ptr_conv;
63821         this_ptr_conv.inner = untag_ptr(this_ptr);
63822         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63824         this_ptr_conv.is_owned = false;
63825         LDKCVec_u8Z ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
63826         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63827         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63828         CVec_u8Z_free(ret_var);
63829         return ret_arr;
63830 }
63831
63832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
63833         LDKInvalidShutdownScript this_ptr_conv;
63834         this_ptr_conv.inner = untag_ptr(this_ptr);
63835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63837         this_ptr_conv.is_owned = false;
63838         LDKCVec_u8Z val_ref;
63839         val_ref.datalen = (*env)->GetArrayLength(env, val);
63840         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
63841         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
63842         InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
63843 }
63844
63845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1new(JNIEnv *env, jclass clz, int8_tArray script_arg) {
63846         LDKCVec_u8Z script_arg_ref;
63847         script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
63848         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
63849         (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
63850         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
63851         int64_t ret_ref = 0;
63852         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63853         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63854         return ret_ref;
63855 }
63856
63857 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
63858         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
63859         int64_t ret_ref = 0;
63860         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63861         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63862         return ret_ref;
63863 }
63864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
63865         LDKInvalidShutdownScript arg_conv;
63866         arg_conv.inner = untag_ptr(arg);
63867         arg_conv.is_owned = ptr_is_owned(arg);
63868         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63869         arg_conv.is_owned = false;
63870         int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
63871         return ret_conv;
63872 }
63873
63874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
63875         LDKInvalidShutdownScript orig_conv;
63876         orig_conv.inner = untag_ptr(orig);
63877         orig_conv.is_owned = ptr_is_owned(orig);
63878         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63879         orig_conv.is_owned = false;
63880         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
63881         int64_t ret_ref = 0;
63882         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63883         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63884         return ret_ref;
63885 }
63886
63887 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1write(JNIEnv *env, jclass clz, int64_t obj) {
63888         LDKShutdownScript obj_conv;
63889         obj_conv.inner = untag_ptr(obj);
63890         obj_conv.is_owned = ptr_is_owned(obj);
63891         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63892         obj_conv.is_owned = false;
63893         LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
63894         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63895         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63896         CVec_u8Z_free(ret_var);
63897         return ret_arr;
63898 }
63899
63900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
63901         LDKu8slice ser_ref;
63902         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
63903         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
63904         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
63905         *ret_conv = ShutdownScript_read(ser_ref);
63906         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
63907         return tag_ptr(ret_conv, true);
63908 }
63909
63910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wpkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) {
63911         uint8_t pubkey_hash_arr[20];
63912         CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
63913         (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
63914         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
63915         LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
63916         int64_t ret_ref = 0;
63917         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63918         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63919         return ret_ref;
63920 }
63921
63922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wsh(JNIEnv *env, jclass clz, int8_tArray script_hash) {
63923         uint8_t script_hash_arr[32];
63924         CHECK((*env)->GetArrayLength(env, script_hash) == 32);
63925         (*env)->GetByteArrayRegion(env, script_hash, 0, 32, script_hash_arr);
63926         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
63927         LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
63928         int64_t ret_ref = 0;
63929         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63930         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63931         return ret_ref;
63932 }
63933
63934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1witness_1program(JNIEnv *env, jclass clz, int64_t witness_program) {
63935         void* witness_program_ptr = untag_ptr(witness_program);
63936         CHECK_ACCESS(witness_program_ptr);
63937         LDKWitnessProgram witness_program_conv = *(LDKWitnessProgram*)(witness_program_ptr);
63938         witness_program_conv = WitnessProgram_clone((LDKWitnessProgram*)untag_ptr(witness_program));
63939         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
63940         *ret_conv = ShutdownScript_new_witness_program(witness_program_conv);
63941         return tag_ptr(ret_conv, true);
63942 }
63943
63944 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
63945         LDKShutdownScript this_arg_conv;
63946         this_arg_conv.inner = untag_ptr(this_arg);
63947         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63949         this_arg_conv = ShutdownScript_clone(&this_arg_conv);
63950         LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
63951         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63952         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63953         CVec_u8Z_free(ret_var);
63954         return ret_arr;
63955 }
63956
63957 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1as_1legacy_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
63958         LDKShutdownScript this_arg_conv;
63959         this_arg_conv.inner = untag_ptr(this_arg);
63960         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63962         this_arg_conv.is_owned = false;
63963         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
63964         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form);
63965         return ret_arr;
63966 }
63967
63968 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1is_1compatible(JNIEnv *env, jclass clz, int64_t this_arg, int64_t features) {
63969         LDKShutdownScript this_arg_conv;
63970         this_arg_conv.inner = untag_ptr(this_arg);
63971         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63973         this_arg_conv.is_owned = false;
63974         LDKInitFeatures features_conv;
63975         features_conv.inner = untag_ptr(features);
63976         features_conv.is_owned = ptr_is_owned(features);
63977         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
63978         features_conv.is_owned = false;
63979         jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
63980         return ret_conv;
63981 }
63982
63983 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Retry_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
63984         if (!ptr_is_owned(this_ptr)) return;
63985         void* this_ptr_ptr = untag_ptr(this_ptr);
63986         CHECK_ACCESS(this_ptr_ptr);
63987         LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
63988         FREE(untag_ptr(this_ptr));
63989         Retry_free(this_ptr_conv);
63990 }
63991
63992 static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
63993         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
63994         *ret_copy = Retry_clone(arg);
63995         int64_t ret_ref = tag_ptr(ret_copy, true);
63996         return ret_ref;
63997 }
63998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
63999         LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg);
64000         int64_t ret_conv = Retry_clone_ptr(arg_conv);
64001         return ret_conv;
64002 }
64003
64004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64005         LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig);
64006         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
64007         *ret_copy = Retry_clone(orig_conv);
64008         int64_t ret_ref = tag_ptr(ret_copy, true);
64009         return ret_ref;
64010 }
64011
64012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1attempts(JNIEnv *env, jclass clz, int32_t a) {
64013         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
64014         *ret_copy = Retry_attempts(a);
64015         int64_t ret_ref = tag_ptr(ret_copy, true);
64016         return ret_ref;
64017 }
64018
64019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1timeout(JNIEnv *env, jclass clz, int64_t a) {
64020         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
64021         *ret_copy = Retry_timeout(a);
64022         int64_t ret_ref = tag_ptr(ret_copy, true);
64023         return ret_ref;
64024 }
64025
64026 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Retry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64027         LDKRetry* a_conv = (LDKRetry*)untag_ptr(a);
64028         LDKRetry* b_conv = (LDKRetry*)untag_ptr(b);
64029         jboolean ret_conv = Retry_eq(a_conv, b_conv);
64030         return ret_conv;
64031 }
64032
64033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1hash(JNIEnv *env, jclass clz, int64_t o) {
64034         LDKRetry* o_conv = (LDKRetry*)untag_ptr(o);
64035         int64_t ret_conv = Retry_hash(o_conv);
64036         return ret_conv;
64037 }
64038
64039 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Retry_1write(JNIEnv *env, jclass clz, int64_t obj) {
64040         LDKRetry* obj_conv = (LDKRetry*)untag_ptr(obj);
64041         LDKCVec_u8Z ret_var = Retry_write(obj_conv);
64042         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64043         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64044         CVec_u8Z_free(ret_var);
64045         return ret_arr;
64046 }
64047
64048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
64049         LDKu8slice ser_ref;
64050         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
64051         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
64052         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
64053         *ret_conv = Retry_read(ser_ref);
64054         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
64055         return tag_ptr(ret_conv, true);
64056 }
64057
64058 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64059         LDKRetryableSendFailure* orig_conv = (LDKRetryableSendFailure*)untag_ptr(orig);
64060         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_clone(orig_conv));
64061         return ret_conv;
64062 }
64063
64064 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1payment_1expired(JNIEnv *env, jclass clz) {
64065         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_payment_expired());
64066         return ret_conv;
64067 }
64068
64069 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1route_1not_1found(JNIEnv *env, jclass clz) {
64070         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_route_not_found());
64071         return ret_conv;
64072 }
64073
64074 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1duplicate_1payment(JNIEnv *env, jclass clz) {
64075         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_duplicate_payment());
64076         return ret_conv;
64077 }
64078
64079 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64080         LDKRetryableSendFailure* a_conv = (LDKRetryableSendFailure*)untag_ptr(a);
64081         LDKRetryableSendFailure* b_conv = (LDKRetryableSendFailure*)untag_ptr(b);
64082         jboolean ret_conv = RetryableSendFailure_eq(a_conv, b_conv);
64083         return ret_conv;
64084 }
64085
64086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
64087         if (!ptr_is_owned(this_ptr)) return;
64088         void* this_ptr_ptr = untag_ptr(this_ptr);
64089         CHECK_ACCESS(this_ptr_ptr);
64090         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
64091         FREE(untag_ptr(this_ptr));
64092         PaymentSendFailure_free(this_ptr_conv);
64093 }
64094
64095 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
64096         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
64097         *ret_copy = PaymentSendFailure_clone(arg);
64098         int64_t ret_ref = tag_ptr(ret_copy, true);
64099         return ret_ref;
64100 }
64101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64102         LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg);
64103         int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
64104         return ret_conv;
64105 }
64106
64107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64108         LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig);
64109         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
64110         *ret_copy = PaymentSendFailure_clone(orig_conv);
64111         int64_t ret_ref = tag_ptr(ret_copy, true);
64112         return ret_ref;
64113 }
64114
64115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1parameter_1error(JNIEnv *env, jclass clz, int64_t a) {
64116         void* a_ptr = untag_ptr(a);
64117         CHECK_ACCESS(a_ptr);
64118         LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
64119         a_conv = APIError_clone((LDKAPIError*)untag_ptr(a));
64120         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
64121         *ret_copy = PaymentSendFailure_parameter_error(a_conv);
64122         int64_t ret_ref = tag_ptr(ret_copy, true);
64123         return ret_ref;
64124 }
64125
64126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1path_1parameter_1error(JNIEnv *env, jclass clz, int64_tArray a) {
64127         LDKCVec_CResult_NoneAPIErrorZZ a_constr;
64128         a_constr.datalen = (*env)->GetArrayLength(env, a);
64129         if (a_constr.datalen > 0)
64130                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
64131         else
64132                 a_constr.data = NULL;
64133         int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
64134         for (size_t w = 0; w < a_constr.datalen; w++) {
64135                 int64_t a_conv_22 = a_vals[w];
64136                 void* a_conv_22_ptr = untag_ptr(a_conv_22);
64137                 CHECK_ACCESS(a_conv_22_ptr);
64138                 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
64139                 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22));
64140                 a_constr.data[w] = a_conv_22_conv;
64141         }
64142         (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
64143         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
64144         *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
64145         int64_t ret_ref = tag_ptr(ret_copy, true);
64146         return ret_ref;
64147 }
64148
64149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1all_1failed_1resend_1safe(JNIEnv *env, jclass clz, int64_tArray a) {
64150         LDKCVec_APIErrorZ a_constr;
64151         a_constr.datalen = (*env)->GetArrayLength(env, a);
64152         if (a_constr.datalen > 0)
64153                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
64154         else
64155                 a_constr.data = NULL;
64156         int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
64157         for (size_t k = 0; k < a_constr.datalen; k++) {
64158                 int64_t a_conv_10 = a_vals[k];
64159                 void* a_conv_10_ptr = untag_ptr(a_conv_10);
64160                 CHECK_ACCESS(a_conv_10_ptr);
64161                 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
64162                 a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10));
64163                 a_constr.data[k] = a_conv_10_conv;
64164         }
64165         (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
64166         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
64167         *ret_copy = PaymentSendFailure_all_failed_resend_safe(a_constr);
64168         int64_t ret_ref = tag_ptr(ret_copy, true);
64169         return ret_ref;
64170 }
64171
64172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1duplicate_1payment(JNIEnv *env, jclass clz) {
64173         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
64174         *ret_copy = PaymentSendFailure_duplicate_payment();
64175         int64_t ret_ref = tag_ptr(ret_copy, true);
64176         return ret_ref;
64177 }
64178
64179 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) {
64180         LDKCVec_CResult_NoneAPIErrorZZ results_constr;
64181         results_constr.datalen = (*env)->GetArrayLength(env, results);
64182         if (results_constr.datalen > 0)
64183                 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
64184         else
64185                 results_constr.data = NULL;
64186         int64_t* results_vals = (*env)->GetLongArrayElements (env, results, NULL);
64187         for (size_t w = 0; w < results_constr.datalen; w++) {
64188                 int64_t results_conv_22 = results_vals[w];
64189                 void* results_conv_22_ptr = untag_ptr(results_conv_22);
64190                 CHECK_ACCESS(results_conv_22_ptr);
64191                 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
64192                 results_constr.data[w] = results_conv_22_conv;
64193         }
64194         (*env)->ReleaseLongArrayElements(env, results, results_vals, 0);
64195         LDKRouteParameters failed_paths_retry_conv;
64196         failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry);
64197         failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry);
64198         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
64199         failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
64200         LDKThirtyTwoBytes payment_id_ref;
64201         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
64202         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
64203         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
64204         *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
64205         int64_t ret_ref = tag_ptr(ret_copy, true);
64206         return ret_ref;
64207 }
64208
64209 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64210         LDKPaymentSendFailure* a_conv = (LDKPaymentSendFailure*)untag_ptr(a);
64211         LDKPaymentSendFailure* b_conv = (LDKPaymentSendFailure*)untag_ptr(b);
64212         jboolean ret_conv = PaymentSendFailure_eq(a_conv, b_conv);
64213         return ret_conv;
64214 }
64215
64216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
64217         if (!ptr_is_owned(this_ptr)) return;
64218         void* this_ptr_ptr = untag_ptr(this_ptr);
64219         CHECK_ACCESS(this_ptr_ptr);
64220         LDKProbeSendFailure this_ptr_conv = *(LDKProbeSendFailure*)(this_ptr_ptr);
64221         FREE(untag_ptr(this_ptr));
64222         ProbeSendFailure_free(this_ptr_conv);
64223 }
64224
64225 static inline uint64_t ProbeSendFailure_clone_ptr(LDKProbeSendFailure *NONNULL_PTR arg) {
64226         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
64227         *ret_copy = ProbeSendFailure_clone(arg);
64228         int64_t ret_ref = tag_ptr(ret_copy, true);
64229         return ret_ref;
64230 }
64231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64232         LDKProbeSendFailure* arg_conv = (LDKProbeSendFailure*)untag_ptr(arg);
64233         int64_t ret_conv = ProbeSendFailure_clone_ptr(arg_conv);
64234         return ret_conv;
64235 }
64236
64237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64238         LDKProbeSendFailure* orig_conv = (LDKProbeSendFailure*)untag_ptr(orig);
64239         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
64240         *ret_copy = ProbeSendFailure_clone(orig_conv);
64241         int64_t ret_ref = tag_ptr(ret_copy, true);
64242         return ret_ref;
64243 }
64244
64245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1route_1not_1found(JNIEnv *env, jclass clz) {
64246         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
64247         *ret_copy = ProbeSendFailure_route_not_found();
64248         int64_t ret_ref = tag_ptr(ret_copy, true);
64249         return ret_ref;
64250 }
64251
64252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1sending_1failed(JNIEnv *env, jclass clz, int64_t a) {
64253         void* a_ptr = untag_ptr(a);
64254         CHECK_ACCESS(a_ptr);
64255         LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
64256         a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(a));
64257         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
64258         *ret_copy = ProbeSendFailure_sending_failed(a_conv);
64259         int64_t ret_ref = tag_ptr(ret_copy, true);
64260         return ret_ref;
64261 }
64262
64263 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64264         LDKProbeSendFailure* a_conv = (LDKProbeSendFailure*)untag_ptr(a);
64265         LDKProbeSendFailure* b_conv = (LDKProbeSendFailure*)untag_ptr(b);
64266         jboolean ret_conv = ProbeSendFailure_eq(a_conv, b_conv);
64267         return ret_conv;
64268 }
64269
64270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64271         LDKRecipientOnionFields this_obj_conv;
64272         this_obj_conv.inner = untag_ptr(this_obj);
64273         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64275         RecipientOnionFields_free(this_obj_conv);
64276 }
64277
64278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1get_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
64279         LDKRecipientOnionFields this_ptr_conv;
64280         this_ptr_conv.inner = untag_ptr(this_ptr);
64281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64283         this_ptr_conv.is_owned = false;
64284         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
64285         *ret_copy = RecipientOnionFields_get_payment_secret(&this_ptr_conv);
64286         int64_t ret_ref = tag_ptr(ret_copy, true);
64287         return ret_ref;
64288 }
64289
64290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1set_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
64291         LDKRecipientOnionFields this_ptr_conv;
64292         this_ptr_conv.inner = untag_ptr(this_ptr);
64293         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64295         this_ptr_conv.is_owned = false;
64296         void* val_ptr = untag_ptr(val);
64297         CHECK_ACCESS(val_ptr);
64298         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
64299         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
64300         RecipientOnionFields_set_payment_secret(&this_ptr_conv, val_conv);
64301 }
64302
64303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1get_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_ptr) {
64304         LDKRecipientOnionFields this_ptr_conv;
64305         this_ptr_conv.inner = untag_ptr(this_ptr);
64306         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64308         this_ptr_conv.is_owned = false;
64309         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
64310         *ret_copy = RecipientOnionFields_get_payment_metadata(&this_ptr_conv);
64311         int64_t ret_ref = tag_ptr(ret_copy, true);
64312         return ret_ref;
64313 }
64314
64315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1set_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
64316         LDKRecipientOnionFields this_ptr_conv;
64317         this_ptr_conv.inner = untag_ptr(this_ptr);
64318         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64320         this_ptr_conv.is_owned = false;
64321         void* val_ptr = untag_ptr(val);
64322         CHECK_ACCESS(val_ptr);
64323         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
64324         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
64325         RecipientOnionFields_set_payment_metadata(&this_ptr_conv, val_conv);
64326 }
64327
64328 static inline uint64_t RecipientOnionFields_clone_ptr(LDKRecipientOnionFields *NONNULL_PTR arg) {
64329         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(arg);
64330         int64_t ret_ref = 0;
64331         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64332         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64333         return ret_ref;
64334 }
64335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64336         LDKRecipientOnionFields arg_conv;
64337         arg_conv.inner = untag_ptr(arg);
64338         arg_conv.is_owned = ptr_is_owned(arg);
64339         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64340         arg_conv.is_owned = false;
64341         int64_t ret_conv = RecipientOnionFields_clone_ptr(&arg_conv);
64342         return ret_conv;
64343 }
64344
64345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64346         LDKRecipientOnionFields orig_conv;
64347         orig_conv.inner = untag_ptr(orig);
64348         orig_conv.is_owned = ptr_is_owned(orig);
64349         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64350         orig_conv.is_owned = false;
64351         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(&orig_conv);
64352         int64_t ret_ref = 0;
64353         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64354         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64355         return ret_ref;
64356 }
64357
64358 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64359         LDKRecipientOnionFields a_conv;
64360         a_conv.inner = untag_ptr(a);
64361         a_conv.is_owned = ptr_is_owned(a);
64362         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64363         a_conv.is_owned = false;
64364         LDKRecipientOnionFields b_conv;
64365         b_conv.inner = untag_ptr(b);
64366         b_conv.is_owned = ptr_is_owned(b);
64367         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64368         b_conv.is_owned = false;
64369         jboolean ret_conv = RecipientOnionFields_eq(&a_conv, &b_conv);
64370         return ret_conv;
64371 }
64372
64373 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1write(JNIEnv *env, jclass clz, int64_t obj) {
64374         LDKRecipientOnionFields obj_conv;
64375         obj_conv.inner = untag_ptr(obj);
64376         obj_conv.is_owned = ptr_is_owned(obj);
64377         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64378         obj_conv.is_owned = false;
64379         LDKCVec_u8Z ret_var = RecipientOnionFields_write(&obj_conv);
64380         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64381         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64382         CVec_u8Z_free(ret_var);
64383         return ret_arr;
64384 }
64385
64386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
64387         LDKu8slice ser_ref;
64388         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
64389         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
64390         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
64391         *ret_conv = RecipientOnionFields_read(ser_ref);
64392         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
64393         return tag_ptr(ret_conv, true);
64394 }
64395
64396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1secret_1only(JNIEnv *env, jclass clz, int8_tArray payment_secret) {
64397         LDKThirtyTwoBytes payment_secret_ref;
64398         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
64399         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
64400         LDKRecipientOnionFields ret_var = RecipientOnionFields_secret_only(payment_secret_ref);
64401         int64_t ret_ref = 0;
64402         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64403         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64404         return ret_ref;
64405 }
64406
64407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1spontaneous_1empty(JNIEnv *env, jclass clz) {
64408         LDKRecipientOnionFields ret_var = RecipientOnionFields_spontaneous_empty();
64409         int64_t ret_ref = 0;
64410         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64411         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64412         return ret_ref;
64413 }
64414
64415 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) {
64416         LDKRecipientOnionFields this_arg_conv;
64417         this_arg_conv.inner = untag_ptr(this_arg);
64418         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64420         this_arg_conv = RecipientOnionFields_clone(&this_arg_conv);
64421         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
64422         custom_tlvs_constr.datalen = (*env)->GetArrayLength(env, custom_tlvs);
64423         if (custom_tlvs_constr.datalen > 0)
64424                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
64425         else
64426                 custom_tlvs_constr.data = NULL;
64427         int64_t* custom_tlvs_vals = (*env)->GetLongArrayElements (env, custom_tlvs, NULL);
64428         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
64429                 int64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
64430                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
64431                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
64432                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
64433                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
64434                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
64435         }
64436         (*env)->ReleaseLongArrayElements(env, custom_tlvs, custom_tlvs_vals, 0);
64437         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
64438         *ret_conv = RecipientOnionFields_with_custom_tlvs(this_arg_conv, custom_tlvs_constr);
64439         return tag_ptr(ret_conv, true);
64440 }
64441
64442 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1custom_1tlvs(JNIEnv *env, jclass clz, int64_t this_arg) {
64443         LDKRecipientOnionFields this_arg_conv;
64444         this_arg_conv.inner = untag_ptr(this_arg);
64445         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64447         this_arg_conv.is_owned = false;
64448         LDKCVec_C2Tuple_u64CVec_u8ZZZ ret_var = RecipientOnionFields_custom_tlvs(&this_arg_conv);
64449         int64_tArray ret_arr = NULL;
64450         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
64451         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
64452         for (size_t x = 0; x < ret_var.datalen; x++) {
64453                 LDKC2Tuple_u64CVec_u8ZZ* ret_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
64454                 *ret_conv_23_conv = ret_var.data[x];
64455                 ret_arr_ptr[x] = tag_ptr(ret_conv_23_conv, true);
64456         }
64457         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
64458         FREE(ret_var.data);
64459         return ret_arr;
64460 }
64461
64462 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
64463         if (!ptr_is_owned(this_ptr)) return;
64464         void* this_ptr_ptr = untag_ptr(this_ptr);
64465         CHECK_ACCESS(this_ptr_ptr);
64466         LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
64467         FREE(untag_ptr(this_ptr));
64468         CustomMessageReader_free(this_ptr_conv);
64469 }
64470
64471 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
64472         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
64473         *ret_ret = Type_clone(arg);
64474         return tag_ptr(ret_ret, true);
64475 }
64476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64477         void* arg_ptr = untag_ptr(arg);
64478         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
64479         LDKType* arg_conv = (LDKType*)arg_ptr;
64480         int64_t ret_conv = Type_clone_ptr(arg_conv);
64481         return ret_conv;
64482 }
64483
64484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64485         void* orig_ptr = untag_ptr(orig);
64486         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
64487         LDKType* orig_conv = (LDKType*)orig_ptr;
64488         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
64489         *ret_ret = Type_clone(orig_conv);
64490         return tag_ptr(ret_ret, true);
64491 }
64492
64493 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Type_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
64494         if (!ptr_is_owned(this_ptr)) return;
64495         void* this_ptr_ptr = untag_ptr(this_ptr);
64496         CHECK_ACCESS(this_ptr_ptr);
64497         LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
64498         FREE(untag_ptr(this_ptr));
64499         Type_free(this_ptr_conv);
64500 }
64501
64502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Offer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64503         LDKOffer this_obj_conv;
64504         this_obj_conv.inner = untag_ptr(this_obj);
64505         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64507         Offer_free(this_obj_conv);
64508 }
64509
64510 static inline uint64_t Offer_clone_ptr(LDKOffer *NONNULL_PTR arg) {
64511         LDKOffer ret_var = Offer_clone(arg);
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 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64518         LDKOffer arg_conv;
64519         arg_conv.inner = untag_ptr(arg);
64520         arg_conv.is_owned = ptr_is_owned(arg);
64521         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64522         arg_conv.is_owned = false;
64523         int64_t ret_conv = Offer_clone_ptr(&arg_conv);
64524         return ret_conv;
64525 }
64526
64527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64528         LDKOffer orig_conv;
64529         orig_conv.inner = untag_ptr(orig);
64530         orig_conv.is_owned = ptr_is_owned(orig);
64531         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64532         orig_conv.is_owned = false;
64533         LDKOffer ret_var = Offer_clone(&orig_conv);
64534         int64_t ret_ref = 0;
64535         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64536         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64537         return ret_ref;
64538 }
64539
64540 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Offer_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
64541         LDKOffer this_arg_conv;
64542         this_arg_conv.inner = untag_ptr(this_arg);
64543         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64545         this_arg_conv.is_owned = false;
64546         LDKCVec_ThirtyTwoBytesZ ret_var = Offer_chains(&this_arg_conv);
64547         jobjectArray ret_arr = NULL;
64548         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
64549         ;
64550         for (size_t i = 0; i < ret_var.datalen; i++) {
64551                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
64552                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
64553                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
64554         }
64555         
64556         FREE(ret_var.data);
64557         return ret_arr;
64558 }
64559
64560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
64561         LDKOffer this_arg_conv;
64562         this_arg_conv.inner = untag_ptr(this_arg);
64563         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64565         this_arg_conv.is_owned = false;
64566         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
64567         *ret_copy = Offer_metadata(&this_arg_conv);
64568         int64_t ret_ref = tag_ptr(ret_copy, true);
64569         return ret_ref;
64570 }
64571
64572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
64573         LDKOffer this_arg_conv;
64574         this_arg_conv.inner = untag_ptr(this_arg);
64575         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64577         this_arg_conv.is_owned = false;
64578         LDKAmount ret_var = Offer_amount(&this_arg_conv);
64579         int64_t ret_ref = 0;
64580         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64581         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64582         return ret_ref;
64583 }
64584
64585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
64586         LDKOffer this_arg_conv;
64587         this_arg_conv.inner = untag_ptr(this_arg);
64588         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64590         this_arg_conv.is_owned = false;
64591         LDKPrintableString ret_var = Offer_description(&this_arg_conv);
64592         int64_t ret_ref = 0;
64593         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64594         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64595         return ret_ref;
64596 }
64597
64598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
64599         LDKOffer this_arg_conv;
64600         this_arg_conv.inner = untag_ptr(this_arg);
64601         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64603         this_arg_conv.is_owned = false;
64604         LDKOfferFeatures ret_var = Offer_offer_features(&this_arg_conv);
64605         int64_t ret_ref = 0;
64606         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64607         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64608         return ret_ref;
64609 }
64610
64611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
64612         LDKOffer this_arg_conv;
64613         this_arg_conv.inner = untag_ptr(this_arg);
64614         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64616         this_arg_conv.is_owned = false;
64617         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
64618         *ret_copy = Offer_absolute_expiry(&this_arg_conv);
64619         int64_t ret_ref = tag_ptr(ret_copy, true);
64620         return ret_ref;
64621 }
64622
64623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
64624         LDKOffer this_arg_conv;
64625         this_arg_conv.inner = untag_ptr(this_arg);
64626         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64628         this_arg_conv.is_owned = false;
64629         LDKPrintableString ret_var = Offer_issuer(&this_arg_conv);
64630         int64_t ret_ref = 0;
64631         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64632         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64633         return ret_ref;
64634 }
64635
64636 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Offer_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
64637         LDKOffer this_arg_conv;
64638         this_arg_conv.inner = untag_ptr(this_arg);
64639         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64641         this_arg_conv.is_owned = false;
64642         LDKCVec_BlindedPathZ ret_var = Offer_paths(&this_arg_conv);
64643         int64_tArray ret_arr = NULL;
64644         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
64645         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
64646         for (size_t n = 0; n < ret_var.datalen; n++) {
64647                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
64648                 int64_t ret_conv_13_ref = 0;
64649                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
64650                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
64651                 ret_arr_ptr[n] = ret_conv_13_ref;
64652         }
64653         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
64654         FREE(ret_var.data);
64655         return ret_arr;
64656 }
64657
64658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
64659         LDKOffer 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         LDKQuantity ret_var = Offer_supported_quantity(&this_arg_conv);
64665         int64_t ret_ref = 0;
64666         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64667         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64668         return ret_ref;
64669 }
64670
64671 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Offer_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
64672         LDKOffer this_arg_conv;
64673         this_arg_conv.inner = untag_ptr(this_arg);
64674         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64676         this_arg_conv.is_owned = false;
64677         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
64678         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Offer_signing_pubkey(&this_arg_conv).compressed_form);
64679         return ret_arr;
64680 }
64681
64682 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1supports_1chain(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray chain) {
64683         LDKOffer this_arg_conv;
64684         this_arg_conv.inner = untag_ptr(this_arg);
64685         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64687         this_arg_conv.is_owned = false;
64688         LDKThirtyTwoBytes chain_ref;
64689         CHECK((*env)->GetArrayLength(env, chain) == 32);
64690         (*env)->GetByteArrayRegion(env, chain, 0, 32, chain_ref.data);
64691         jboolean ret_conv = Offer_supports_chain(&this_arg_conv, chain_ref);
64692         return ret_conv;
64693 }
64694
64695 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
64696         LDKOffer this_arg_conv;
64697         this_arg_conv.inner = untag_ptr(this_arg);
64698         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64700         this_arg_conv.is_owned = false;
64701         jboolean ret_conv = Offer_is_expired(&this_arg_conv);
64702         return ret_conv;
64703 }
64704
64705 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) {
64706         LDKOffer this_arg_conv;
64707         this_arg_conv.inner = untag_ptr(this_arg);
64708         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64710         this_arg_conv.is_owned = false;
64711         jboolean ret_conv = Offer_is_expired_no_std(&this_arg_conv, duration_since_epoch);
64712         return ret_conv;
64713 }
64714
64715 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1is_1valid_1quantity(JNIEnv *env, jclass clz, int64_t this_arg, int64_t quantity) {
64716         LDKOffer this_arg_conv;
64717         this_arg_conv.inner = untag_ptr(this_arg);
64718         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64720         this_arg_conv.is_owned = false;
64721         jboolean ret_conv = Offer_is_valid_quantity(&this_arg_conv, quantity);
64722         return ret_conv;
64723 }
64724
64725 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1expects_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
64726         LDKOffer this_arg_conv;
64727         this_arg_conv.inner = untag_ptr(this_arg);
64728         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64730         this_arg_conv.is_owned = false;
64731         jboolean ret_conv = Offer_expects_quantity(&this_arg_conv);
64732         return ret_conv;
64733 }
64734
64735 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Offer_1write(JNIEnv *env, jclass clz, int64_t obj) {
64736         LDKOffer obj_conv;
64737         obj_conv.inner = untag_ptr(obj);
64738         obj_conv.is_owned = ptr_is_owned(obj);
64739         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64740         obj_conv.is_owned = false;
64741         LDKCVec_u8Z ret_var = Offer_write(&obj_conv);
64742         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64743         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64744         CVec_u8Z_free(ret_var);
64745         return ret_arr;
64746 }
64747
64748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Amount_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64749         LDKAmount this_obj_conv;
64750         this_obj_conv.inner = untag_ptr(this_obj);
64751         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64753         Amount_free(this_obj_conv);
64754 }
64755
64756 static inline uint64_t Amount_clone_ptr(LDKAmount *NONNULL_PTR arg) {
64757         LDKAmount ret_var = Amount_clone(arg);
64758         int64_t ret_ref = 0;
64759         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64760         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64761         return ret_ref;
64762 }
64763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Amount_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64764         LDKAmount arg_conv;
64765         arg_conv.inner = untag_ptr(arg);
64766         arg_conv.is_owned = ptr_is_owned(arg);
64767         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64768         arg_conv.is_owned = false;
64769         int64_t ret_conv = Amount_clone_ptr(&arg_conv);
64770         return ret_conv;
64771 }
64772
64773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Amount_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64774         LDKAmount orig_conv;
64775         orig_conv.inner = untag_ptr(orig);
64776         orig_conv.is_owned = ptr_is_owned(orig);
64777         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64778         orig_conv.is_owned = false;
64779         LDKAmount ret_var = Amount_clone(&orig_conv);
64780         int64_t ret_ref = 0;
64781         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64782         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64783         return ret_ref;
64784 }
64785
64786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Quantity_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64787         LDKQuantity this_obj_conv;
64788         this_obj_conv.inner = untag_ptr(this_obj);
64789         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64791         Quantity_free(this_obj_conv);
64792 }
64793
64794 static inline uint64_t Quantity_clone_ptr(LDKQuantity *NONNULL_PTR arg) {
64795         LDKQuantity ret_var = Quantity_clone(arg);
64796         int64_t ret_ref = 0;
64797         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64798         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64799         return ret_ref;
64800 }
64801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Quantity_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64802         LDKQuantity arg_conv;
64803         arg_conv.inner = untag_ptr(arg);
64804         arg_conv.is_owned = ptr_is_owned(arg);
64805         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64806         arg_conv.is_owned = false;
64807         int64_t ret_conv = Quantity_clone_ptr(&arg_conv);
64808         return ret_conv;
64809 }
64810
64811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Quantity_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64812         LDKQuantity orig_conv;
64813         orig_conv.inner = untag_ptr(orig);
64814         orig_conv.is_owned = ptr_is_owned(orig);
64815         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64816         orig_conv.is_owned = false;
64817         LDKQuantity ret_var = Quantity_clone(&orig_conv);
64818         int64_t ret_ref = 0;
64819         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64820         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64821         return ret_ref;
64822 }
64823
64824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1from_1str(JNIEnv *env, jclass clz, jstring s) {
64825         LDKStr s_conv = java_to_owned_str(env, s);
64826         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
64827         *ret_conv = Offer_from_str(s_conv);
64828         return tag_ptr(ret_conv, true);
64829 }
64830
64831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64832         LDKUnsignedBolt12Invoice this_obj_conv;
64833         this_obj_conv.inner = untag_ptr(this_obj);
64834         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64836         UnsignedBolt12Invoice_free(this_obj_conv);
64837 }
64838
64839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1tagged_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
64840         LDKUnsignedBolt12Invoice this_arg_conv;
64841         this_arg_conv.inner = untag_ptr(this_arg);
64842         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64844         this_arg_conv.is_owned = false;
64845         LDKTaggedHash ret_var = UnsignedBolt12Invoice_tagged_hash(&this_arg_conv);
64846         int64_t ret_ref = 0;
64847         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64848         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64849         return ret_ref;
64850 }
64851
64852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64853         LDKBolt12Invoice this_obj_conv;
64854         this_obj_conv.inner = untag_ptr(this_obj);
64855         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64857         Bolt12Invoice_free(this_obj_conv);
64858 }
64859
64860 static inline uint64_t Bolt12Invoice_clone_ptr(LDKBolt12Invoice *NONNULL_PTR arg) {
64861         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(arg);
64862         int64_t ret_ref = 0;
64863         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64864         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64865         return ret_ref;
64866 }
64867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64868         LDKBolt12Invoice arg_conv;
64869         arg_conv.inner = untag_ptr(arg);
64870         arg_conv.is_owned = ptr_is_owned(arg);
64871         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64872         arg_conv.is_owned = false;
64873         int64_t ret_conv = Bolt12Invoice_clone_ptr(&arg_conv);
64874         return ret_conv;
64875 }
64876
64877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64878         LDKBolt12Invoice orig_conv;
64879         orig_conv.inner = untag_ptr(orig);
64880         orig_conv.is_owned = ptr_is_owned(orig);
64881         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64882         orig_conv.is_owned = false;
64883         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(&orig_conv);
64884         int64_t ret_ref = 0;
64885         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64886         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64887         return ret_ref;
64888 }
64889
64890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1offer_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
64891         LDKUnsignedBolt12Invoice this_arg_conv;
64892         this_arg_conv.inner = untag_ptr(this_arg);
64893         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64895         this_arg_conv.is_owned = false;
64896         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
64897         *ret_copy = UnsignedBolt12Invoice_offer_chains(&this_arg_conv);
64898         int64_t ret_ref = tag_ptr(ret_copy, true);
64899         return ret_ref;
64900 }
64901
64902 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
64903         LDKUnsignedBolt12Invoice this_arg_conv;
64904         this_arg_conv.inner = untag_ptr(this_arg);
64905         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64907         this_arg_conv.is_owned = false;
64908         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
64909         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, UnsignedBolt12Invoice_chain(&this_arg_conv).data);
64910         return ret_arr;
64911 }
64912
64913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
64914         LDKUnsignedBolt12Invoice this_arg_conv;
64915         this_arg_conv.inner = untag_ptr(this_arg);
64916         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64918         this_arg_conv.is_owned = false;
64919         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
64920         *ret_copy = UnsignedBolt12Invoice_metadata(&this_arg_conv);
64921         int64_t ret_ref = tag_ptr(ret_copy, true);
64922         return ret_ref;
64923 }
64924
64925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
64926         LDKUnsignedBolt12Invoice this_arg_conv;
64927         this_arg_conv.inner = untag_ptr(this_arg);
64928         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64930         this_arg_conv.is_owned = false;
64931         LDKAmount ret_var = UnsignedBolt12Invoice_amount(&this_arg_conv);
64932         int64_t ret_ref = 0;
64933         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64934         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64935         return ret_ref;
64936 }
64937
64938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
64939         LDKUnsignedBolt12Invoice this_arg_conv;
64940         this_arg_conv.inner = untag_ptr(this_arg);
64941         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64943         this_arg_conv.is_owned = false;
64944         LDKOfferFeatures ret_var = UnsignedBolt12Invoice_offer_features(&this_arg_conv);
64945         int64_t ret_ref = 0;
64946         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64947         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64948         return ret_ref;
64949 }
64950
64951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
64952         LDKUnsignedBolt12Invoice this_arg_conv;
64953         this_arg_conv.inner = untag_ptr(this_arg);
64954         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64956         this_arg_conv.is_owned = false;
64957         LDKPrintableString ret_var = UnsignedBolt12Invoice_description(&this_arg_conv);
64958         int64_t ret_ref = 0;
64959         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64960         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64961         return ret_ref;
64962 }
64963
64964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
64965         LDKUnsignedBolt12Invoice this_arg_conv;
64966         this_arg_conv.inner = untag_ptr(this_arg);
64967         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64969         this_arg_conv.is_owned = false;
64970         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
64971         *ret_copy = UnsignedBolt12Invoice_absolute_expiry(&this_arg_conv);
64972         int64_t ret_ref = tag_ptr(ret_copy, true);
64973         return ret_ref;
64974 }
64975
64976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
64977         LDKUnsignedBolt12Invoice this_arg_conv;
64978         this_arg_conv.inner = untag_ptr(this_arg);
64979         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64981         this_arg_conv.is_owned = false;
64982         LDKPrintableString ret_var = UnsignedBolt12Invoice_issuer(&this_arg_conv);
64983         int64_t ret_ref = 0;
64984         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64985         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64986         return ret_ref;
64987 }
64988
64989 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1message_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
64990         LDKUnsignedBolt12Invoice this_arg_conv;
64991         this_arg_conv.inner = untag_ptr(this_arg);
64992         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64994         this_arg_conv.is_owned = false;
64995         LDKCVec_BlindedPathZ ret_var = UnsignedBolt12Invoice_message_paths(&this_arg_conv);
64996         int64_tArray ret_arr = NULL;
64997         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
64998         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
64999         for (size_t n = 0; n < ret_var.datalen; n++) {
65000                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
65001                 int64_t ret_conv_13_ref = 0;
65002                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
65003                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
65004                 ret_arr_ptr[n] = ret_conv_13_ref;
65005         }
65006         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
65007         FREE(ret_var.data);
65008         return ret_arr;
65009 }
65010
65011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
65012         LDKUnsignedBolt12Invoice this_arg_conv;
65013         this_arg_conv.inner = untag_ptr(this_arg);
65014         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65016         this_arg_conv.is_owned = false;
65017         LDKQuantity ret_var = UnsignedBolt12Invoice_supported_quantity(&this_arg_conv);
65018         int64_t ret_ref = 0;
65019         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65020         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65021         return ret_ref;
65022 }
65023
65024 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
65025         LDKUnsignedBolt12Invoice this_arg_conv;
65026         this_arg_conv.inner = untag_ptr(this_arg);
65027         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65029         this_arg_conv.is_owned = false;
65030         LDKu8slice ret_var = UnsignedBolt12Invoice_payer_metadata(&this_arg_conv);
65031         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
65032         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
65033         return ret_arr;
65034 }
65035
65036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1invoice_1request_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
65037         LDKUnsignedBolt12Invoice this_arg_conv;
65038         this_arg_conv.inner = untag_ptr(this_arg);
65039         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65041         this_arg_conv.is_owned = false;
65042         LDKInvoiceRequestFeatures ret_var = UnsignedBolt12Invoice_invoice_request_features(&this_arg_conv);
65043         int64_t ret_ref = 0;
65044         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65045         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65046         return ret_ref;
65047 }
65048
65049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
65050         LDKUnsignedBolt12Invoice this_arg_conv;
65051         this_arg_conv.inner = untag_ptr(this_arg);
65052         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65054         this_arg_conv.is_owned = false;
65055         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
65056         *ret_copy = UnsignedBolt12Invoice_quantity(&this_arg_conv);
65057         int64_t ret_ref = tag_ptr(ret_copy, true);
65058         return ret_ref;
65059 }
65060
65061 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
65062         LDKUnsignedBolt12Invoice this_arg_conv;
65063         this_arg_conv.inner = untag_ptr(this_arg);
65064         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65066         this_arg_conv.is_owned = false;
65067         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
65068         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedBolt12Invoice_payer_id(&this_arg_conv).compressed_form);
65069         return ret_arr;
65070 }
65071
65072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
65073         LDKUnsignedBolt12Invoice this_arg_conv;
65074         this_arg_conv.inner = untag_ptr(this_arg);
65075         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65077         this_arg_conv.is_owned = false;
65078         LDKPrintableString ret_var = UnsignedBolt12Invoice_payer_note(&this_arg_conv);
65079         int64_t ret_ref = 0;
65080         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65081         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65082         return ret_ref;
65083 }
65084
65085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1created_1at(JNIEnv *env, jclass clz, int64_t this_arg) {
65086         LDKUnsignedBolt12Invoice this_arg_conv;
65087         this_arg_conv.inner = untag_ptr(this_arg);
65088         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65090         this_arg_conv.is_owned = false;
65091         int64_t ret_conv = UnsignedBolt12Invoice_created_at(&this_arg_conv);
65092         return ret_conv;
65093 }
65094
65095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1relative_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
65096         LDKUnsignedBolt12Invoice this_arg_conv;
65097         this_arg_conv.inner = untag_ptr(this_arg);
65098         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65100         this_arg_conv.is_owned = false;
65101         int64_t ret_conv = UnsignedBolt12Invoice_relative_expiry(&this_arg_conv);
65102         return ret_conv;
65103 }
65104
65105 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
65106         LDKUnsignedBolt12Invoice this_arg_conv;
65107         this_arg_conv.inner = untag_ptr(this_arg);
65108         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65110         this_arg_conv.is_owned = false;
65111         jboolean ret_conv = UnsignedBolt12Invoice_is_expired(&this_arg_conv);
65112         return ret_conv;
65113 }
65114
65115 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
65116         LDKUnsignedBolt12Invoice this_arg_conv;
65117         this_arg_conv.inner = untag_ptr(this_arg);
65118         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65120         this_arg_conv.is_owned = false;
65121         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
65122         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, UnsignedBolt12Invoice_payment_hash(&this_arg_conv).data);
65123         return ret_arr;
65124 }
65125
65126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
65127         LDKUnsignedBolt12Invoice this_arg_conv;
65128         this_arg_conv.inner = untag_ptr(this_arg);
65129         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65131         this_arg_conv.is_owned = false;
65132         int64_t ret_conv = UnsignedBolt12Invoice_amount_msats(&this_arg_conv);
65133         return ret_conv;
65134 }
65135
65136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
65137         LDKUnsignedBolt12Invoice this_arg_conv;
65138         this_arg_conv.inner = untag_ptr(this_arg);
65139         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65141         this_arg_conv.is_owned = false;
65142         LDKBolt12InvoiceFeatures ret_var = UnsignedBolt12Invoice_invoice_features(&this_arg_conv);
65143         int64_t ret_ref = 0;
65144         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65145         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65146         return ret_ref;
65147 }
65148
65149 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
65150         LDKUnsignedBolt12Invoice this_arg_conv;
65151         this_arg_conv.inner = untag_ptr(this_arg);
65152         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65154         this_arg_conv.is_owned = false;
65155         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
65156         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedBolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form);
65157         return ret_arr;
65158 }
65159
65160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1offer_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
65161         LDKBolt12Invoice this_arg_conv;
65162         this_arg_conv.inner = untag_ptr(this_arg);
65163         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65165         this_arg_conv.is_owned = false;
65166         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
65167         *ret_copy = Bolt12Invoice_offer_chains(&this_arg_conv);
65168         int64_t ret_ref = tag_ptr(ret_copy, true);
65169         return ret_ref;
65170 }
65171
65172 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
65173         LDKBolt12Invoice this_arg_conv;
65174         this_arg_conv.inner = untag_ptr(this_arg);
65175         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65177         this_arg_conv.is_owned = false;
65178         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
65179         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Bolt12Invoice_chain(&this_arg_conv).data);
65180         return ret_arr;
65181 }
65182
65183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
65184         LDKBolt12Invoice this_arg_conv;
65185         this_arg_conv.inner = untag_ptr(this_arg);
65186         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65188         this_arg_conv.is_owned = false;
65189         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
65190         *ret_copy = Bolt12Invoice_metadata(&this_arg_conv);
65191         int64_t ret_ref = tag_ptr(ret_copy, true);
65192         return ret_ref;
65193 }
65194
65195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
65196         LDKBolt12Invoice this_arg_conv;
65197         this_arg_conv.inner = untag_ptr(this_arg);
65198         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65200         this_arg_conv.is_owned = false;
65201         LDKAmount ret_var = Bolt12Invoice_amount(&this_arg_conv);
65202         int64_t ret_ref = 0;
65203         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65204         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65205         return ret_ref;
65206 }
65207
65208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
65209         LDKBolt12Invoice this_arg_conv;
65210         this_arg_conv.inner = untag_ptr(this_arg);
65211         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65213         this_arg_conv.is_owned = false;
65214         LDKOfferFeatures ret_var = Bolt12Invoice_offer_features(&this_arg_conv);
65215         int64_t ret_ref = 0;
65216         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65217         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65218         return ret_ref;
65219 }
65220
65221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
65222         LDKBolt12Invoice this_arg_conv;
65223         this_arg_conv.inner = untag_ptr(this_arg);
65224         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65226         this_arg_conv.is_owned = false;
65227         LDKPrintableString ret_var = Bolt12Invoice_description(&this_arg_conv);
65228         int64_t ret_ref = 0;
65229         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65230         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65231         return ret_ref;
65232 }
65233
65234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
65235         LDKBolt12Invoice this_arg_conv;
65236         this_arg_conv.inner = untag_ptr(this_arg);
65237         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65239         this_arg_conv.is_owned = false;
65240         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
65241         *ret_copy = Bolt12Invoice_absolute_expiry(&this_arg_conv);
65242         int64_t ret_ref = tag_ptr(ret_copy, true);
65243         return ret_ref;
65244 }
65245
65246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
65247         LDKBolt12Invoice this_arg_conv;
65248         this_arg_conv.inner = untag_ptr(this_arg);
65249         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65251         this_arg_conv.is_owned = false;
65252         LDKPrintableString ret_var = Bolt12Invoice_issuer(&this_arg_conv);
65253         int64_t ret_ref = 0;
65254         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65255         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65256         return ret_ref;
65257 }
65258
65259 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1message_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
65260         LDKBolt12Invoice this_arg_conv;
65261         this_arg_conv.inner = untag_ptr(this_arg);
65262         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65264         this_arg_conv.is_owned = false;
65265         LDKCVec_BlindedPathZ ret_var = Bolt12Invoice_message_paths(&this_arg_conv);
65266         int64_tArray ret_arr = NULL;
65267         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
65268         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
65269         for (size_t n = 0; n < ret_var.datalen; n++) {
65270                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
65271                 int64_t ret_conv_13_ref = 0;
65272                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
65273                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
65274                 ret_arr_ptr[n] = ret_conv_13_ref;
65275         }
65276         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
65277         FREE(ret_var.data);
65278         return ret_arr;
65279 }
65280
65281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
65282         LDKBolt12Invoice this_arg_conv;
65283         this_arg_conv.inner = untag_ptr(this_arg);
65284         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65286         this_arg_conv.is_owned = false;
65287         LDKQuantity ret_var = Bolt12Invoice_supported_quantity(&this_arg_conv);
65288         int64_t ret_ref = 0;
65289         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65290         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65291         return ret_ref;
65292 }
65293
65294 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
65295         LDKBolt12Invoice this_arg_conv;
65296         this_arg_conv.inner = untag_ptr(this_arg);
65297         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65299         this_arg_conv.is_owned = false;
65300         LDKu8slice ret_var = Bolt12Invoice_payer_metadata(&this_arg_conv);
65301         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
65302         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
65303         return ret_arr;
65304 }
65305
65306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1invoice_1request_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
65307         LDKBolt12Invoice this_arg_conv;
65308         this_arg_conv.inner = untag_ptr(this_arg);
65309         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65311         this_arg_conv.is_owned = false;
65312         LDKInvoiceRequestFeatures ret_var = Bolt12Invoice_invoice_request_features(&this_arg_conv);
65313         int64_t ret_ref = 0;
65314         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65315         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65316         return ret_ref;
65317 }
65318
65319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
65320         LDKBolt12Invoice this_arg_conv;
65321         this_arg_conv.inner = untag_ptr(this_arg);
65322         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65324         this_arg_conv.is_owned = false;
65325         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
65326         *ret_copy = Bolt12Invoice_quantity(&this_arg_conv);
65327         int64_t ret_ref = tag_ptr(ret_copy, true);
65328         return ret_ref;
65329 }
65330
65331 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
65332         LDKBolt12Invoice this_arg_conv;
65333         this_arg_conv.inner = untag_ptr(this_arg);
65334         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65336         this_arg_conv.is_owned = false;
65337         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
65338         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Bolt12Invoice_payer_id(&this_arg_conv).compressed_form);
65339         return ret_arr;
65340 }
65341
65342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
65343         LDKBolt12Invoice this_arg_conv;
65344         this_arg_conv.inner = untag_ptr(this_arg);
65345         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65347         this_arg_conv.is_owned = false;
65348         LDKPrintableString ret_var = Bolt12Invoice_payer_note(&this_arg_conv);
65349         int64_t ret_ref = 0;
65350         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65351         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65352         return ret_ref;
65353 }
65354
65355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1created_1at(JNIEnv *env, jclass clz, int64_t this_arg) {
65356         LDKBolt12Invoice this_arg_conv;
65357         this_arg_conv.inner = untag_ptr(this_arg);
65358         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65360         this_arg_conv.is_owned = false;
65361         int64_t ret_conv = Bolt12Invoice_created_at(&this_arg_conv);
65362         return ret_conv;
65363 }
65364
65365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1relative_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
65366         LDKBolt12Invoice this_arg_conv;
65367         this_arg_conv.inner = untag_ptr(this_arg);
65368         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65370         this_arg_conv.is_owned = false;
65371         int64_t ret_conv = Bolt12Invoice_relative_expiry(&this_arg_conv);
65372         return ret_conv;
65373 }
65374
65375 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
65376         LDKBolt12Invoice this_arg_conv;
65377         this_arg_conv.inner = untag_ptr(this_arg);
65378         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65380         this_arg_conv.is_owned = false;
65381         jboolean ret_conv = Bolt12Invoice_is_expired(&this_arg_conv);
65382         return ret_conv;
65383 }
65384
65385 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
65386         LDKBolt12Invoice this_arg_conv;
65387         this_arg_conv.inner = untag_ptr(this_arg);
65388         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65390         this_arg_conv.is_owned = false;
65391         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
65392         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Bolt12Invoice_payment_hash(&this_arg_conv).data);
65393         return ret_arr;
65394 }
65395
65396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
65397         LDKBolt12Invoice this_arg_conv;
65398         this_arg_conv.inner = untag_ptr(this_arg);
65399         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65401         this_arg_conv.is_owned = false;
65402         int64_t ret_conv = Bolt12Invoice_amount_msats(&this_arg_conv);
65403         return ret_conv;
65404 }
65405
65406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
65407         LDKBolt12Invoice this_arg_conv;
65408         this_arg_conv.inner = untag_ptr(this_arg);
65409         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65411         this_arg_conv.is_owned = false;
65412         LDKBolt12InvoiceFeatures ret_var = Bolt12Invoice_invoice_features(&this_arg_conv);
65413         int64_t ret_ref = 0;
65414         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65415         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65416         return ret_ref;
65417 }
65418
65419 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
65420         LDKBolt12Invoice this_arg_conv;
65421         this_arg_conv.inner = untag_ptr(this_arg);
65422         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65424         this_arg_conv.is_owned = false;
65425         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
65426         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Bolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form);
65427         return ret_arr;
65428 }
65429
65430 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
65431         LDKBolt12Invoice this_arg_conv;
65432         this_arg_conv.inner = untag_ptr(this_arg);
65433         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65435         this_arg_conv.is_owned = false;
65436         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
65437         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, Bolt12Invoice_signature(&this_arg_conv).compact_form);
65438         return ret_arr;
65439 }
65440
65441 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
65442         LDKBolt12Invoice this_arg_conv;
65443         this_arg_conv.inner = untag_ptr(this_arg);
65444         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65446         this_arg_conv.is_owned = false;
65447         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
65448         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Bolt12Invoice_signable_hash(&this_arg_conv).data);
65449         return ret_arr;
65450 }
65451
65452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t key) {
65453         LDKBolt12Invoice this_arg_conv;
65454         this_arg_conv.inner = untag_ptr(this_arg);
65455         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65457         this_arg_conv.is_owned = false;
65458         LDKExpandedKey key_conv;
65459         key_conv.inner = untag_ptr(key);
65460         key_conv.is_owned = ptr_is_owned(key);
65461         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
65462         key_conv.is_owned = false;
65463         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
65464         *ret_conv = Bolt12Invoice_verify(&this_arg_conv, &key_conv);
65465         return tag_ptr(ret_conv, true);
65466 }
65467
65468 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1write(JNIEnv *env, jclass clz, int64_t obj) {
65469         LDKUnsignedBolt12Invoice obj_conv;
65470         obj_conv.inner = untag_ptr(obj);
65471         obj_conv.is_owned = ptr_is_owned(obj);
65472         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65473         obj_conv.is_owned = false;
65474         LDKCVec_u8Z ret_var = UnsignedBolt12Invoice_write(&obj_conv);
65475         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
65476         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
65477         CVec_u8Z_free(ret_var);
65478         return ret_arr;
65479 }
65480
65481 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1write(JNIEnv *env, jclass clz, int64_t obj) {
65482         LDKBolt12Invoice obj_conv;
65483         obj_conv.inner = untag_ptr(obj);
65484         obj_conv.is_owned = ptr_is_owned(obj);
65485         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65486         obj_conv.is_owned = false;
65487         LDKCVec_u8Z ret_var = Bolt12Invoice_write(&obj_conv);
65488         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
65489         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
65490         CVec_u8Z_free(ret_var);
65491         return ret_arr;
65492 }
65493
65494 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65495         LDKBlindedPayInfo this_obj_conv;
65496         this_obj_conv.inner = untag_ptr(this_obj);
65497         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65499         BlindedPayInfo_free(this_obj_conv);
65500 }
65501
65502 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
65503         LDKBlindedPayInfo this_ptr_conv;
65504         this_ptr_conv.inner = untag_ptr(this_ptr);
65505         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65507         this_ptr_conv.is_owned = false;
65508         int32_t ret_conv = BlindedPayInfo_get_fee_base_msat(&this_ptr_conv);
65509         return ret_conv;
65510 }
65511
65512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
65513         LDKBlindedPayInfo this_ptr_conv;
65514         this_ptr_conv.inner = untag_ptr(this_ptr);
65515         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65517         this_ptr_conv.is_owned = false;
65518         BlindedPayInfo_set_fee_base_msat(&this_ptr_conv, val);
65519 }
65520
65521 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
65522         LDKBlindedPayInfo this_ptr_conv;
65523         this_ptr_conv.inner = untag_ptr(this_ptr);
65524         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65526         this_ptr_conv.is_owned = false;
65527         int32_t ret_conv = BlindedPayInfo_get_fee_proportional_millionths(&this_ptr_conv);
65528         return ret_conv;
65529 }
65530
65531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
65532         LDKBlindedPayInfo this_ptr_conv;
65533         this_ptr_conv.inner = untag_ptr(this_ptr);
65534         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65536         this_ptr_conv.is_owned = false;
65537         BlindedPayInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
65538 }
65539
65540 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
65541         LDKBlindedPayInfo this_ptr_conv;
65542         this_ptr_conv.inner = untag_ptr(this_ptr);
65543         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65545         this_ptr_conv.is_owned = false;
65546         int16_t ret_conv = BlindedPayInfo_get_cltv_expiry_delta(&this_ptr_conv);
65547         return ret_conv;
65548 }
65549
65550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
65551         LDKBlindedPayInfo this_ptr_conv;
65552         this_ptr_conv.inner = untag_ptr(this_ptr);
65553         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65555         this_ptr_conv.is_owned = false;
65556         BlindedPayInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
65557 }
65558
65559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
65560         LDKBlindedPayInfo this_ptr_conv;
65561         this_ptr_conv.inner = untag_ptr(this_ptr);
65562         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65564         this_ptr_conv.is_owned = false;
65565         int64_t ret_conv = BlindedPayInfo_get_htlc_minimum_msat(&this_ptr_conv);
65566         return ret_conv;
65567 }
65568
65569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65570         LDKBlindedPayInfo this_ptr_conv;
65571         this_ptr_conv.inner = untag_ptr(this_ptr);
65572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65574         this_ptr_conv.is_owned = false;
65575         BlindedPayInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
65576 }
65577
65578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
65579         LDKBlindedPayInfo this_ptr_conv;
65580         this_ptr_conv.inner = untag_ptr(this_ptr);
65581         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65583         this_ptr_conv.is_owned = false;
65584         int64_t ret_conv = BlindedPayInfo_get_htlc_maximum_msat(&this_ptr_conv);
65585         return ret_conv;
65586 }
65587
65588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65589         LDKBlindedPayInfo this_ptr_conv;
65590         this_ptr_conv.inner = untag_ptr(this_ptr);
65591         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65593         this_ptr_conv.is_owned = false;
65594         BlindedPayInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
65595 }
65596
65597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
65598         LDKBlindedPayInfo this_ptr_conv;
65599         this_ptr_conv.inner = untag_ptr(this_ptr);
65600         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65602         this_ptr_conv.is_owned = false;
65603         LDKBlindedHopFeatures ret_var = BlindedPayInfo_get_features(&this_ptr_conv);
65604         int64_t ret_ref = 0;
65605         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65606         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65607         return ret_ref;
65608 }
65609
65610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65611         LDKBlindedPayInfo this_ptr_conv;
65612         this_ptr_conv.inner = untag_ptr(this_ptr);
65613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65615         this_ptr_conv.is_owned = false;
65616         LDKBlindedHopFeatures val_conv;
65617         val_conv.inner = untag_ptr(val);
65618         val_conv.is_owned = ptr_is_owned(val);
65619         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
65620         val_conv = BlindedHopFeatures_clone(&val_conv);
65621         BlindedPayInfo_set_features(&this_ptr_conv, val_conv);
65622 }
65623
65624 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) {
65625         LDKBlindedHopFeatures features_arg_conv;
65626         features_arg_conv.inner = untag_ptr(features_arg);
65627         features_arg_conv.is_owned = ptr_is_owned(features_arg);
65628         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
65629         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
65630         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);
65631         int64_t ret_ref = 0;
65632         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65633         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65634         return ret_ref;
65635 }
65636
65637 static inline uint64_t BlindedPayInfo_clone_ptr(LDKBlindedPayInfo *NONNULL_PTR arg) {
65638         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(arg);
65639         int64_t ret_ref = 0;
65640         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65641         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65642         return ret_ref;
65643 }
65644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65645         LDKBlindedPayInfo arg_conv;
65646         arg_conv.inner = untag_ptr(arg);
65647         arg_conv.is_owned = ptr_is_owned(arg);
65648         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65649         arg_conv.is_owned = false;
65650         int64_t ret_conv = BlindedPayInfo_clone_ptr(&arg_conv);
65651         return ret_conv;
65652 }
65653
65654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65655         LDKBlindedPayInfo orig_conv;
65656         orig_conv.inner = untag_ptr(orig);
65657         orig_conv.is_owned = ptr_is_owned(orig);
65658         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65659         orig_conv.is_owned = false;
65660         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(&orig_conv);
65661         int64_t ret_ref = 0;
65662         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65663         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65664         return ret_ref;
65665 }
65666
65667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1hash(JNIEnv *env, jclass clz, int64_t o) {
65668         LDKBlindedPayInfo o_conv;
65669         o_conv.inner = untag_ptr(o);
65670         o_conv.is_owned = ptr_is_owned(o);
65671         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65672         o_conv.is_owned = false;
65673         int64_t ret_conv = BlindedPayInfo_hash(&o_conv);
65674         return ret_conv;
65675 }
65676
65677 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
65678         LDKBlindedPayInfo a_conv;
65679         a_conv.inner = untag_ptr(a);
65680         a_conv.is_owned = ptr_is_owned(a);
65681         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65682         a_conv.is_owned = false;
65683         LDKBlindedPayInfo b_conv;
65684         b_conv.inner = untag_ptr(b);
65685         b_conv.is_owned = ptr_is_owned(b);
65686         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65687         b_conv.is_owned = false;
65688         jboolean ret_conv = BlindedPayInfo_eq(&a_conv, &b_conv);
65689         return ret_conv;
65690 }
65691
65692 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
65693         LDKBlindedPayInfo obj_conv;
65694         obj_conv.inner = untag_ptr(obj);
65695         obj_conv.is_owned = ptr_is_owned(obj);
65696         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65697         obj_conv.is_owned = false;
65698         LDKCVec_u8Z ret_var = BlindedPayInfo_write(&obj_conv);
65699         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
65700         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
65701         CVec_u8Z_free(ret_var);
65702         return ret_arr;
65703 }
65704
65705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
65706         LDKu8slice ser_ref;
65707         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
65708         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
65709         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
65710         *ret_conv = BlindedPayInfo_read(ser_ref);
65711         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
65712         return tag_ptr(ret_conv, true);
65713 }
65714
65715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65716         LDKInvoiceError this_obj_conv;
65717         this_obj_conv.inner = untag_ptr(this_obj);
65718         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65720         InvoiceError_free(this_obj_conv);
65721 }
65722
65723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1get_1erroneous_1field(JNIEnv *env, jclass clz, int64_t this_ptr) {
65724         LDKInvoiceError this_ptr_conv;
65725         this_ptr_conv.inner = untag_ptr(this_ptr);
65726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65728         this_ptr_conv.is_owned = false;
65729         LDKErroneousField ret_var = InvoiceError_get_erroneous_field(&this_ptr_conv);
65730         int64_t ret_ref = 0;
65731         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65732         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65733         return ret_ref;
65734 }
65735
65736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceError_1set_1erroneous_1field(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65737         LDKInvoiceError this_ptr_conv;
65738         this_ptr_conv.inner = untag_ptr(this_ptr);
65739         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65741         this_ptr_conv.is_owned = false;
65742         LDKErroneousField val_conv;
65743         val_conv.inner = untag_ptr(val);
65744         val_conv.is_owned = ptr_is_owned(val);
65745         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
65746         val_conv = ErroneousField_clone(&val_conv);
65747         InvoiceError_set_erroneous_field(&this_ptr_conv, val_conv);
65748 }
65749
65750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1get_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
65751         LDKInvoiceError this_ptr_conv;
65752         this_ptr_conv.inner = untag_ptr(this_ptr);
65753         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65755         this_ptr_conv.is_owned = false;
65756         LDKUntrustedString ret_var = InvoiceError_get_message(&this_ptr_conv);
65757         int64_t ret_ref = 0;
65758         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65759         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65760         return ret_ref;
65761 }
65762
65763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceError_1set_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65764         LDKInvoiceError this_ptr_conv;
65765         this_ptr_conv.inner = untag_ptr(this_ptr);
65766         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65768         this_ptr_conv.is_owned = false;
65769         LDKUntrustedString val_conv;
65770         val_conv.inner = untag_ptr(val);
65771         val_conv.is_owned = ptr_is_owned(val);
65772         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
65773         val_conv = UntrustedString_clone(&val_conv);
65774         InvoiceError_set_message(&this_ptr_conv, val_conv);
65775 }
65776
65777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1new(JNIEnv *env, jclass clz, int64_t erroneous_field_arg, int64_t message_arg) {
65778         LDKErroneousField erroneous_field_arg_conv;
65779         erroneous_field_arg_conv.inner = untag_ptr(erroneous_field_arg);
65780         erroneous_field_arg_conv.is_owned = ptr_is_owned(erroneous_field_arg);
65781         CHECK_INNER_FIELD_ACCESS_OR_NULL(erroneous_field_arg_conv);
65782         erroneous_field_arg_conv = ErroneousField_clone(&erroneous_field_arg_conv);
65783         LDKUntrustedString message_arg_conv;
65784         message_arg_conv.inner = untag_ptr(message_arg);
65785         message_arg_conv.is_owned = ptr_is_owned(message_arg);
65786         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_arg_conv);
65787         message_arg_conv = UntrustedString_clone(&message_arg_conv);
65788         LDKInvoiceError ret_var = InvoiceError_new(erroneous_field_arg_conv, message_arg_conv);
65789         int64_t ret_ref = 0;
65790         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65791         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65792         return ret_ref;
65793 }
65794
65795 static inline uint64_t InvoiceError_clone_ptr(LDKInvoiceError *NONNULL_PTR arg) {
65796         LDKInvoiceError ret_var = InvoiceError_clone(arg);
65797         int64_t ret_ref = 0;
65798         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65799         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65800         return ret_ref;
65801 }
65802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65803         LDKInvoiceError arg_conv;
65804         arg_conv.inner = untag_ptr(arg);
65805         arg_conv.is_owned = ptr_is_owned(arg);
65806         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65807         arg_conv.is_owned = false;
65808         int64_t ret_conv = InvoiceError_clone_ptr(&arg_conv);
65809         return ret_conv;
65810 }
65811
65812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65813         LDKInvoiceError orig_conv;
65814         orig_conv.inner = untag_ptr(orig);
65815         orig_conv.is_owned = ptr_is_owned(orig);
65816         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65817         orig_conv.is_owned = false;
65818         LDKInvoiceError ret_var = InvoiceError_clone(&orig_conv);
65819         int64_t ret_ref = 0;
65820         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65821         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65822         return ret_ref;
65823 }
65824
65825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroneousField_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65826         LDKErroneousField this_obj_conv;
65827         this_obj_conv.inner = untag_ptr(this_obj);
65828         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65830         ErroneousField_free(this_obj_conv);
65831 }
65832
65833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1get_1tlv_1fieldnum(JNIEnv *env, jclass clz, int64_t this_ptr) {
65834         LDKErroneousField this_ptr_conv;
65835         this_ptr_conv.inner = untag_ptr(this_ptr);
65836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65838         this_ptr_conv.is_owned = false;
65839         int64_t ret_conv = ErroneousField_get_tlv_fieldnum(&this_ptr_conv);
65840         return ret_conv;
65841 }
65842
65843 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroneousField_1set_1tlv_1fieldnum(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65844         LDKErroneousField this_ptr_conv;
65845         this_ptr_conv.inner = untag_ptr(this_ptr);
65846         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65848         this_ptr_conv.is_owned = false;
65849         ErroneousField_set_tlv_fieldnum(&this_ptr_conv, val);
65850 }
65851
65852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1get_1suggested_1value(JNIEnv *env, jclass clz, int64_t this_ptr) {
65853         LDKErroneousField this_ptr_conv;
65854         this_ptr_conv.inner = untag_ptr(this_ptr);
65855         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65857         this_ptr_conv.is_owned = false;
65858         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
65859         *ret_copy = ErroneousField_get_suggested_value(&this_ptr_conv);
65860         int64_t ret_ref = tag_ptr(ret_copy, true);
65861         return ret_ref;
65862 }
65863
65864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroneousField_1set_1suggested_1value(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65865         LDKErroneousField this_ptr_conv;
65866         this_ptr_conv.inner = untag_ptr(this_ptr);
65867         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65869         this_ptr_conv.is_owned = false;
65870         void* val_ptr = untag_ptr(val);
65871         CHECK_ACCESS(val_ptr);
65872         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
65873         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
65874         ErroneousField_set_suggested_value(&this_ptr_conv, val_conv);
65875 }
65876
65877 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) {
65878         void* suggested_value_arg_ptr = untag_ptr(suggested_value_arg);
65879         CHECK_ACCESS(suggested_value_arg_ptr);
65880         LDKCOption_CVec_u8ZZ suggested_value_arg_conv = *(LDKCOption_CVec_u8ZZ*)(suggested_value_arg_ptr);
65881         suggested_value_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(suggested_value_arg));
65882         LDKErroneousField ret_var = ErroneousField_new(tlv_fieldnum_arg, suggested_value_arg_conv);
65883         int64_t ret_ref = 0;
65884         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65885         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65886         return ret_ref;
65887 }
65888
65889 static inline uint64_t ErroneousField_clone_ptr(LDKErroneousField *NONNULL_PTR arg) {
65890         LDKErroneousField ret_var = ErroneousField_clone(arg);
65891         int64_t ret_ref = 0;
65892         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65893         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65894         return ret_ref;
65895 }
65896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65897         LDKErroneousField arg_conv;
65898         arg_conv.inner = untag_ptr(arg);
65899         arg_conv.is_owned = ptr_is_owned(arg);
65900         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65901         arg_conv.is_owned = false;
65902         int64_t ret_conv = ErroneousField_clone_ptr(&arg_conv);
65903         return ret_conv;
65904 }
65905
65906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65907         LDKErroneousField orig_conv;
65908         orig_conv.inner = untag_ptr(orig);
65909         orig_conv.is_owned = ptr_is_owned(orig);
65910         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65911         orig_conv.is_owned = false;
65912         LDKErroneousField ret_var = ErroneousField_clone(&orig_conv);
65913         int64_t ret_ref = 0;
65914         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65915         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65916         return ret_ref;
65917 }
65918
65919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1from_1string(JNIEnv *env, jclass clz, jstring s) {
65920         LDKStr s_conv = java_to_owned_str(env, s);
65921         LDKInvoiceError ret_var = InvoiceError_from_string(s_conv);
65922         int64_t ret_ref = 0;
65923         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65924         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65925         return ret_ref;
65926 }
65927
65928 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceError_1write(JNIEnv *env, jclass clz, int64_t obj) {
65929         LDKInvoiceError obj_conv;
65930         obj_conv.inner = untag_ptr(obj);
65931         obj_conv.is_owned = ptr_is_owned(obj);
65932         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65933         obj_conv.is_owned = false;
65934         LDKCVec_u8Z ret_var = InvoiceError_write(&obj_conv);
65935         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
65936         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
65937         CVec_u8Z_free(ret_var);
65938         return ret_arr;
65939 }
65940
65941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
65942         LDKu8slice ser_ref;
65943         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
65944         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
65945         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
65946         *ret_conv = InvoiceError_read(ser_ref);
65947         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
65948         return tag_ptr(ret_conv, true);
65949 }
65950
65951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65952         LDKUnsignedInvoiceRequest this_obj_conv;
65953         this_obj_conv.inner = untag_ptr(this_obj);
65954         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65956         UnsignedInvoiceRequest_free(this_obj_conv);
65957 }
65958
65959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1tagged_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
65960         LDKUnsignedInvoiceRequest this_arg_conv;
65961         this_arg_conv.inner = untag_ptr(this_arg);
65962         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65964         this_arg_conv.is_owned = false;
65965         LDKTaggedHash ret_var = UnsignedInvoiceRequest_tagged_hash(&this_arg_conv);
65966         int64_t ret_ref = 0;
65967         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65968         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65969         return ret_ref;
65970 }
65971
65972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65973         LDKInvoiceRequest this_obj_conv;
65974         this_obj_conv.inner = untag_ptr(this_obj);
65975         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65977         InvoiceRequest_free(this_obj_conv);
65978 }
65979
65980 static inline uint64_t InvoiceRequest_clone_ptr(LDKInvoiceRequest *NONNULL_PTR arg) {
65981         LDKInvoiceRequest ret_var = InvoiceRequest_clone(arg);
65982         int64_t ret_ref = 0;
65983         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65984         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65985         return ret_ref;
65986 }
65987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65988         LDKInvoiceRequest arg_conv;
65989         arg_conv.inner = untag_ptr(arg);
65990         arg_conv.is_owned = ptr_is_owned(arg);
65991         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65992         arg_conv.is_owned = false;
65993         int64_t ret_conv = InvoiceRequest_clone_ptr(&arg_conv);
65994         return ret_conv;
65995 }
65996
65997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65998         LDKInvoiceRequest orig_conv;
65999         orig_conv.inner = untag_ptr(orig);
66000         orig_conv.is_owned = ptr_is_owned(orig);
66001         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66002         orig_conv.is_owned = false;
66003         LDKInvoiceRequest ret_var = InvoiceRequest_clone(&orig_conv);
66004         int64_t ret_ref = 0;
66005         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66006         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66007         return ret_ref;
66008 }
66009
66010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66011         LDKVerifiedInvoiceRequest this_obj_conv;
66012         this_obj_conv.inner = untag_ptr(this_obj);
66013         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66015         VerifiedInvoiceRequest_free(this_obj_conv);
66016 }
66017
66018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1get_1keys(JNIEnv *env, jclass clz, int64_t this_ptr) {
66019         LDKVerifiedInvoiceRequest this_ptr_conv;
66020         this_ptr_conv.inner = untag_ptr(this_ptr);
66021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66023         this_ptr_conv.is_owned = false;
66024         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
66025         *ret_copy = VerifiedInvoiceRequest_get_keys(&this_ptr_conv);
66026         int64_t ret_ref = tag_ptr(ret_copy, true);
66027         return ret_ref;
66028 }
66029
66030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1set_1keys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66031         LDKVerifiedInvoiceRequest this_ptr_conv;
66032         this_ptr_conv.inner = untag_ptr(this_ptr);
66033         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66035         this_ptr_conv.is_owned = false;
66036         void* val_ptr = untag_ptr(val);
66037         CHECK_ACCESS(val_ptr);
66038         LDKCOption_SecretKeyZ val_conv = *(LDKCOption_SecretKeyZ*)(val_ptr);
66039         val_conv = COption_SecretKeyZ_clone((LDKCOption_SecretKeyZ*)untag_ptr(val));
66040         VerifiedInvoiceRequest_set_keys(&this_ptr_conv, val_conv);
66041 }
66042
66043 static inline uint64_t VerifiedInvoiceRequest_clone_ptr(LDKVerifiedInvoiceRequest *NONNULL_PTR arg) {
66044         LDKVerifiedInvoiceRequest ret_var = VerifiedInvoiceRequest_clone(arg);
66045         int64_t ret_ref = 0;
66046         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66047         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66048         return ret_ref;
66049 }
66050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
66051         LDKVerifiedInvoiceRequest arg_conv;
66052         arg_conv.inner = untag_ptr(arg);
66053         arg_conv.is_owned = ptr_is_owned(arg);
66054         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66055         arg_conv.is_owned = false;
66056         int64_t ret_conv = VerifiedInvoiceRequest_clone_ptr(&arg_conv);
66057         return ret_conv;
66058 }
66059
66060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66061         LDKVerifiedInvoiceRequest orig_conv;
66062         orig_conv.inner = untag_ptr(orig);
66063         orig_conv.is_owned = ptr_is_owned(orig);
66064         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66065         orig_conv.is_owned = false;
66066         LDKVerifiedInvoiceRequest ret_var = VerifiedInvoiceRequest_clone(&orig_conv);
66067         int64_t ret_ref = 0;
66068         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66069         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66070         return ret_ref;
66071 }
66072
66073 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
66074         LDKUnsignedInvoiceRequest this_arg_conv;
66075         this_arg_conv.inner = untag_ptr(this_arg);
66076         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66078         this_arg_conv.is_owned = false;
66079         LDKCVec_ThirtyTwoBytesZ ret_var = UnsignedInvoiceRequest_chains(&this_arg_conv);
66080         jobjectArray ret_arr = NULL;
66081         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
66082         ;
66083         for (size_t i = 0; i < ret_var.datalen; i++) {
66084                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
66085                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
66086                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
66087         }
66088         
66089         FREE(ret_var.data);
66090         return ret_arr;
66091 }
66092
66093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
66094         LDKUnsignedInvoiceRequest this_arg_conv;
66095         this_arg_conv.inner = untag_ptr(this_arg);
66096         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66098         this_arg_conv.is_owned = false;
66099         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
66100         *ret_copy = UnsignedInvoiceRequest_metadata(&this_arg_conv);
66101         int64_t ret_ref = tag_ptr(ret_copy, true);
66102         return ret_ref;
66103 }
66104
66105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
66106         LDKUnsignedInvoiceRequest this_arg_conv;
66107         this_arg_conv.inner = untag_ptr(this_arg);
66108         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66110         this_arg_conv.is_owned = false;
66111         LDKAmount ret_var = UnsignedInvoiceRequest_amount(&this_arg_conv);
66112         int64_t ret_ref = 0;
66113         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66114         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66115         return ret_ref;
66116 }
66117
66118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
66119         LDKUnsignedInvoiceRequest this_arg_conv;
66120         this_arg_conv.inner = untag_ptr(this_arg);
66121         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66123         this_arg_conv.is_owned = false;
66124         LDKPrintableString ret_var = UnsignedInvoiceRequest_description(&this_arg_conv);
66125         int64_t ret_ref = 0;
66126         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66127         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66128         return ret_ref;
66129 }
66130
66131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
66132         LDKUnsignedInvoiceRequest this_arg_conv;
66133         this_arg_conv.inner = untag_ptr(this_arg);
66134         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66136         this_arg_conv.is_owned = false;
66137         LDKOfferFeatures ret_var = UnsignedInvoiceRequest_offer_features(&this_arg_conv);
66138         int64_t ret_ref = 0;
66139         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66140         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66141         return ret_ref;
66142 }
66143
66144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
66145         LDKUnsignedInvoiceRequest this_arg_conv;
66146         this_arg_conv.inner = untag_ptr(this_arg);
66147         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66149         this_arg_conv.is_owned = false;
66150         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66151         *ret_copy = UnsignedInvoiceRequest_absolute_expiry(&this_arg_conv);
66152         int64_t ret_ref = tag_ptr(ret_copy, true);
66153         return ret_ref;
66154 }
66155
66156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
66157         LDKUnsignedInvoiceRequest this_arg_conv;
66158         this_arg_conv.inner = untag_ptr(this_arg);
66159         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66161         this_arg_conv.is_owned = false;
66162         LDKPrintableString ret_var = UnsignedInvoiceRequest_issuer(&this_arg_conv);
66163         int64_t ret_ref = 0;
66164         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66165         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66166         return ret_ref;
66167 }
66168
66169 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
66170         LDKUnsignedInvoiceRequest this_arg_conv;
66171         this_arg_conv.inner = untag_ptr(this_arg);
66172         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66174         this_arg_conv.is_owned = false;
66175         LDKCVec_BlindedPathZ ret_var = UnsignedInvoiceRequest_paths(&this_arg_conv);
66176         int64_tArray ret_arr = NULL;
66177         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
66178         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
66179         for (size_t n = 0; n < ret_var.datalen; n++) {
66180                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
66181                 int64_t ret_conv_13_ref = 0;
66182                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
66183                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
66184                 ret_arr_ptr[n] = ret_conv_13_ref;
66185         }
66186         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
66187         FREE(ret_var.data);
66188         return ret_arr;
66189 }
66190
66191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
66192         LDKUnsignedInvoiceRequest this_arg_conv;
66193         this_arg_conv.inner = untag_ptr(this_arg);
66194         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66196         this_arg_conv.is_owned = false;
66197         LDKQuantity ret_var = UnsignedInvoiceRequest_supported_quantity(&this_arg_conv);
66198         int64_t ret_ref = 0;
66199         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66200         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66201         return ret_ref;
66202 }
66203
66204 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
66205         LDKUnsignedInvoiceRequest this_arg_conv;
66206         this_arg_conv.inner = untag_ptr(this_arg);
66207         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66209         this_arg_conv.is_owned = false;
66210         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
66211         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedInvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form);
66212         return ret_arr;
66213 }
66214
66215 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
66216         LDKUnsignedInvoiceRequest this_arg_conv;
66217         this_arg_conv.inner = untag_ptr(this_arg);
66218         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66220         this_arg_conv.is_owned = false;
66221         LDKu8slice ret_var = UnsignedInvoiceRequest_payer_metadata(&this_arg_conv);
66222         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
66223         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
66224         return ret_arr;
66225 }
66226
66227 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
66228         LDKUnsignedInvoiceRequest this_arg_conv;
66229         this_arg_conv.inner = untag_ptr(this_arg);
66230         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66232         this_arg_conv.is_owned = false;
66233         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
66234         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, UnsignedInvoiceRequest_chain(&this_arg_conv).data);
66235         return ret_arr;
66236 }
66237
66238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
66239         LDKUnsignedInvoiceRequest this_arg_conv;
66240         this_arg_conv.inner = untag_ptr(this_arg);
66241         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66243         this_arg_conv.is_owned = false;
66244         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66245         *ret_copy = UnsignedInvoiceRequest_amount_msats(&this_arg_conv);
66246         int64_t ret_ref = tag_ptr(ret_copy, true);
66247         return ret_ref;
66248 }
66249
66250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1invoice_1request_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
66251         LDKUnsignedInvoiceRequest this_arg_conv;
66252         this_arg_conv.inner = untag_ptr(this_arg);
66253         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66255         this_arg_conv.is_owned = false;
66256         LDKInvoiceRequestFeatures ret_var = UnsignedInvoiceRequest_invoice_request_features(&this_arg_conv);
66257         int64_t ret_ref = 0;
66258         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66259         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66260         return ret_ref;
66261 }
66262
66263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
66264         LDKUnsignedInvoiceRequest this_arg_conv;
66265         this_arg_conv.inner = untag_ptr(this_arg);
66266         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66268         this_arg_conv.is_owned = false;
66269         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66270         *ret_copy = UnsignedInvoiceRequest_quantity(&this_arg_conv);
66271         int64_t ret_ref = tag_ptr(ret_copy, true);
66272         return ret_ref;
66273 }
66274
66275 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
66276         LDKUnsignedInvoiceRequest this_arg_conv;
66277         this_arg_conv.inner = untag_ptr(this_arg);
66278         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66280         this_arg_conv.is_owned = false;
66281         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
66282         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedInvoiceRequest_payer_id(&this_arg_conv).compressed_form);
66283         return ret_arr;
66284 }
66285
66286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
66287         LDKUnsignedInvoiceRequest this_arg_conv;
66288         this_arg_conv.inner = untag_ptr(this_arg);
66289         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66291         this_arg_conv.is_owned = false;
66292         LDKPrintableString ret_var = UnsignedInvoiceRequest_payer_note(&this_arg_conv);
66293         int64_t ret_ref = 0;
66294         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66295         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66296         return ret_ref;
66297 }
66298
66299 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
66300         LDKInvoiceRequest this_arg_conv;
66301         this_arg_conv.inner = untag_ptr(this_arg);
66302         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66304         this_arg_conv.is_owned = false;
66305         LDKCVec_ThirtyTwoBytesZ ret_var = InvoiceRequest_chains(&this_arg_conv);
66306         jobjectArray ret_arr = NULL;
66307         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
66308         ;
66309         for (size_t i = 0; i < ret_var.datalen; i++) {
66310                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
66311                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
66312                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
66313         }
66314         
66315         FREE(ret_var.data);
66316         return ret_arr;
66317 }
66318
66319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
66320         LDKInvoiceRequest this_arg_conv;
66321         this_arg_conv.inner = untag_ptr(this_arg);
66322         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66324         this_arg_conv.is_owned = false;
66325         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
66326         *ret_copy = InvoiceRequest_metadata(&this_arg_conv);
66327         int64_t ret_ref = tag_ptr(ret_copy, true);
66328         return ret_ref;
66329 }
66330
66331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
66332         LDKInvoiceRequest this_arg_conv;
66333         this_arg_conv.inner = untag_ptr(this_arg);
66334         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66336         this_arg_conv.is_owned = false;
66337         LDKAmount ret_var = InvoiceRequest_amount(&this_arg_conv);
66338         int64_t ret_ref = 0;
66339         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66340         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66341         return ret_ref;
66342 }
66343
66344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
66345         LDKInvoiceRequest this_arg_conv;
66346         this_arg_conv.inner = untag_ptr(this_arg);
66347         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66349         this_arg_conv.is_owned = false;
66350         LDKPrintableString ret_var = InvoiceRequest_description(&this_arg_conv);
66351         int64_t ret_ref = 0;
66352         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66353         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66354         return ret_ref;
66355 }
66356
66357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
66358         LDKInvoiceRequest this_arg_conv;
66359         this_arg_conv.inner = untag_ptr(this_arg);
66360         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66362         this_arg_conv.is_owned = false;
66363         LDKOfferFeatures ret_var = InvoiceRequest_offer_features(&this_arg_conv);
66364         int64_t ret_ref = 0;
66365         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66366         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66367         return ret_ref;
66368 }
66369
66370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
66371         LDKInvoiceRequest this_arg_conv;
66372         this_arg_conv.inner = untag_ptr(this_arg);
66373         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66375         this_arg_conv.is_owned = false;
66376         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66377         *ret_copy = InvoiceRequest_absolute_expiry(&this_arg_conv);
66378         int64_t ret_ref = tag_ptr(ret_copy, true);
66379         return ret_ref;
66380 }
66381
66382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
66383         LDKInvoiceRequest this_arg_conv;
66384         this_arg_conv.inner = untag_ptr(this_arg);
66385         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66387         this_arg_conv.is_owned = false;
66388         LDKPrintableString ret_var = InvoiceRequest_issuer(&this_arg_conv);
66389         int64_t ret_ref = 0;
66390         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66391         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66392         return ret_ref;
66393 }
66394
66395 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
66396         LDKInvoiceRequest this_arg_conv;
66397         this_arg_conv.inner = untag_ptr(this_arg);
66398         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66400         this_arg_conv.is_owned = false;
66401         LDKCVec_BlindedPathZ ret_var = InvoiceRequest_paths(&this_arg_conv);
66402         int64_tArray ret_arr = NULL;
66403         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
66404         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
66405         for (size_t n = 0; n < ret_var.datalen; n++) {
66406                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
66407                 int64_t ret_conv_13_ref = 0;
66408                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
66409                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
66410                 ret_arr_ptr[n] = ret_conv_13_ref;
66411         }
66412         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
66413         FREE(ret_var.data);
66414         return ret_arr;
66415 }
66416
66417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
66418         LDKInvoiceRequest this_arg_conv;
66419         this_arg_conv.inner = untag_ptr(this_arg);
66420         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66422         this_arg_conv.is_owned = false;
66423         LDKQuantity ret_var = InvoiceRequest_supported_quantity(&this_arg_conv);
66424         int64_t ret_ref = 0;
66425         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66426         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66427         return ret_ref;
66428 }
66429
66430 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
66431         LDKInvoiceRequest this_arg_conv;
66432         this_arg_conv.inner = untag_ptr(this_arg);
66433         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66435         this_arg_conv.is_owned = false;
66436         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
66437         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, InvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form);
66438         return ret_arr;
66439 }
66440
66441 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
66442         LDKInvoiceRequest this_arg_conv;
66443         this_arg_conv.inner = untag_ptr(this_arg);
66444         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66446         this_arg_conv.is_owned = false;
66447         LDKu8slice ret_var = InvoiceRequest_payer_metadata(&this_arg_conv);
66448         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
66449         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
66450         return ret_arr;
66451 }
66452
66453 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
66454         LDKInvoiceRequest this_arg_conv;
66455         this_arg_conv.inner = untag_ptr(this_arg);
66456         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66458         this_arg_conv.is_owned = false;
66459         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
66460         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, InvoiceRequest_chain(&this_arg_conv).data);
66461         return ret_arr;
66462 }
66463
66464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
66465         LDKInvoiceRequest this_arg_conv;
66466         this_arg_conv.inner = untag_ptr(this_arg);
66467         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66469         this_arg_conv.is_owned = false;
66470         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66471         *ret_copy = InvoiceRequest_amount_msats(&this_arg_conv);
66472         int64_t ret_ref = tag_ptr(ret_copy, true);
66473         return ret_ref;
66474 }
66475
66476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1invoice_1request_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
66477         LDKInvoiceRequest this_arg_conv;
66478         this_arg_conv.inner = untag_ptr(this_arg);
66479         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66481         this_arg_conv.is_owned = false;
66482         LDKInvoiceRequestFeatures ret_var = InvoiceRequest_invoice_request_features(&this_arg_conv);
66483         int64_t ret_ref = 0;
66484         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66485         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66486         return ret_ref;
66487 }
66488
66489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
66490         LDKInvoiceRequest this_arg_conv;
66491         this_arg_conv.inner = untag_ptr(this_arg);
66492         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66494         this_arg_conv.is_owned = false;
66495         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66496         *ret_copy = InvoiceRequest_quantity(&this_arg_conv);
66497         int64_t ret_ref = tag_ptr(ret_copy, true);
66498         return ret_ref;
66499 }
66500
66501 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
66502         LDKInvoiceRequest this_arg_conv;
66503         this_arg_conv.inner = untag_ptr(this_arg);
66504         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66506         this_arg_conv.is_owned = false;
66507         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
66508         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, InvoiceRequest_payer_id(&this_arg_conv).compressed_form);
66509         return ret_arr;
66510 }
66511
66512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
66513         LDKInvoiceRequest this_arg_conv;
66514         this_arg_conv.inner = untag_ptr(this_arg);
66515         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66517         this_arg_conv.is_owned = false;
66518         LDKPrintableString ret_var = InvoiceRequest_payer_note(&this_arg_conv);
66519         int64_t ret_ref = 0;
66520         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66521         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66522         return ret_ref;
66523 }
66524
66525 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
66526         LDKInvoiceRequest this_arg_conv;
66527         this_arg_conv.inner = untag_ptr(this_arg);
66528         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66530         this_arg_conv.is_owned = false;
66531         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
66532         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, InvoiceRequest_signature(&this_arg_conv).compact_form);
66533         return ret_arr;
66534 }
66535
66536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t key) {
66537         LDKInvoiceRequest this_arg_conv;
66538         this_arg_conv.inner = untag_ptr(this_arg);
66539         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66541         this_arg_conv = InvoiceRequest_clone(&this_arg_conv);
66542         LDKExpandedKey key_conv;
66543         key_conv.inner = untag_ptr(key);
66544         key_conv.is_owned = ptr_is_owned(key);
66545         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
66546         key_conv.is_owned = false;
66547         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
66548         *ret_conv = InvoiceRequest_verify(this_arg_conv, &key_conv);
66549         return tag_ptr(ret_conv, true);
66550 }
66551
66552 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
66553         LDKVerifiedInvoiceRequest this_arg_conv;
66554         this_arg_conv.inner = untag_ptr(this_arg);
66555         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66557         this_arg_conv.is_owned = false;
66558         LDKCVec_ThirtyTwoBytesZ ret_var = VerifiedInvoiceRequest_chains(&this_arg_conv);
66559         jobjectArray ret_arr = NULL;
66560         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
66561         ;
66562         for (size_t i = 0; i < ret_var.datalen; i++) {
66563                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
66564                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
66565                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
66566         }
66567         
66568         FREE(ret_var.data);
66569         return ret_arr;
66570 }
66571
66572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
66573         LDKVerifiedInvoiceRequest 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         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
66579         *ret_copy = VerifiedInvoiceRequest_metadata(&this_arg_conv);
66580         int64_t ret_ref = tag_ptr(ret_copy, true);
66581         return ret_ref;
66582 }
66583
66584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
66585         LDKVerifiedInvoiceRequest this_arg_conv;
66586         this_arg_conv.inner = untag_ptr(this_arg);
66587         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66589         this_arg_conv.is_owned = false;
66590         LDKAmount ret_var = VerifiedInvoiceRequest_amount(&this_arg_conv);
66591         int64_t ret_ref = 0;
66592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66594         return ret_ref;
66595 }
66596
66597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
66598         LDKVerifiedInvoiceRequest this_arg_conv;
66599         this_arg_conv.inner = untag_ptr(this_arg);
66600         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66602         this_arg_conv.is_owned = false;
66603         LDKPrintableString ret_var = VerifiedInvoiceRequest_description(&this_arg_conv);
66604         int64_t ret_ref = 0;
66605         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66606         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66607         return ret_ref;
66608 }
66609
66610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
66611         LDKVerifiedInvoiceRequest this_arg_conv;
66612         this_arg_conv.inner = untag_ptr(this_arg);
66613         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66615         this_arg_conv.is_owned = false;
66616         LDKOfferFeatures ret_var = VerifiedInvoiceRequest_offer_features(&this_arg_conv);
66617         int64_t ret_ref = 0;
66618         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66619         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66620         return ret_ref;
66621 }
66622
66623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
66624         LDKVerifiedInvoiceRequest this_arg_conv;
66625         this_arg_conv.inner = untag_ptr(this_arg);
66626         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66628         this_arg_conv.is_owned = false;
66629         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66630         *ret_copy = VerifiedInvoiceRequest_absolute_expiry(&this_arg_conv);
66631         int64_t ret_ref = tag_ptr(ret_copy, true);
66632         return ret_ref;
66633 }
66634
66635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
66636         LDKVerifiedInvoiceRequest this_arg_conv;
66637         this_arg_conv.inner = untag_ptr(this_arg);
66638         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66640         this_arg_conv.is_owned = false;
66641         LDKPrintableString ret_var = VerifiedInvoiceRequest_issuer(&this_arg_conv);
66642         int64_t ret_ref = 0;
66643         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66644         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66645         return ret_ref;
66646 }
66647
66648 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
66649         LDKVerifiedInvoiceRequest 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         LDKCVec_BlindedPathZ ret_var = VerifiedInvoiceRequest_paths(&this_arg_conv);
66655         int64_tArray ret_arr = NULL;
66656         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
66657         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
66658         for (size_t n = 0; n < ret_var.datalen; n++) {
66659                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
66660                 int64_t ret_conv_13_ref = 0;
66661                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
66662                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
66663                 ret_arr_ptr[n] = ret_conv_13_ref;
66664         }
66665         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
66666         FREE(ret_var.data);
66667         return ret_arr;
66668 }
66669
66670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
66671         LDKVerifiedInvoiceRequest this_arg_conv;
66672         this_arg_conv.inner = untag_ptr(this_arg);
66673         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66675         this_arg_conv.is_owned = false;
66676         LDKQuantity ret_var = VerifiedInvoiceRequest_supported_quantity(&this_arg_conv);
66677         int64_t ret_ref = 0;
66678         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66679         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66680         return ret_ref;
66681 }
66682
66683 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
66684         LDKVerifiedInvoiceRequest this_arg_conv;
66685         this_arg_conv.inner = untag_ptr(this_arg);
66686         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66688         this_arg_conv.is_owned = false;
66689         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
66690         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, VerifiedInvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form);
66691         return ret_arr;
66692 }
66693
66694 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
66695         LDKVerifiedInvoiceRequest this_arg_conv;
66696         this_arg_conv.inner = untag_ptr(this_arg);
66697         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66699         this_arg_conv.is_owned = false;
66700         LDKu8slice ret_var = VerifiedInvoiceRequest_payer_metadata(&this_arg_conv);
66701         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
66702         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
66703         return ret_arr;
66704 }
66705
66706 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
66707         LDKVerifiedInvoiceRequest this_arg_conv;
66708         this_arg_conv.inner = untag_ptr(this_arg);
66709         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66711         this_arg_conv.is_owned = false;
66712         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
66713         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, VerifiedInvoiceRequest_chain(&this_arg_conv).data);
66714         return ret_arr;
66715 }
66716
66717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
66718         LDKVerifiedInvoiceRequest this_arg_conv;
66719         this_arg_conv.inner = untag_ptr(this_arg);
66720         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66722         this_arg_conv.is_owned = false;
66723         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66724         *ret_copy = VerifiedInvoiceRequest_amount_msats(&this_arg_conv);
66725         int64_t ret_ref = tag_ptr(ret_copy, true);
66726         return ret_ref;
66727 }
66728
66729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1invoice_1request_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
66730         LDKVerifiedInvoiceRequest this_arg_conv;
66731         this_arg_conv.inner = untag_ptr(this_arg);
66732         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66734         this_arg_conv.is_owned = false;
66735         LDKInvoiceRequestFeatures ret_var = VerifiedInvoiceRequest_invoice_request_features(&this_arg_conv);
66736         int64_t ret_ref = 0;
66737         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66738         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66739         return ret_ref;
66740 }
66741
66742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
66743         LDKVerifiedInvoiceRequest this_arg_conv;
66744         this_arg_conv.inner = untag_ptr(this_arg);
66745         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66747         this_arg_conv.is_owned = false;
66748         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66749         *ret_copy = VerifiedInvoiceRequest_quantity(&this_arg_conv);
66750         int64_t ret_ref = tag_ptr(ret_copy, true);
66751         return ret_ref;
66752 }
66753
66754 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
66755         LDKVerifiedInvoiceRequest this_arg_conv;
66756         this_arg_conv.inner = untag_ptr(this_arg);
66757         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66759         this_arg_conv.is_owned = false;
66760         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
66761         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, VerifiedInvoiceRequest_payer_id(&this_arg_conv).compressed_form);
66762         return ret_arr;
66763 }
66764
66765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
66766         LDKVerifiedInvoiceRequest this_arg_conv;
66767         this_arg_conv.inner = untag_ptr(this_arg);
66768         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66770         this_arg_conv.is_owned = false;
66771         LDKPrintableString ret_var = VerifiedInvoiceRequest_payer_note(&this_arg_conv);
66772         int64_t ret_ref = 0;
66773         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66774         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66775         return ret_ref;
66776 }
66777
66778 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1write(JNIEnv *env, jclass clz, int64_t obj) {
66779         LDKUnsignedInvoiceRequest obj_conv;
66780         obj_conv.inner = untag_ptr(obj);
66781         obj_conv.is_owned = ptr_is_owned(obj);
66782         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66783         obj_conv.is_owned = false;
66784         LDKCVec_u8Z ret_var = UnsignedInvoiceRequest_write(&obj_conv);
66785         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
66786         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
66787         CVec_u8Z_free(ret_var);
66788         return ret_arr;
66789 }
66790
66791 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1write(JNIEnv *env, jclass clz, int64_t obj) {
66792         LDKInvoiceRequest obj_conv;
66793         obj_conv.inner = untag_ptr(obj);
66794         obj_conv.is_owned = ptr_is_owned(obj);
66795         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66796         obj_conv.is_owned = false;
66797         LDKCVec_u8Z ret_var = InvoiceRequest_write(&obj_conv);
66798         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
66799         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
66800         CVec_u8Z_free(ret_var);
66801         return ret_arr;
66802 }
66803
66804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TaggedHash_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66805         LDKTaggedHash this_obj_conv;
66806         this_obj_conv.inner = untag_ptr(this_obj);
66807         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66809         TaggedHash_free(this_obj_conv);
66810 }
66811
66812 static inline uint64_t TaggedHash_clone_ptr(LDKTaggedHash *NONNULL_PTR arg) {
66813         LDKTaggedHash ret_var = TaggedHash_clone(arg);
66814         int64_t ret_ref = 0;
66815         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66816         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66817         return ret_ref;
66818 }
66819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TaggedHash_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
66820         LDKTaggedHash arg_conv;
66821         arg_conv.inner = untag_ptr(arg);
66822         arg_conv.is_owned = ptr_is_owned(arg);
66823         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66824         arg_conv.is_owned = false;
66825         int64_t ret_conv = TaggedHash_clone_ptr(&arg_conv);
66826         return ret_conv;
66827 }
66828
66829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TaggedHash_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66830         LDKTaggedHash orig_conv;
66831         orig_conv.inner = untag_ptr(orig);
66832         orig_conv.is_owned = ptr_is_owned(orig);
66833         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66834         orig_conv.is_owned = false;
66835         LDKTaggedHash ret_var = TaggedHash_clone(&orig_conv);
66836         int64_t ret_ref = 0;
66837         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66838         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66839         return ret_ref;
66840 }
66841
66842 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TaggedHash_1as_1digest(JNIEnv *env, jclass clz, int64_t this_arg) {
66843         LDKTaggedHash this_arg_conv;
66844         this_arg_conv.inner = untag_ptr(this_arg);
66845         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66847         this_arg_conv.is_owned = false;
66848         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
66849         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TaggedHash_as_digest(&this_arg_conv));
66850         return ret_arr;
66851 }
66852
66853 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_TaggedHash_1tag(JNIEnv *env, jclass clz, int64_t this_arg) {
66854         LDKTaggedHash this_arg_conv;
66855         this_arg_conv.inner = untag_ptr(this_arg);
66856         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66858         this_arg_conv.is_owned = false;
66859         LDKStr ret_str = TaggedHash_tag(&this_arg_conv);
66860         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
66861         Str_free(ret_str);
66862         return ret_conv;
66863 }
66864
66865 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TaggedHash_1merkle_1root(JNIEnv *env, jclass clz, int64_t this_arg) {
66866         LDKTaggedHash this_arg_conv;
66867         this_arg_conv.inner = untag_ptr(this_arg);
66868         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66870         this_arg_conv.is_owned = false;
66871         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
66872         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TaggedHash_merkle_root(&this_arg_conv).data);
66873         return ret_arr;
66874 }
66875
66876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12ParseError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66877         LDKBolt12ParseError this_obj_conv;
66878         this_obj_conv.inner = untag_ptr(this_obj);
66879         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66881         Bolt12ParseError_free(this_obj_conv);
66882 }
66883
66884 static inline uint64_t Bolt12ParseError_clone_ptr(LDKBolt12ParseError *NONNULL_PTR arg) {
66885         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(arg);
66886         int64_t ret_ref = 0;
66887         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66888         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66889         return ret_ref;
66890 }
66891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12ParseError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
66892         LDKBolt12ParseError arg_conv;
66893         arg_conv.inner = untag_ptr(arg);
66894         arg_conv.is_owned = ptr_is_owned(arg);
66895         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66896         arg_conv.is_owned = false;
66897         int64_t ret_conv = Bolt12ParseError_clone_ptr(&arg_conv);
66898         return ret_conv;
66899 }
66900
66901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12ParseError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66902         LDKBolt12ParseError orig_conv;
66903         orig_conv.inner = untag_ptr(orig);
66904         orig_conv.is_owned = ptr_is_owned(orig);
66905         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66906         orig_conv.is_owned = false;
66907         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(&orig_conv);
66908         int64_t ret_ref = 0;
66909         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66910         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66911         return ret_ref;
66912 }
66913
66914 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66915         LDKBolt12SemanticError* orig_conv = (LDKBolt12SemanticError*)untag_ptr(orig);
66916         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_clone(orig_conv));
66917         return ret_conv;
66918 }
66919
66920 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1already_1expired(JNIEnv *env, jclass clz) {
66921         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_already_expired());
66922         return ret_conv;
66923 }
66924
66925 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unsupported_1chain(JNIEnv *env, jclass clz) {
66926         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unsupported_chain());
66927         return ret_conv;
66928 }
66929
66930 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1chain(JNIEnv *env, jclass clz) {
66931         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_chain());
66932         return ret_conv;
66933 }
66934
66935 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1amount(JNIEnv *env, jclass clz) {
66936         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_amount());
66937         return ret_conv;
66938 }
66939
66940 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1amount(JNIEnv *env, jclass clz) {
66941         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_amount());
66942         return ret_conv;
66943 }
66944
66945 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1insufficient_1amount(JNIEnv *env, jclass clz) {
66946         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_insufficient_amount());
66947         return ret_conv;
66948 }
66949
66950 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1amount(JNIEnv *env, jclass clz) {
66951         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_amount());
66952         return ret_conv;
66953 }
66954
66955 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unsupported_1currency(JNIEnv *env, jclass clz) {
66956         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unsupported_currency());
66957         return ret_conv;
66958 }
66959
66960 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unknown_1required_1features(JNIEnv *env, jclass clz) {
66961         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unknown_required_features());
66962         return ret_conv;
66963 }
66964
66965 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1features(JNIEnv *env, jclass clz) {
66966         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_features());
66967         return ret_conv;
66968 }
66969
66970 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1description(JNIEnv *env, jclass clz) {
66971         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_description());
66972         return ret_conv;
66973 }
66974
66975 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1signing_1pubkey(JNIEnv *env, jclass clz) {
66976         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_signing_pubkey());
66977         return ret_conv;
66978 }
66979
66980 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1signing_1pubkey(JNIEnv *env, jclass clz) {
66981         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_signing_pubkey());
66982         return ret_conv;
66983 }
66984
66985 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1signing_1pubkey(JNIEnv *env, jclass clz) {
66986         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_signing_pubkey());
66987         return ret_conv;
66988 }
66989
66990 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1quantity(JNIEnv *env, jclass clz) {
66991         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_quantity());
66992         return ret_conv;
66993 }
66994
66995 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1quantity(JNIEnv *env, jclass clz) {
66996         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_quantity());
66997         return ret_conv;
66998 }
66999
67000 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1quantity(JNIEnv *env, jclass clz) {
67001         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_quantity());
67002         return ret_conv;
67003 }
67004
67005 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1metadata(JNIEnv *env, jclass clz) {
67006         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_metadata());
67007         return ret_conv;
67008 }
67009
67010 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1metadata(JNIEnv *env, jclass clz) {
67011         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_metadata());
67012         return ret_conv;
67013 }
67014
67015 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1payer_1metadata(JNIEnv *env, jclass clz) {
67016         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_payer_metadata());
67017         return ret_conv;
67018 }
67019
67020 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1payer_1id(JNIEnv *env, jclass clz) {
67021         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_payer_id());
67022         return ret_conv;
67023 }
67024
67025 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1duplicate_1payment_1id(JNIEnv *env, jclass clz) {
67026         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_duplicate_payment_id());
67027         return ret_conv;
67028 }
67029
67030 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1paths(JNIEnv *env, jclass clz) {
67031         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_paths());
67032         return ret_conv;
67033 }
67034
67035 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1pay_1info(JNIEnv *env, jclass clz) {
67036         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_pay_info());
67037         return ret_conv;
67038 }
67039
67040 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1creation_1time(JNIEnv *env, jclass clz) {
67041         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_creation_time());
67042         return ret_conv;
67043 }
67044
67045 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1payment_1hash(JNIEnv *env, jclass clz) {
67046         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_payment_hash());
67047         return ret_conv;
67048 }
67049
67050 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1signature(JNIEnv *env, jclass clz) {
67051         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_signature());
67052         return ret_conv;
67053 }
67054
67055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Refund_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67056         LDKRefund this_obj_conv;
67057         this_obj_conv.inner = untag_ptr(this_obj);
67058         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67060         Refund_free(this_obj_conv);
67061 }
67062
67063 static inline uint64_t Refund_clone_ptr(LDKRefund *NONNULL_PTR arg) {
67064         LDKRefund ret_var = Refund_clone(arg);
67065         int64_t ret_ref = 0;
67066         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67067         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67068         return ret_ref;
67069 }
67070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67071         LDKRefund arg_conv;
67072         arg_conv.inner = untag_ptr(arg);
67073         arg_conv.is_owned = ptr_is_owned(arg);
67074         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67075         arg_conv.is_owned = false;
67076         int64_t ret_conv = Refund_clone_ptr(&arg_conv);
67077         return ret_conv;
67078 }
67079
67080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67081         LDKRefund orig_conv;
67082         orig_conv.inner = untag_ptr(orig);
67083         orig_conv.is_owned = ptr_is_owned(orig);
67084         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67085         orig_conv.is_owned = false;
67086         LDKRefund ret_var = Refund_clone(&orig_conv);
67087         int64_t ret_ref = 0;
67088         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67089         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67090         return ret_ref;
67091 }
67092
67093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
67094         LDKRefund 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         LDKPrintableString ret_var = Refund_description(&this_arg_conv);
67100         int64_t ret_ref = 0;
67101         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67102         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67103         return ret_ref;
67104 }
67105
67106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
67107         LDKRefund this_arg_conv;
67108         this_arg_conv.inner = untag_ptr(this_arg);
67109         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67111         this_arg_conv.is_owned = false;
67112         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
67113         *ret_copy = Refund_absolute_expiry(&this_arg_conv);
67114         int64_t ret_ref = tag_ptr(ret_copy, true);
67115         return ret_ref;
67116 }
67117
67118 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Refund_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
67119         LDKRefund this_arg_conv;
67120         this_arg_conv.inner = untag_ptr(this_arg);
67121         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67123         this_arg_conv.is_owned = false;
67124         jboolean ret_conv = Refund_is_expired(&this_arg_conv);
67125         return ret_conv;
67126 }
67127
67128 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) {
67129         LDKRefund this_arg_conv;
67130         this_arg_conv.inner = untag_ptr(this_arg);
67131         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67133         this_arg_conv.is_owned = false;
67134         jboolean ret_conv = Refund_is_expired_no_std(&this_arg_conv, duration_since_epoch);
67135         return ret_conv;
67136 }
67137
67138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
67139         LDKRefund this_arg_conv;
67140         this_arg_conv.inner = untag_ptr(this_arg);
67141         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67143         this_arg_conv.is_owned = false;
67144         LDKPrintableString ret_var = Refund_issuer(&this_arg_conv);
67145         int64_t ret_ref = 0;
67146         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67147         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67148         return ret_ref;
67149 }
67150
67151 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
67152         LDKRefund 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         LDKCVec_BlindedPathZ ret_var = Refund_paths(&this_arg_conv);
67158         int64_tArray ret_arr = NULL;
67159         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
67160         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
67161         for (size_t n = 0; n < ret_var.datalen; n++) {
67162                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
67163                 int64_t ret_conv_13_ref = 0;
67164                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
67165                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
67166                 ret_arr_ptr[n] = ret_conv_13_ref;
67167         }
67168         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
67169         FREE(ret_var.data);
67170         return ret_arr;
67171 }
67172
67173 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
67174         LDKRefund this_arg_conv;
67175         this_arg_conv.inner = untag_ptr(this_arg);
67176         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67178         this_arg_conv.is_owned = false;
67179         LDKu8slice ret_var = Refund_payer_metadata(&this_arg_conv);
67180         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
67181         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
67182         return ret_arr;
67183 }
67184
67185 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
67186         LDKRefund this_arg_conv;
67187         this_arg_conv.inner = untag_ptr(this_arg);
67188         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67190         this_arg_conv.is_owned = false;
67191         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
67192         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Refund_chain(&this_arg_conv).data);
67193         return ret_arr;
67194 }
67195
67196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
67197         LDKRefund this_arg_conv;
67198         this_arg_conv.inner = untag_ptr(this_arg);
67199         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67201         this_arg_conv.is_owned = false;
67202         int64_t ret_conv = Refund_amount_msats(&this_arg_conv);
67203         return ret_conv;
67204 }
67205
67206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
67207         LDKRefund this_arg_conv;
67208         this_arg_conv.inner = untag_ptr(this_arg);
67209         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67211         this_arg_conv.is_owned = false;
67212         LDKInvoiceRequestFeatures ret_var = Refund_features(&this_arg_conv);
67213         int64_t ret_ref = 0;
67214         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67215         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67216         return ret_ref;
67217 }
67218
67219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
67220         LDKRefund this_arg_conv;
67221         this_arg_conv.inner = untag_ptr(this_arg);
67222         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67224         this_arg_conv.is_owned = false;
67225         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
67226         *ret_copy = Refund_quantity(&this_arg_conv);
67227         int64_t ret_ref = tag_ptr(ret_copy, true);
67228         return ret_ref;
67229 }
67230
67231 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
67232         LDKRefund this_arg_conv;
67233         this_arg_conv.inner = untag_ptr(this_arg);
67234         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67236         this_arg_conv.is_owned = false;
67237         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
67238         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Refund_payer_id(&this_arg_conv).compressed_form);
67239         return ret_arr;
67240 }
67241
67242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
67243         LDKRefund this_arg_conv;
67244         this_arg_conv.inner = untag_ptr(this_arg);
67245         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67247         this_arg_conv.is_owned = false;
67248         LDKPrintableString ret_var = Refund_payer_note(&this_arg_conv);
67249         int64_t ret_ref = 0;
67250         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67251         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67252         return ret_ref;
67253 }
67254
67255 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1write(JNIEnv *env, jclass clz, int64_t obj) {
67256         LDKRefund obj_conv;
67257         obj_conv.inner = untag_ptr(obj);
67258         obj_conv.is_owned = ptr_is_owned(obj);
67259         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
67260         obj_conv.is_owned = false;
67261         LDKCVec_u8Z ret_var = Refund_write(&obj_conv);
67262         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
67263         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
67264         CVec_u8Z_free(ret_var);
67265         return ret_arr;
67266 }
67267
67268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1from_1str(JNIEnv *env, jclass clz, jstring s) {
67269         LDKStr s_conv = java_to_owned_str(env, s);
67270         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
67271         *ret_conv = Refund_from_str(s_conv);
67272         return tag_ptr(ret_conv, true);
67273 }
67274
67275 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_UtxoLookupError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67276         LDKUtxoLookupError* orig_conv = (LDKUtxoLookupError*)untag_ptr(orig);
67277         jclass ret_conv = LDKUtxoLookupError_to_java(env, UtxoLookupError_clone(orig_conv));
67278         return ret_conv;
67279 }
67280
67281 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_UtxoLookupError_1unknown_1chain(JNIEnv *env, jclass clz) {
67282         jclass ret_conv = LDKUtxoLookupError_to_java(env, UtxoLookupError_unknown_chain());
67283         return ret_conv;
67284 }
67285
67286 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_UtxoLookupError_1unknown_1tx(JNIEnv *env, jclass clz) {
67287         jclass ret_conv = LDKUtxoLookupError_to_java(env, UtxoLookupError_unknown_tx());
67288         return ret_conv;
67289 }
67290
67291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoResult_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
67292         if (!ptr_is_owned(this_ptr)) return;
67293         void* this_ptr_ptr = untag_ptr(this_ptr);
67294         CHECK_ACCESS(this_ptr_ptr);
67295         LDKUtxoResult this_ptr_conv = *(LDKUtxoResult*)(this_ptr_ptr);
67296         FREE(untag_ptr(this_ptr));
67297         UtxoResult_free(this_ptr_conv);
67298 }
67299
67300 static inline uint64_t UtxoResult_clone_ptr(LDKUtxoResult *NONNULL_PTR arg) {
67301         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
67302         *ret_copy = UtxoResult_clone(arg);
67303         int64_t ret_ref = tag_ptr(ret_copy, true);
67304         return ret_ref;
67305 }
67306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67307         LDKUtxoResult* arg_conv = (LDKUtxoResult*)untag_ptr(arg);
67308         int64_t ret_conv = UtxoResult_clone_ptr(arg_conv);
67309         return ret_conv;
67310 }
67311
67312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67313         LDKUtxoResult* orig_conv = (LDKUtxoResult*)untag_ptr(orig);
67314         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
67315         *ret_copy = UtxoResult_clone(orig_conv);
67316         int64_t ret_ref = tag_ptr(ret_copy, true);
67317         return ret_ref;
67318 }
67319
67320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1sync(JNIEnv *env, jclass clz, int64_t a) {
67321         void* a_ptr = untag_ptr(a);
67322         CHECK_ACCESS(a_ptr);
67323         LDKCResult_TxOutUtxoLookupErrorZ a_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(a_ptr);
67324         a_conv = CResult_TxOutUtxoLookupErrorZ_clone((LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(a));
67325         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
67326         *ret_copy = UtxoResult_sync(a_conv);
67327         int64_t ret_ref = tag_ptr(ret_copy, true);
67328         return ret_ref;
67329 }
67330
67331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1async(JNIEnv *env, jclass clz, int64_t a) {
67332         LDKUtxoFuture a_conv;
67333         a_conv.inner = untag_ptr(a);
67334         a_conv.is_owned = ptr_is_owned(a);
67335         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67336         a_conv = UtxoFuture_clone(&a_conv);
67337         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
67338         *ret_copy = UtxoResult_async(a_conv);
67339         int64_t ret_ref = tag_ptr(ret_copy, true);
67340         return ret_ref;
67341 }
67342
67343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoLookup_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
67344         if (!ptr_is_owned(this_ptr)) return;
67345         void* this_ptr_ptr = untag_ptr(this_ptr);
67346         CHECK_ACCESS(this_ptr_ptr);
67347         LDKUtxoLookup this_ptr_conv = *(LDKUtxoLookup*)(this_ptr_ptr);
67348         FREE(untag_ptr(this_ptr));
67349         UtxoLookup_free(this_ptr_conv);
67350 }
67351
67352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67353         LDKUtxoFuture this_obj_conv;
67354         this_obj_conv.inner = untag_ptr(this_obj);
67355         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67357         UtxoFuture_free(this_obj_conv);
67358 }
67359
67360 static inline uint64_t UtxoFuture_clone_ptr(LDKUtxoFuture *NONNULL_PTR arg) {
67361         LDKUtxoFuture ret_var = UtxoFuture_clone(arg);
67362         int64_t ret_ref = 0;
67363         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67364         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67365         return ret_ref;
67366 }
67367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67368         LDKUtxoFuture arg_conv;
67369         arg_conv.inner = untag_ptr(arg);
67370         arg_conv.is_owned = ptr_is_owned(arg);
67371         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67372         arg_conv.is_owned = false;
67373         int64_t ret_conv = UtxoFuture_clone_ptr(&arg_conv);
67374         return ret_conv;
67375 }
67376
67377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67378         LDKUtxoFuture orig_conv;
67379         orig_conv.inner = untag_ptr(orig);
67380         orig_conv.is_owned = ptr_is_owned(orig);
67381         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67382         orig_conv.is_owned = false;
67383         LDKUtxoFuture ret_var = UtxoFuture_clone(&orig_conv);
67384         int64_t ret_ref = 0;
67385         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67386         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67387         return ret_ref;
67388 }
67389
67390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1new(JNIEnv *env, jclass clz) {
67391         LDKUtxoFuture ret_var = UtxoFuture_new();
67392         int64_t ret_ref = 0;
67393         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67394         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67395         return ret_ref;
67396 }
67397
67398 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) {
67399         LDKUtxoFuture this_arg_conv;
67400         this_arg_conv.inner = untag_ptr(this_arg);
67401         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67403         this_arg_conv.is_owned = false;
67404         LDKNetworkGraph graph_conv;
67405         graph_conv.inner = untag_ptr(graph);
67406         graph_conv.is_owned = ptr_is_owned(graph);
67407         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
67408         graph_conv.is_owned = false;
67409         void* result_ptr = untag_ptr(result);
67410         CHECK_ACCESS(result_ptr);
67411         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
67412         UtxoFuture_resolve_without_forwarding(&this_arg_conv, &graph_conv, result_conv);
67413 }
67414
67415 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) {
67416         LDKUtxoFuture this_arg_conv;
67417         this_arg_conv.inner = untag_ptr(this_arg);
67418         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67420         this_arg_conv.is_owned = false;
67421         LDKNetworkGraph graph_conv;
67422         graph_conv.inner = untag_ptr(graph);
67423         graph_conv.is_owned = ptr_is_owned(graph);
67424         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
67425         graph_conv.is_owned = false;
67426         LDKP2PGossipSync gossip_conv;
67427         gossip_conv.inner = untag_ptr(gossip);
67428         gossip_conv.is_owned = ptr_is_owned(gossip);
67429         CHECK_INNER_FIELD_ACCESS_OR_NULL(gossip_conv);
67430         gossip_conv.is_owned = false;
67431         void* result_ptr = untag_ptr(result);
67432         CHECK_ACCESS(result_ptr);
67433         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
67434         UtxoFuture_resolve(&this_arg_conv, &graph_conv, &gossip_conv, result_conv);
67435 }
67436
67437 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67438         LDKNodeId this_obj_conv;
67439         this_obj_conv.inner = untag_ptr(this_obj);
67440         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67442         NodeId_free(this_obj_conv);
67443 }
67444
67445 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
67446         LDKNodeId ret_var = NodeId_clone(arg);
67447         int64_t ret_ref = 0;
67448         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67449         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67450         return ret_ref;
67451 }
67452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67453         LDKNodeId arg_conv;
67454         arg_conv.inner = untag_ptr(arg);
67455         arg_conv.is_owned = ptr_is_owned(arg);
67456         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67457         arg_conv.is_owned = false;
67458         int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
67459         return ret_conv;
67460 }
67461
67462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67463         LDKNodeId orig_conv;
67464         orig_conv.inner = untag_ptr(orig);
67465         orig_conv.is_owned = ptr_is_owned(orig);
67466         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67467         orig_conv.is_owned = false;
67468         LDKNodeId ret_var = NodeId_clone(&orig_conv);
67469         int64_t ret_ref = 0;
67470         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67471         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67472         return ret_ref;
67473 }
67474
67475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1from_1pubkey(JNIEnv *env, jclass clz, int8_tArray pubkey) {
67476         LDKPublicKey pubkey_ref;
67477         CHECK((*env)->GetArrayLength(env, pubkey) == 33);
67478         (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
67479         LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
67480         int64_t ret_ref = 0;
67481         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67482         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67483         return ret_ref;
67484 }
67485
67486 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1slice(JNIEnv *env, jclass clz, int64_t this_arg) {
67487         LDKNodeId this_arg_conv;
67488         this_arg_conv.inner = untag_ptr(this_arg);
67489         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67491         this_arg_conv.is_owned = false;
67492         LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
67493         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
67494         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
67495         return ret_arr;
67496 }
67497
67498 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1array(JNIEnv *env, jclass clz, int64_t this_arg) {
67499         LDKNodeId this_arg_conv;
67500         this_arg_conv.inner = untag_ptr(this_arg);
67501         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67503         this_arg_conv.is_owned = false;
67504         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
67505         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, *NodeId_as_array(&this_arg_conv));
67506         return ret_arr;
67507 }
67508
67509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
67510         LDKNodeId this_arg_conv;
67511         this_arg_conv.inner = untag_ptr(this_arg);
67512         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67514         this_arg_conv.is_owned = false;
67515         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
67516         *ret_conv = NodeId_as_pubkey(&this_arg_conv);
67517         return tag_ptr(ret_conv, true);
67518 }
67519
67520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1hash(JNIEnv *env, jclass clz, int64_t o) {
67521         LDKNodeId o_conv;
67522         o_conv.inner = untag_ptr(o);
67523         o_conv.is_owned = ptr_is_owned(o);
67524         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
67525         o_conv.is_owned = false;
67526         int64_t ret_conv = NodeId_hash(&o_conv);
67527         return ret_conv;
67528 }
67529
67530 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1write(JNIEnv *env, jclass clz, int64_t obj) {
67531         LDKNodeId obj_conv;
67532         obj_conv.inner = untag_ptr(obj);
67533         obj_conv.is_owned = ptr_is_owned(obj);
67534         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
67535         obj_conv.is_owned = false;
67536         LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
67537         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
67538         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
67539         CVec_u8Z_free(ret_var);
67540         return ret_arr;
67541 }
67542
67543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
67544         LDKu8slice ser_ref;
67545         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
67546         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
67547         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
67548         *ret_conv = NodeId_read(ser_ref);
67549         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
67550         return tag_ptr(ret_conv, true);
67551 }
67552
67553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67554         LDKNetworkGraph this_obj_conv;
67555         this_obj_conv.inner = untag_ptr(this_obj);
67556         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67558         NetworkGraph_free(this_obj_conv);
67559 }
67560
67561 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67562         LDKReadOnlyNetworkGraph this_obj_conv;
67563         this_obj_conv.inner = untag_ptr(this_obj);
67564         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67566         ReadOnlyNetworkGraph_free(this_obj_conv);
67567 }
67568
67569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
67570         if (!ptr_is_owned(this_ptr)) return;
67571         void* this_ptr_ptr = untag_ptr(this_ptr);
67572         CHECK_ACCESS(this_ptr_ptr);
67573         LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
67574         FREE(untag_ptr(this_ptr));
67575         NetworkUpdate_free(this_ptr_conv);
67576 }
67577
67578 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
67579         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
67580         *ret_copy = NetworkUpdate_clone(arg);
67581         int64_t ret_ref = tag_ptr(ret_copy, true);
67582         return ret_ref;
67583 }
67584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67585         LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)untag_ptr(arg);
67586         int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
67587         return ret_conv;
67588 }
67589
67590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67591         LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)untag_ptr(orig);
67592         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
67593         *ret_copy = NetworkUpdate_clone(orig_conv);
67594         int64_t ret_ref = tag_ptr(ret_copy, true);
67595         return ret_ref;
67596 }
67597
67598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1update_1message(JNIEnv *env, jclass clz, int64_t msg) {
67599         LDKChannelUpdate msg_conv;
67600         msg_conv.inner = untag_ptr(msg);
67601         msg_conv.is_owned = ptr_is_owned(msg);
67602         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
67603         msg_conv = ChannelUpdate_clone(&msg_conv);
67604         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
67605         *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
67606         int64_t ret_ref = tag_ptr(ret_copy, true);
67607         return ret_ref;
67608 }
67609
67610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1failure(JNIEnv *env, jclass clz, int64_t short_channel_id, jboolean is_permanent) {
67611         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
67612         *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
67613         int64_t ret_ref = tag_ptr(ret_copy, true);
67614         return ret_ref;
67615 }
67616
67617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1node_1failure(JNIEnv *env, jclass clz, int8_tArray node_id, jboolean is_permanent) {
67618         LDKPublicKey node_id_ref;
67619         CHECK((*env)->GetArrayLength(env, node_id) == 33);
67620         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
67621         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
67622         *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
67623         int64_t ret_ref = tag_ptr(ret_copy, true);
67624         return ret_ref;
67625 }
67626
67627 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
67628         LDKNetworkUpdate* a_conv = (LDKNetworkUpdate*)untag_ptr(a);
67629         LDKNetworkUpdate* b_conv = (LDKNetworkUpdate*)untag_ptr(b);
67630         jboolean ret_conv = NetworkUpdate_eq(a_conv, b_conv);
67631         return ret_conv;
67632 }
67633
67634 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
67635         LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)untag_ptr(obj);
67636         LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
67637         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
67638         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
67639         CVec_u8Z_free(ret_var);
67640         return ret_arr;
67641 }
67642
67643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
67644         LDKu8slice ser_ref;
67645         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
67646         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
67647         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
67648         *ret_conv = NetworkUpdate_read(ser_ref);
67649         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
67650         return tag_ptr(ret_conv, true);
67651 }
67652
67653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67654         LDKP2PGossipSync this_obj_conv;
67655         this_obj_conv.inner = untag_ptr(this_obj);
67656         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67658         P2PGossipSync_free(this_obj_conv);
67659 }
67660
67661 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) {
67662         LDKNetworkGraph network_graph_conv;
67663         network_graph_conv.inner = untag_ptr(network_graph);
67664         network_graph_conv.is_owned = ptr_is_owned(network_graph);
67665         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
67666         network_graph_conv.is_owned = false;
67667         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
67668         CHECK_ACCESS(utxo_lookup_ptr);
67669         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
67670         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
67671         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
67672                 // Manually implement clone for Java trait instances
67673                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
67674                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67675                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
67676                 }
67677         }
67678         void* logger_ptr = untag_ptr(logger);
67679         CHECK_ACCESS(logger_ptr);
67680         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
67681         if (logger_conv.free == LDKLogger_JCalls_free) {
67682                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67683                 LDKLogger_JCalls_cloned(&logger_conv);
67684         }
67685         LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, utxo_lookup_conv, logger_conv);
67686         int64_t ret_ref = 0;
67687         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67688         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67689         return ret_ref;
67690 }
67691
67692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1add_1utxo_1lookup(JNIEnv *env, jclass clz, int64_t this_arg, int64_t utxo_lookup) {
67693         LDKP2PGossipSync this_arg_conv;
67694         this_arg_conv.inner = untag_ptr(this_arg);
67695         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67697         this_arg_conv.is_owned = false;
67698         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
67699         CHECK_ACCESS(utxo_lookup_ptr);
67700         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
67701         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
67702         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
67703                 // Manually implement clone for Java trait instances
67704                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
67705                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67706                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
67707                 }
67708         }
67709         P2PGossipSync_add_utxo_lookup(&this_arg_conv, utxo_lookup_conv);
67710 }
67711
67712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1handle_1network_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t network_update) {
67713         LDKNetworkGraph 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         LDKNetworkUpdate* network_update_conv = (LDKNetworkUpdate*)untag_ptr(network_update);
67719         NetworkGraph_handle_network_update(&this_arg_conv, network_update_conv);
67720 }
67721
67722 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
67723         LDKNetworkGraph this_arg_conv;
67724         this_arg_conv.inner = untag_ptr(this_arg);
67725         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67727         this_arg_conv.is_owned = false;
67728         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
67729         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, NetworkGraph_get_chain_hash(&this_arg_conv).data);
67730         return ret_arr;
67731 }
67732
67733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_verify_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
67734         LDKNodeAnnouncement msg_conv;
67735         msg_conv.inner = untag_ptr(msg);
67736         msg_conv.is_owned = ptr_is_owned(msg);
67737         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
67738         msg_conv.is_owned = false;
67739         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
67740         *ret_conv = verify_node_announcement(&msg_conv);
67741         return tag_ptr(ret_conv, true);
67742 }
67743
67744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_verify_1channel_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
67745         LDKChannelAnnouncement msg_conv;
67746         msg_conv.inner = untag_ptr(msg);
67747         msg_conv.is_owned = ptr_is_owned(msg);
67748         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
67749         msg_conv.is_owned = false;
67750         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
67751         *ret_conv = verify_channel_announcement(&msg_conv);
67752         return tag_ptr(ret_conv, true);
67753 }
67754
67755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
67756         LDKP2PGossipSync this_arg_conv;
67757         this_arg_conv.inner = untag_ptr(this_arg);
67758         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67760         this_arg_conv.is_owned = false;
67761         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
67762         *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
67763         return tag_ptr(ret_ret, true);
67764 }
67765
67766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
67767         LDKP2PGossipSync this_arg_conv;
67768         this_arg_conv.inner = untag_ptr(this_arg);
67769         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67771         this_arg_conv.is_owned = false;
67772         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
67773         *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
67774         return tag_ptr(ret_ret, true);
67775 }
67776
67777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67778         LDKChannelUpdateInfo this_obj_conv;
67779         this_obj_conv.inner = untag_ptr(this_obj);
67780         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67782         ChannelUpdateInfo_free(this_obj_conv);
67783 }
67784
67785 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
67786         LDKChannelUpdateInfo this_ptr_conv;
67787         this_ptr_conv.inner = untag_ptr(this_ptr);
67788         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67790         this_ptr_conv.is_owned = false;
67791         int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
67792         return ret_conv;
67793 }
67794
67795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
67796         LDKChannelUpdateInfo this_ptr_conv;
67797         this_ptr_conv.inner = untag_ptr(this_ptr);
67798         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67800         this_ptr_conv.is_owned = false;
67801         ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
67802 }
67803
67804 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
67805         LDKChannelUpdateInfo this_ptr_conv;
67806         this_ptr_conv.inner = untag_ptr(this_ptr);
67807         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67809         this_ptr_conv.is_owned = false;
67810         jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
67811         return ret_conv;
67812 }
67813
67814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
67815         LDKChannelUpdateInfo this_ptr_conv;
67816         this_ptr_conv.inner = untag_ptr(this_ptr);
67817         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67819         this_ptr_conv.is_owned = false;
67820         ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
67821 }
67822
67823 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
67824         LDKChannelUpdateInfo this_ptr_conv;
67825         this_ptr_conv.inner = untag_ptr(this_ptr);
67826         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67828         this_ptr_conv.is_owned = false;
67829         int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
67830         return ret_conv;
67831 }
67832
67833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
67834         LDKChannelUpdateInfo this_ptr_conv;
67835         this_ptr_conv.inner = untag_ptr(this_ptr);
67836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67838         this_ptr_conv.is_owned = false;
67839         ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
67840 }
67841
67842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
67843         LDKChannelUpdateInfo this_ptr_conv;
67844         this_ptr_conv.inner = untag_ptr(this_ptr);
67845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67847         this_ptr_conv.is_owned = false;
67848         int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
67849         return ret_conv;
67850 }
67851
67852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
67853         LDKChannelUpdateInfo this_ptr_conv;
67854         this_ptr_conv.inner = untag_ptr(this_ptr);
67855         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67857         this_ptr_conv.is_owned = false;
67858         ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
67859 }
67860
67861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
67862         LDKChannelUpdateInfo this_ptr_conv;
67863         this_ptr_conv.inner = untag_ptr(this_ptr);
67864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67866         this_ptr_conv.is_owned = false;
67867         int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
67868         return ret_conv;
67869 }
67870
67871 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
67872         LDKChannelUpdateInfo this_ptr_conv;
67873         this_ptr_conv.inner = untag_ptr(this_ptr);
67874         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67876         this_ptr_conv.is_owned = false;
67877         ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
67878 }
67879
67880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
67881         LDKChannelUpdateInfo this_ptr_conv;
67882         this_ptr_conv.inner = untag_ptr(this_ptr);
67883         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67885         this_ptr_conv.is_owned = false;
67886         LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
67887         int64_t ret_ref = 0;
67888         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67889         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67890         return ret_ref;
67891 }
67892
67893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
67894         LDKChannelUpdateInfo this_ptr_conv;
67895         this_ptr_conv.inner = untag_ptr(this_ptr);
67896         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67898         this_ptr_conv.is_owned = false;
67899         LDKRoutingFees val_conv;
67900         val_conv.inner = untag_ptr(val);
67901         val_conv.is_owned = ptr_is_owned(val);
67902         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67903         val_conv = RoutingFees_clone(&val_conv);
67904         ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
67905 }
67906
67907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
67908         LDKChannelUpdateInfo this_ptr_conv;
67909         this_ptr_conv.inner = untag_ptr(this_ptr);
67910         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67912         this_ptr_conv.is_owned = false;
67913         LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
67914         int64_t ret_ref = 0;
67915         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67916         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67917         return ret_ref;
67918 }
67919
67920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
67921         LDKChannelUpdateInfo this_ptr_conv;
67922         this_ptr_conv.inner = untag_ptr(this_ptr);
67923         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67925         this_ptr_conv.is_owned = false;
67926         LDKChannelUpdate val_conv;
67927         val_conv.inner = untag_ptr(val);
67928         val_conv.is_owned = ptr_is_owned(val);
67929         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67930         val_conv = ChannelUpdate_clone(&val_conv);
67931         ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
67932 }
67933
67934 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) {
67935         LDKRoutingFees fees_arg_conv;
67936         fees_arg_conv.inner = untag_ptr(fees_arg);
67937         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
67938         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
67939         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
67940         LDKChannelUpdate last_update_message_arg_conv;
67941         last_update_message_arg_conv.inner = untag_ptr(last_update_message_arg);
67942         last_update_message_arg_conv.is_owned = ptr_is_owned(last_update_message_arg);
67943         CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
67944         last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
67945         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);
67946         int64_t ret_ref = 0;
67947         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67948         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67949         return ret_ref;
67950 }
67951
67952 static inline uint64_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
67953         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
67954         int64_t ret_ref = 0;
67955         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67956         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67957         return ret_ref;
67958 }
67959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67960         LDKChannelUpdateInfo arg_conv;
67961         arg_conv.inner = untag_ptr(arg);
67962         arg_conv.is_owned = ptr_is_owned(arg);
67963         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67964         arg_conv.is_owned = false;
67965         int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
67966         return ret_conv;
67967 }
67968
67969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67970         LDKChannelUpdateInfo orig_conv;
67971         orig_conv.inner = untag_ptr(orig);
67972         orig_conv.is_owned = ptr_is_owned(orig);
67973         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67974         orig_conv.is_owned = false;
67975         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
67976         int64_t ret_ref = 0;
67977         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67978         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67979         return ret_ref;
67980 }
67981
67982 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
67983         LDKChannelUpdateInfo a_conv;
67984         a_conv.inner = untag_ptr(a);
67985         a_conv.is_owned = ptr_is_owned(a);
67986         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67987         a_conv.is_owned = false;
67988         LDKChannelUpdateInfo b_conv;
67989         b_conv.inner = untag_ptr(b);
67990         b_conv.is_owned = ptr_is_owned(b);
67991         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
67992         b_conv.is_owned = false;
67993         jboolean ret_conv = ChannelUpdateInfo_eq(&a_conv, &b_conv);
67994         return ret_conv;
67995 }
67996
67997 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
67998         LDKChannelUpdateInfo obj_conv;
67999         obj_conv.inner = untag_ptr(obj);
68000         obj_conv.is_owned = ptr_is_owned(obj);
68001         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68002         obj_conv.is_owned = false;
68003         LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
68004         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
68005         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
68006         CVec_u8Z_free(ret_var);
68007         return ret_arr;
68008 }
68009
68010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
68011         LDKu8slice ser_ref;
68012         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
68013         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
68014         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
68015         *ret_conv = ChannelUpdateInfo_read(ser_ref);
68016         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
68017         return tag_ptr(ret_conv, true);
68018 }
68019
68020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
68021         LDKChannelInfo this_obj_conv;
68022         this_obj_conv.inner = untag_ptr(this_obj);
68023         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68025         ChannelInfo_free(this_obj_conv);
68026 }
68027
68028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
68029         LDKChannelInfo this_ptr_conv;
68030         this_ptr_conv.inner = untag_ptr(this_ptr);
68031         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68033         this_ptr_conv.is_owned = false;
68034         LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
68035         int64_t ret_ref = 0;
68036         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68037         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68038         return ret_ref;
68039 }
68040
68041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
68042         LDKChannelInfo this_ptr_conv;
68043         this_ptr_conv.inner = untag_ptr(this_ptr);
68044         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68046         this_ptr_conv.is_owned = false;
68047         LDKChannelFeatures val_conv;
68048         val_conv.inner = untag_ptr(val);
68049         val_conv.is_owned = ptr_is_owned(val);
68050         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68051         val_conv = ChannelFeatures_clone(&val_conv);
68052         ChannelInfo_set_features(&this_ptr_conv, val_conv);
68053 }
68054
68055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
68056         LDKChannelInfo this_ptr_conv;
68057         this_ptr_conv.inner = untag_ptr(this_ptr);
68058         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68060         this_ptr_conv.is_owned = false;
68061         LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
68062         int64_t ret_ref = 0;
68063         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68064         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68065         return ret_ref;
68066 }
68067
68068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
68069         LDKChannelInfo this_ptr_conv;
68070         this_ptr_conv.inner = untag_ptr(this_ptr);
68071         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68073         this_ptr_conv.is_owned = false;
68074         LDKNodeId val_conv;
68075         val_conv.inner = untag_ptr(val);
68076         val_conv.is_owned = ptr_is_owned(val);
68077         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68078         val_conv = NodeId_clone(&val_conv);
68079         ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
68080 }
68081
68082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
68083         LDKChannelInfo this_ptr_conv;
68084         this_ptr_conv.inner = untag_ptr(this_ptr);
68085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68087         this_ptr_conv.is_owned = false;
68088         LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
68089         int64_t ret_ref = 0;
68090         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68091         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68092         return ret_ref;
68093 }
68094
68095 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
68096         LDKChannelInfo this_ptr_conv;
68097         this_ptr_conv.inner = untag_ptr(this_ptr);
68098         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68100         this_ptr_conv.is_owned = false;
68101         LDKChannelUpdateInfo val_conv;
68102         val_conv.inner = untag_ptr(val);
68103         val_conv.is_owned = ptr_is_owned(val);
68104         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68105         val_conv = ChannelUpdateInfo_clone(&val_conv);
68106         ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
68107 }
68108
68109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
68110         LDKChannelInfo this_ptr_conv;
68111         this_ptr_conv.inner = untag_ptr(this_ptr);
68112         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68114         this_ptr_conv.is_owned = false;
68115         LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
68116         int64_t ret_ref = 0;
68117         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68118         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68119         return ret_ref;
68120 }
68121
68122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
68123         LDKChannelInfo this_ptr_conv;
68124         this_ptr_conv.inner = untag_ptr(this_ptr);
68125         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68127         this_ptr_conv.is_owned = false;
68128         LDKNodeId val_conv;
68129         val_conv.inner = untag_ptr(val);
68130         val_conv.is_owned = ptr_is_owned(val);
68131         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68132         val_conv = NodeId_clone(&val_conv);
68133         ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
68134 }
68135
68136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
68137         LDKChannelInfo this_ptr_conv;
68138         this_ptr_conv.inner = untag_ptr(this_ptr);
68139         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68141         this_ptr_conv.is_owned = false;
68142         LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
68143         int64_t ret_ref = 0;
68144         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68145         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68146         return ret_ref;
68147 }
68148
68149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
68150         LDKChannelInfo this_ptr_conv;
68151         this_ptr_conv.inner = untag_ptr(this_ptr);
68152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68154         this_ptr_conv.is_owned = false;
68155         LDKChannelUpdateInfo val_conv;
68156         val_conv.inner = untag_ptr(val);
68157         val_conv.is_owned = ptr_is_owned(val);
68158         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68159         val_conv = ChannelUpdateInfo_clone(&val_conv);
68160         ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
68161 }
68162
68163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
68164         LDKChannelInfo this_ptr_conv;
68165         this_ptr_conv.inner = untag_ptr(this_ptr);
68166         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68168         this_ptr_conv.is_owned = false;
68169         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
68170         *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
68171         int64_t ret_ref = tag_ptr(ret_copy, true);
68172         return ret_ref;
68173 }
68174
68175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
68176         LDKChannelInfo this_ptr_conv;
68177         this_ptr_conv.inner = untag_ptr(this_ptr);
68178         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68180         this_ptr_conv.is_owned = false;
68181         void* val_ptr = untag_ptr(val);
68182         CHECK_ACCESS(val_ptr);
68183         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
68184         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
68185         ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
68186 }
68187
68188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
68189         LDKChannelInfo this_ptr_conv;
68190         this_ptr_conv.inner = untag_ptr(this_ptr);
68191         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68193         this_ptr_conv.is_owned = false;
68194         LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
68195         int64_t ret_ref = 0;
68196         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68197         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68198         return ret_ref;
68199 }
68200
68201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
68202         LDKChannelInfo this_ptr_conv;
68203         this_ptr_conv.inner = untag_ptr(this_ptr);
68204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68206         this_ptr_conv.is_owned = false;
68207         LDKChannelAnnouncement val_conv;
68208         val_conv.inner = untag_ptr(val);
68209         val_conv.is_owned = ptr_is_owned(val);
68210         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68211         val_conv = ChannelAnnouncement_clone(&val_conv);
68212         ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
68213 }
68214
68215 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
68216         LDKChannelInfo ret_var = ChannelInfo_clone(arg);
68217         int64_t ret_ref = 0;
68218         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68219         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68220         return ret_ref;
68221 }
68222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68223         LDKChannelInfo arg_conv;
68224         arg_conv.inner = untag_ptr(arg);
68225         arg_conv.is_owned = ptr_is_owned(arg);
68226         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68227         arg_conv.is_owned = false;
68228         int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
68229         return ret_conv;
68230 }
68231
68232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68233         LDKChannelInfo orig_conv;
68234         orig_conv.inner = untag_ptr(orig);
68235         orig_conv.is_owned = ptr_is_owned(orig);
68236         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68237         orig_conv.is_owned = false;
68238         LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
68239         int64_t ret_ref = 0;
68240         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68241         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68242         return ret_ref;
68243 }
68244
68245 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
68246         LDKChannelInfo a_conv;
68247         a_conv.inner = untag_ptr(a);
68248         a_conv.is_owned = ptr_is_owned(a);
68249         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68250         a_conv.is_owned = false;
68251         LDKChannelInfo b_conv;
68252         b_conv.inner = untag_ptr(b);
68253         b_conv.is_owned = ptr_is_owned(b);
68254         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68255         b_conv.is_owned = false;
68256         jboolean ret_conv = ChannelInfo_eq(&a_conv, &b_conv);
68257         return ret_conv;
68258 }
68259
68260 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) {
68261         LDKChannelInfo this_arg_conv;
68262         this_arg_conv.inner = untag_ptr(this_arg);
68263         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68265         this_arg_conv.is_owned = false;
68266         LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
68267         int64_t ret_ref = 0;
68268         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68269         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68270         return ret_ref;
68271 }
68272
68273 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
68274         LDKChannelInfo obj_conv;
68275         obj_conv.inner = untag_ptr(obj);
68276         obj_conv.is_owned = ptr_is_owned(obj);
68277         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68278         obj_conv.is_owned = false;
68279         LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
68280         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
68281         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
68282         CVec_u8Z_free(ret_var);
68283         return ret_arr;
68284 }
68285
68286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
68287         LDKu8slice ser_ref;
68288         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
68289         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
68290         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
68291         *ret_conv = ChannelInfo_read(ser_ref);
68292         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
68293         return tag_ptr(ret_conv, true);
68294 }
68295
68296 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
68297         LDKDirectedChannelInfo this_obj_conv;
68298         this_obj_conv.inner = untag_ptr(this_obj);
68299         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68301         DirectedChannelInfo_free(this_obj_conv);
68302 }
68303
68304 static inline uint64_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
68305         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
68306         int64_t ret_ref = 0;
68307         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68308         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68309         return ret_ref;
68310 }
68311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68312         LDKDirectedChannelInfo arg_conv;
68313         arg_conv.inner = untag_ptr(arg);
68314         arg_conv.is_owned = ptr_is_owned(arg);
68315         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68316         arg_conv.is_owned = false;
68317         int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
68318         return ret_conv;
68319 }
68320
68321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68322         LDKDirectedChannelInfo orig_conv;
68323         orig_conv.inner = untag_ptr(orig);
68324         orig_conv.is_owned = ptr_is_owned(orig);
68325         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68326         orig_conv.is_owned = false;
68327         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
68328         int64_t ret_ref = 0;
68329         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68330         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68331         return ret_ref;
68332 }
68333
68334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1channel(JNIEnv *env, jclass clz, int64_t this_arg) {
68335         LDKDirectedChannelInfo this_arg_conv;
68336         this_arg_conv.inner = untag_ptr(this_arg);
68337         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68339         this_arg_conv.is_owned = false;
68340         LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
68341         int64_t ret_ref = 0;
68342         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68343         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68344         return ret_ref;
68345 }
68346
68347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_arg) {
68348         LDKDirectedChannelInfo this_arg_conv;
68349         this_arg_conv.inner = untag_ptr(this_arg);
68350         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68352         this_arg_conv.is_owned = false;
68353         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
68354         *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
68355         int64_t ret_ref = tag_ptr(ret_copy, true);
68356         return ret_ref;
68357 }
68358
68359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
68360         if (!ptr_is_owned(this_ptr)) return;
68361         void* this_ptr_ptr = untag_ptr(this_ptr);
68362         CHECK_ACCESS(this_ptr_ptr);
68363         LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
68364         FREE(untag_ptr(this_ptr));
68365         EffectiveCapacity_free(this_ptr_conv);
68366 }
68367
68368 static inline uint64_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
68369         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
68370         *ret_copy = EffectiveCapacity_clone(arg);
68371         int64_t ret_ref = tag_ptr(ret_copy, true);
68372         return ret_ref;
68373 }
68374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68375         LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)untag_ptr(arg);
68376         int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
68377         return ret_conv;
68378 }
68379
68380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68381         LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)untag_ptr(orig);
68382         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
68383         *ret_copy = EffectiveCapacity_clone(orig_conv);
68384         int64_t ret_ref = tag_ptr(ret_copy, true);
68385         return ret_ref;
68386 }
68387
68388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1exact_1liquidity(JNIEnv *env, jclass clz, int64_t liquidity_msat) {
68389         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
68390         *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
68391         int64_t ret_ref = tag_ptr(ret_copy, true);
68392         return ret_ref;
68393 }
68394
68395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1advertised_1max_1htlc(JNIEnv *env, jclass clz, int64_t amount_msat) {
68396         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
68397         *ret_copy = EffectiveCapacity_advertised_max_htlc(amount_msat);
68398         int64_t ret_ref = tag_ptr(ret_copy, true);
68399         return ret_ref;
68400 }
68401
68402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1total(JNIEnv *env, jclass clz, int64_t capacity_msat, int64_t htlc_maximum_msat) {
68403         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
68404         *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat);
68405         int64_t ret_ref = tag_ptr(ret_copy, true);
68406         return ret_ref;
68407 }
68408
68409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1infinite(JNIEnv *env, jclass clz) {
68410         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
68411         *ret_copy = EffectiveCapacity_infinite();
68412         int64_t ret_ref = tag_ptr(ret_copy, true);
68413         return ret_ref;
68414 }
68415
68416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1hint_1max_1htlc(JNIEnv *env, jclass clz, int64_t amount_msat) {
68417         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
68418         *ret_copy = EffectiveCapacity_hint_max_htlc(amount_msat);
68419         int64_t ret_ref = tag_ptr(ret_copy, true);
68420         return ret_ref;
68421 }
68422
68423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1unknown(JNIEnv *env, jclass clz) {
68424         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
68425         *ret_copy = EffectiveCapacity_unknown();
68426         int64_t ret_ref = tag_ptr(ret_copy, true);
68427         return ret_ref;
68428 }
68429
68430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1as_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
68431         LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)untag_ptr(this_arg);
68432         int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
68433         return ret_conv;
68434 }
68435
68436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
68437         LDKRoutingFees this_obj_conv;
68438         this_obj_conv.inner = untag_ptr(this_obj);
68439         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68441         RoutingFees_free(this_obj_conv);
68442 }
68443
68444 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
68445         LDKRoutingFees this_ptr_conv;
68446         this_ptr_conv.inner = untag_ptr(this_ptr);
68447         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68449         this_ptr_conv.is_owned = false;
68450         int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
68451         return ret_conv;
68452 }
68453
68454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
68455         LDKRoutingFees this_ptr_conv;
68456         this_ptr_conv.inner = untag_ptr(this_ptr);
68457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68459         this_ptr_conv.is_owned = false;
68460         RoutingFees_set_base_msat(&this_ptr_conv, val);
68461 }
68462
68463 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
68464         LDKRoutingFees this_ptr_conv;
68465         this_ptr_conv.inner = untag_ptr(this_ptr);
68466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68468         this_ptr_conv.is_owned = false;
68469         int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
68470         return ret_conv;
68471 }
68472
68473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
68474         LDKRoutingFees this_ptr_conv;
68475         this_ptr_conv.inner = untag_ptr(this_ptr);
68476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68478         this_ptr_conv.is_owned = false;
68479         RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
68480 }
68481
68482 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) {
68483         LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
68484         int64_t ret_ref = 0;
68485         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68486         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68487         return ret_ref;
68488 }
68489
68490 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingFees_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
68491         LDKRoutingFees a_conv;
68492         a_conv.inner = untag_ptr(a);
68493         a_conv.is_owned = ptr_is_owned(a);
68494         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68495         a_conv.is_owned = false;
68496         LDKRoutingFees b_conv;
68497         b_conv.inner = untag_ptr(b);
68498         b_conv.is_owned = ptr_is_owned(b);
68499         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68500         b_conv.is_owned = false;
68501         jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
68502         return ret_conv;
68503 }
68504
68505 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
68506         LDKRoutingFees ret_var = RoutingFees_clone(arg);
68507         int64_t ret_ref = 0;
68508         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68509         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68510         return ret_ref;
68511 }
68512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68513         LDKRoutingFees arg_conv;
68514         arg_conv.inner = untag_ptr(arg);
68515         arg_conv.is_owned = ptr_is_owned(arg);
68516         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68517         arg_conv.is_owned = false;
68518         int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
68519         return ret_conv;
68520 }
68521
68522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68523         LDKRoutingFees orig_conv;
68524         orig_conv.inner = untag_ptr(orig);
68525         orig_conv.is_owned = ptr_is_owned(orig);
68526         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68527         orig_conv.is_owned = false;
68528         LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
68529         int64_t ret_ref = 0;
68530         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68531         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68532         return ret_ref;
68533 }
68534
68535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1hash(JNIEnv *env, jclass clz, int64_t o) {
68536         LDKRoutingFees o_conv;
68537         o_conv.inner = untag_ptr(o);
68538         o_conv.is_owned = ptr_is_owned(o);
68539         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68540         o_conv.is_owned = false;
68541         int64_t ret_conv = RoutingFees_hash(&o_conv);
68542         return ret_conv;
68543 }
68544
68545 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
68546         LDKRoutingFees obj_conv;
68547         obj_conv.inner = untag_ptr(obj);
68548         obj_conv.is_owned = ptr_is_owned(obj);
68549         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68550         obj_conv.is_owned = false;
68551         LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
68552         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
68553         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
68554         CVec_u8Z_free(ret_var);
68555         return ret_arr;
68556 }
68557
68558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
68559         LDKu8slice ser_ref;
68560         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
68561         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
68562         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
68563         *ret_conv = RoutingFees_read(ser_ref);
68564         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
68565         return tag_ptr(ret_conv, true);
68566 }
68567
68568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
68569         LDKNodeAnnouncementInfo this_obj_conv;
68570         this_obj_conv.inner = untag_ptr(this_obj);
68571         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68573         NodeAnnouncementInfo_free(this_obj_conv);
68574 }
68575
68576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
68577         LDKNodeAnnouncementInfo this_ptr_conv;
68578         this_ptr_conv.inner = untag_ptr(this_ptr);
68579         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68581         this_ptr_conv.is_owned = false;
68582         LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
68583         int64_t ret_ref = 0;
68584         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68585         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68586         return ret_ref;
68587 }
68588
68589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
68590         LDKNodeAnnouncementInfo this_ptr_conv;
68591         this_ptr_conv.inner = untag_ptr(this_ptr);
68592         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68594         this_ptr_conv.is_owned = false;
68595         LDKNodeFeatures val_conv;
68596         val_conv.inner = untag_ptr(val);
68597         val_conv.is_owned = ptr_is_owned(val);
68598         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68599         val_conv = NodeFeatures_clone(&val_conv);
68600         NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
68601 }
68602
68603 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
68604         LDKNodeAnnouncementInfo this_ptr_conv;
68605         this_ptr_conv.inner = untag_ptr(this_ptr);
68606         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68608         this_ptr_conv.is_owned = false;
68609         int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
68610         return ret_conv;
68611 }
68612
68613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
68614         LDKNodeAnnouncementInfo this_ptr_conv;
68615         this_ptr_conv.inner = untag_ptr(this_ptr);
68616         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68618         this_ptr_conv.is_owned = false;
68619         NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
68620 }
68621
68622 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
68623         LDKNodeAnnouncementInfo this_ptr_conv;
68624         this_ptr_conv.inner = untag_ptr(this_ptr);
68625         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68627         this_ptr_conv.is_owned = false;
68628         int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
68629         (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
68630         return ret_arr;
68631 }
68632
68633 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
68634         LDKNodeAnnouncementInfo this_ptr_conv;
68635         this_ptr_conv.inner = untag_ptr(this_ptr);
68636         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68638         this_ptr_conv.is_owned = false;
68639         LDKThreeBytes val_ref;
68640         CHECK((*env)->GetArrayLength(env, val) == 3);
68641         (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
68642         NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
68643 }
68644
68645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
68646         LDKNodeAnnouncementInfo this_ptr_conv;
68647         this_ptr_conv.inner = untag_ptr(this_ptr);
68648         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68650         this_ptr_conv.is_owned = false;
68651         LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
68652         int64_t ret_ref = 0;
68653         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68654         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68655         return ret_ref;
68656 }
68657
68658 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
68659         LDKNodeAnnouncementInfo this_ptr_conv;
68660         this_ptr_conv.inner = untag_ptr(this_ptr);
68661         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68663         this_ptr_conv.is_owned = false;
68664         LDKNodeAlias val_conv;
68665         val_conv.inner = untag_ptr(val);
68666         val_conv.is_owned = ptr_is_owned(val);
68667         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68668         val_conv = NodeAlias_clone(&val_conv);
68669         NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
68670 }
68671
68672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
68673         LDKNodeAnnouncementInfo this_ptr_conv;
68674         this_ptr_conv.inner = untag_ptr(this_ptr);
68675         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68677         this_ptr_conv.is_owned = false;
68678         LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
68679         int64_t ret_ref = 0;
68680         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68681         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68682         return ret_ref;
68683 }
68684
68685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
68686         LDKNodeAnnouncementInfo this_ptr_conv;
68687         this_ptr_conv.inner = untag_ptr(this_ptr);
68688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68690         this_ptr_conv.is_owned = false;
68691         LDKNodeAnnouncement val_conv;
68692         val_conv.inner = untag_ptr(val);
68693         val_conv.is_owned = ptr_is_owned(val);
68694         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68695         val_conv = NodeAnnouncement_clone(&val_conv);
68696         NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
68697 }
68698
68699 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) {
68700         LDKNodeFeatures features_arg_conv;
68701         features_arg_conv.inner = untag_ptr(features_arg);
68702         features_arg_conv.is_owned = ptr_is_owned(features_arg);
68703         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
68704         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
68705         LDKThreeBytes rgb_arg_ref;
68706         CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
68707         (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
68708         LDKNodeAlias alias_arg_conv;
68709         alias_arg_conv.inner = untag_ptr(alias_arg);
68710         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
68711         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
68712         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
68713         LDKNodeAnnouncement announcement_message_arg_conv;
68714         announcement_message_arg_conv.inner = untag_ptr(announcement_message_arg);
68715         announcement_message_arg_conv.is_owned = ptr_is_owned(announcement_message_arg);
68716         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
68717         announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
68718         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, announcement_message_arg_conv);
68719         int64_t ret_ref = 0;
68720         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68721         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68722         return ret_ref;
68723 }
68724
68725 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
68726         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
68727         int64_t ret_ref = 0;
68728         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68729         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68730         return ret_ref;
68731 }
68732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68733         LDKNodeAnnouncementInfo arg_conv;
68734         arg_conv.inner = untag_ptr(arg);
68735         arg_conv.is_owned = ptr_is_owned(arg);
68736         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68737         arg_conv.is_owned = false;
68738         int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
68739         return ret_conv;
68740 }
68741
68742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68743         LDKNodeAnnouncementInfo orig_conv;
68744         orig_conv.inner = untag_ptr(orig);
68745         orig_conv.is_owned = ptr_is_owned(orig);
68746         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68747         orig_conv.is_owned = false;
68748         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
68749         int64_t ret_ref = 0;
68750         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68751         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68752         return ret_ref;
68753 }
68754
68755 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
68756         LDKNodeAnnouncementInfo a_conv;
68757         a_conv.inner = untag_ptr(a);
68758         a_conv.is_owned = ptr_is_owned(a);
68759         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68760         a_conv.is_owned = false;
68761         LDKNodeAnnouncementInfo b_conv;
68762         b_conv.inner = untag_ptr(b);
68763         b_conv.is_owned = ptr_is_owned(b);
68764         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68765         b_conv.is_owned = false;
68766         jboolean ret_conv = NodeAnnouncementInfo_eq(&a_conv, &b_conv);
68767         return ret_conv;
68768 }
68769
68770 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1addresses(JNIEnv *env, jclass clz, int64_t this_arg) {
68771         LDKNodeAnnouncementInfo this_arg_conv;
68772         this_arg_conv.inner = untag_ptr(this_arg);
68773         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68775         this_arg_conv.is_owned = false;
68776         LDKCVec_SocketAddressZ ret_var = NodeAnnouncementInfo_addresses(&this_arg_conv);
68777         int64_tArray ret_arr = NULL;
68778         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
68779         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
68780         for (size_t p = 0; p < ret_var.datalen; p++) {
68781                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
68782                 *ret_conv_15_copy = ret_var.data[p];
68783                 int64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
68784                 ret_arr_ptr[p] = ret_conv_15_ref;
68785         }
68786         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
68787         FREE(ret_var.data);
68788         return ret_arr;
68789 }
68790
68791 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
68792         LDKNodeAnnouncementInfo obj_conv;
68793         obj_conv.inner = untag_ptr(obj);
68794         obj_conv.is_owned = ptr_is_owned(obj);
68795         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68796         obj_conv.is_owned = false;
68797         LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
68798         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
68799         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
68800         CVec_u8Z_free(ret_var);
68801         return ret_arr;
68802 }
68803
68804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
68805         LDKu8slice ser_ref;
68806         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
68807         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
68808         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
68809         *ret_conv = NodeAnnouncementInfo_read(ser_ref);
68810         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
68811         return tag_ptr(ret_conv, true);
68812 }
68813
68814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAlias_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
68815         LDKNodeAlias this_obj_conv;
68816         this_obj_conv.inner = untag_ptr(this_obj);
68817         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68819         NodeAlias_free(this_obj_conv);
68820 }
68821
68822 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAlias_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
68823         LDKNodeAlias this_ptr_conv;
68824         this_ptr_conv.inner = untag_ptr(this_ptr);
68825         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68827         this_ptr_conv.is_owned = false;
68828         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
68829         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAlias_get_a(&this_ptr_conv));
68830         return ret_arr;
68831 }
68832
68833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAlias_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
68834         LDKNodeAlias this_ptr_conv;
68835         this_ptr_conv.inner = untag_ptr(this_ptr);
68836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68838         this_ptr_conv.is_owned = false;
68839         LDKThirtyTwoBytes val_ref;
68840         CHECK((*env)->GetArrayLength(env, val) == 32);
68841         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
68842         NodeAlias_set_a(&this_ptr_conv, val_ref);
68843 }
68844
68845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
68846         LDKThirtyTwoBytes a_arg_ref;
68847         CHECK((*env)->GetArrayLength(env, a_arg) == 32);
68848         (*env)->GetByteArrayRegion(env, a_arg, 0, 32, a_arg_ref.data);
68849         LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
68850         int64_t ret_ref = 0;
68851         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68852         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68853         return ret_ref;
68854 }
68855
68856 static inline uint64_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
68857         LDKNodeAlias ret_var = NodeAlias_clone(arg);
68858         int64_t ret_ref = 0;
68859         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68860         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68861         return ret_ref;
68862 }
68863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68864         LDKNodeAlias arg_conv;
68865         arg_conv.inner = untag_ptr(arg);
68866         arg_conv.is_owned = ptr_is_owned(arg);
68867         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68868         arg_conv.is_owned = false;
68869         int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
68870         return ret_conv;
68871 }
68872
68873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68874         LDKNodeAlias orig_conv;
68875         orig_conv.inner = untag_ptr(orig);
68876         orig_conv.is_owned = ptr_is_owned(orig);
68877         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68878         orig_conv.is_owned = false;
68879         LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
68880         int64_t ret_ref = 0;
68881         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68882         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68883         return ret_ref;
68884 }
68885
68886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1hash(JNIEnv *env, jclass clz, int64_t o) {
68887         LDKNodeAlias o_conv;
68888         o_conv.inner = untag_ptr(o);
68889         o_conv.is_owned = ptr_is_owned(o);
68890         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68891         o_conv.is_owned = false;
68892         int64_t ret_conv = NodeAlias_hash(&o_conv);
68893         return ret_conv;
68894 }
68895
68896 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeAlias_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
68897         LDKNodeAlias a_conv;
68898         a_conv.inner = untag_ptr(a);
68899         a_conv.is_owned = ptr_is_owned(a);
68900         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68901         a_conv.is_owned = false;
68902         LDKNodeAlias b_conv;
68903         b_conv.inner = untag_ptr(b);
68904         b_conv.is_owned = ptr_is_owned(b);
68905         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68906         b_conv.is_owned = false;
68907         jboolean ret_conv = NodeAlias_eq(&a_conv, &b_conv);
68908         return ret_conv;
68909 }
68910
68911 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAlias_1write(JNIEnv *env, jclass clz, int64_t obj) {
68912         LDKNodeAlias obj_conv;
68913         obj_conv.inner = untag_ptr(obj);
68914         obj_conv.is_owned = ptr_is_owned(obj);
68915         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68916         obj_conv.is_owned = false;
68917         LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
68918         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
68919         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
68920         CVec_u8Z_free(ret_var);
68921         return ret_arr;
68922 }
68923
68924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
68925         LDKu8slice ser_ref;
68926         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
68927         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
68928         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
68929         *ret_conv = NodeAlias_read(ser_ref);
68930         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
68931         return tag_ptr(ret_conv, true);
68932 }
68933
68934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
68935         LDKNodeInfo this_obj_conv;
68936         this_obj_conv.inner = untag_ptr(this_obj);
68937         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68939         NodeInfo_free(this_obj_conv);
68940 }
68941
68942 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
68943         LDKNodeInfo this_ptr_conv;
68944         this_ptr_conv.inner = untag_ptr(this_ptr);
68945         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68947         this_ptr_conv.is_owned = false;
68948         LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
68949         int64_tArray ret_arr = NULL;
68950         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
68951         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
68952         for (size_t g = 0; g < ret_var.datalen; g++) {
68953                 int64_t ret_conv_6_conv = ret_var.data[g];
68954                 ret_arr_ptr[g] = ret_conv_6_conv;
68955         }
68956         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
68957         FREE(ret_var.data);
68958         return ret_arr;
68959 }
68960
68961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
68962         LDKNodeInfo this_ptr_conv;
68963         this_ptr_conv.inner = untag_ptr(this_ptr);
68964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68966         this_ptr_conv.is_owned = false;
68967         LDKCVec_u64Z val_constr;
68968         val_constr.datalen = (*env)->GetArrayLength(env, val);
68969         if (val_constr.datalen > 0)
68970                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
68971         else
68972                 val_constr.data = NULL;
68973         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
68974         for (size_t g = 0; g < val_constr.datalen; g++) {
68975                 int64_t val_conv_6 = val_vals[g];
68976                 val_constr.data[g] = val_conv_6;
68977         }
68978         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
68979         NodeInfo_set_channels(&this_ptr_conv, val_constr);
68980 }
68981
68982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
68983         LDKNodeInfo this_ptr_conv;
68984         this_ptr_conv.inner = untag_ptr(this_ptr);
68985         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68987         this_ptr_conv.is_owned = false;
68988         LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
68989         int64_t ret_ref = 0;
68990         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68991         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68992         return ret_ref;
68993 }
68994
68995 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
68996         LDKNodeInfo this_ptr_conv;
68997         this_ptr_conv.inner = untag_ptr(this_ptr);
68998         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69000         this_ptr_conv.is_owned = false;
69001         LDKNodeAnnouncementInfo val_conv;
69002         val_conv.inner = untag_ptr(val);
69003         val_conv.is_owned = ptr_is_owned(val);
69004         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
69005         val_conv = NodeAnnouncementInfo_clone(&val_conv);
69006         NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
69007 }
69008
69009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1new(JNIEnv *env, jclass clz, int64_tArray channels_arg, int64_t announcement_info_arg) {
69010         LDKCVec_u64Z channels_arg_constr;
69011         channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
69012         if (channels_arg_constr.datalen > 0)
69013                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
69014         else
69015                 channels_arg_constr.data = NULL;
69016         int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
69017         for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
69018                 int64_t channels_arg_conv_6 = channels_arg_vals[g];
69019                 channels_arg_constr.data[g] = channels_arg_conv_6;
69020         }
69021         (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
69022         LDKNodeAnnouncementInfo announcement_info_arg_conv;
69023         announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg);
69024         announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg);
69025         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
69026         announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
69027         LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, announcement_info_arg_conv);
69028         int64_t ret_ref = 0;
69029         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69030         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69031         return ret_ref;
69032 }
69033
69034 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
69035         LDKNodeInfo ret_var = NodeInfo_clone(arg);
69036         int64_t ret_ref = 0;
69037         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69038         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69039         return ret_ref;
69040 }
69041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69042         LDKNodeInfo arg_conv;
69043         arg_conv.inner = untag_ptr(arg);
69044         arg_conv.is_owned = ptr_is_owned(arg);
69045         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69046         arg_conv.is_owned = false;
69047         int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
69048         return ret_conv;
69049 }
69050
69051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69052         LDKNodeInfo orig_conv;
69053         orig_conv.inner = untag_ptr(orig);
69054         orig_conv.is_owned = ptr_is_owned(orig);
69055         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69056         orig_conv.is_owned = false;
69057         LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
69058         int64_t ret_ref = 0;
69059         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69060         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69061         return ret_ref;
69062 }
69063
69064 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
69065         LDKNodeInfo a_conv;
69066         a_conv.inner = untag_ptr(a);
69067         a_conv.is_owned = ptr_is_owned(a);
69068         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
69069         a_conv.is_owned = false;
69070         LDKNodeInfo b_conv;
69071         b_conv.inner = untag_ptr(b);
69072         b_conv.is_owned = ptr_is_owned(b);
69073         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
69074         b_conv.is_owned = false;
69075         jboolean ret_conv = NodeInfo_eq(&a_conv, &b_conv);
69076         return ret_conv;
69077 }
69078
69079 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
69080         LDKNodeInfo obj_conv;
69081         obj_conv.inner = untag_ptr(obj);
69082         obj_conv.is_owned = ptr_is_owned(obj);
69083         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69084         obj_conv.is_owned = false;
69085         LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
69086         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
69087         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
69088         CVec_u8Z_free(ret_var);
69089         return ret_arr;
69090 }
69091
69092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
69093         LDKu8slice ser_ref;
69094         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
69095         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
69096         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
69097         *ret_conv = NodeInfo_read(ser_ref);
69098         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
69099         return tag_ptr(ret_conv, true);
69100 }
69101
69102 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
69103         LDKNetworkGraph obj_conv;
69104         obj_conv.inner = untag_ptr(obj);
69105         obj_conv.is_owned = ptr_is_owned(obj);
69106         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69107         obj_conv.is_owned = false;
69108         LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
69109         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
69110         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
69111         CVec_u8Z_free(ret_var);
69112         return ret_arr;
69113 }
69114
69115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
69116         LDKu8slice ser_ref;
69117         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
69118         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
69119         void* arg_ptr = untag_ptr(arg);
69120         CHECK_ACCESS(arg_ptr);
69121         LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
69122         if (arg_conv.free == LDKLogger_JCalls_free) {
69123                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69124                 LDKLogger_JCalls_cloned(&arg_conv);
69125         }
69126         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
69127         *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
69128         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
69129         return tag_ptr(ret_conv, true);
69130 }
69131
69132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, jclass network, int64_t logger) {
69133         LDKNetwork network_conv = LDKNetwork_from_java(env, network);
69134         void* logger_ptr = untag_ptr(logger);
69135         CHECK_ACCESS(logger_ptr);
69136         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
69137         if (logger_conv.free == LDKLogger_JCalls_free) {
69138                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69139                 LDKLogger_JCalls_cloned(&logger_conv);
69140         }
69141         LDKNetworkGraph ret_var = NetworkGraph_new(network_conv, logger_conv);
69142         int64_t ret_ref = 0;
69143         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69144         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69145         return ret_ref;
69146 }
69147
69148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read_1only(JNIEnv *env, jclass clz, int64_t this_arg) {
69149         LDKNetworkGraph this_arg_conv;
69150         this_arg_conv.inner = untag_ptr(this_arg);
69151         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69153         this_arg_conv.is_owned = false;
69154         LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
69155         int64_t ret_ref = 0;
69156         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69157         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69158         return ret_ref;
69159 }
69160
69161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1get_1last_1rapid_1gossip_1sync_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
69162         LDKNetworkGraph this_arg_conv;
69163         this_arg_conv.inner = untag_ptr(this_arg);
69164         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69166         this_arg_conv.is_owned = false;
69167         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
69168         *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
69169         int64_t ret_ref = tag_ptr(ret_copy, true);
69170         return ret_ref;
69171 }
69172
69173 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) {
69174         LDKNetworkGraph 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         NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
69180 }
69181
69182 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) {
69183         LDKNetworkGraph this_arg_conv;
69184         this_arg_conv.inner = untag_ptr(this_arg);
69185         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69187         this_arg_conv.is_owned = false;
69188         LDKNodeAnnouncement msg_conv;
69189         msg_conv.inner = untag_ptr(msg);
69190         msg_conv.is_owned = ptr_is_owned(msg);
69191         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
69192         msg_conv.is_owned = false;
69193         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
69194         *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
69195         return tag_ptr(ret_conv, true);
69196 }
69197
69198 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) {
69199         LDKNetworkGraph this_arg_conv;
69200         this_arg_conv.inner = untag_ptr(this_arg);
69201         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69203         this_arg_conv.is_owned = false;
69204         LDKUnsignedNodeAnnouncement msg_conv;
69205         msg_conv.inner = untag_ptr(msg);
69206         msg_conv.is_owned = ptr_is_owned(msg);
69207         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
69208         msg_conv.is_owned = false;
69209         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
69210         *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
69211         return tag_ptr(ret_conv, true);
69212 }
69213
69214 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) {
69215         LDKNetworkGraph this_arg_conv;
69216         this_arg_conv.inner = untag_ptr(this_arg);
69217         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69219         this_arg_conv.is_owned = false;
69220         LDKChannelAnnouncement msg_conv;
69221         msg_conv.inner = untag_ptr(msg);
69222         msg_conv.is_owned = ptr_is_owned(msg);
69223         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
69224         msg_conv.is_owned = false;
69225         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
69226         CHECK_ACCESS(utxo_lookup_ptr);
69227         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
69228         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
69229         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
69230                 // Manually implement clone for Java trait instances
69231                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
69232                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69233                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
69234                 }
69235         }
69236         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
69237         *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
69238         return tag_ptr(ret_conv, true);
69239 }
69240
69241 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) {
69242         LDKNetworkGraph this_arg_conv;
69243         this_arg_conv.inner = untag_ptr(this_arg);
69244         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69246         this_arg_conv.is_owned = false;
69247         LDKChannelAnnouncement msg_conv;
69248         msg_conv.inner = untag_ptr(msg);
69249         msg_conv.is_owned = ptr_is_owned(msg);
69250         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
69251         msg_conv.is_owned = false;
69252         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
69253         *ret_conv = NetworkGraph_update_channel_from_announcement_no_lookup(&this_arg_conv, &msg_conv);
69254         return tag_ptr(ret_conv, true);
69255 }
69256
69257 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) {
69258         LDKNetworkGraph this_arg_conv;
69259         this_arg_conv.inner = untag_ptr(this_arg);
69260         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69262         this_arg_conv.is_owned = false;
69263         LDKUnsignedChannelAnnouncement msg_conv;
69264         msg_conv.inner = untag_ptr(msg);
69265         msg_conv.is_owned = ptr_is_owned(msg);
69266         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
69267         msg_conv.is_owned = false;
69268         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
69269         CHECK_ACCESS(utxo_lookup_ptr);
69270         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
69271         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
69272         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
69273                 // Manually implement clone for Java trait instances
69274                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
69275                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69276                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
69277                 }
69278         }
69279         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
69280         *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
69281         return tag_ptr(ret_conv, true);
69282 }
69283
69284 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) {
69285         LDKNetworkGraph this_arg_conv;
69286         this_arg_conv.inner = untag_ptr(this_arg);
69287         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69289         this_arg_conv.is_owned = false;
69290         LDKChannelFeatures features_conv;
69291         features_conv.inner = untag_ptr(features);
69292         features_conv.is_owned = ptr_is_owned(features);
69293         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
69294         features_conv = ChannelFeatures_clone(&features_conv);
69295         LDKPublicKey node_id_1_ref;
69296         CHECK((*env)->GetArrayLength(env, node_id_1) == 33);
69297         (*env)->GetByteArrayRegion(env, node_id_1, 0, 33, node_id_1_ref.compressed_form);
69298         LDKPublicKey node_id_2_ref;
69299         CHECK((*env)->GetArrayLength(env, node_id_2) == 33);
69300         (*env)->GetByteArrayRegion(env, node_id_2, 0, 33, node_id_2_ref.compressed_form);
69301         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
69302         *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);
69303         return tag_ptr(ret_conv, true);
69304 }
69305
69306 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) {
69307         LDKNetworkGraph this_arg_conv;
69308         this_arg_conv.inner = untag_ptr(this_arg);
69309         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69311         this_arg_conv.is_owned = false;
69312         NetworkGraph_channel_failed_permanent(&this_arg_conv, short_channel_id);
69313 }
69314
69315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1node_1failed_1permanent(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray node_id) {
69316         LDKNetworkGraph this_arg_conv;
69317         this_arg_conv.inner = untag_ptr(this_arg);
69318         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69320         this_arg_conv.is_owned = false;
69321         LDKPublicKey node_id_ref;
69322         CHECK((*env)->GetArrayLength(env, node_id) == 33);
69323         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
69324         NetworkGraph_node_failed_permanent(&this_arg_conv, node_id_ref);
69325 }
69326
69327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1remove_1stale_1channels_1and_1tracking(JNIEnv *env, jclass clz, int64_t this_arg) {
69328         LDKNetworkGraph this_arg_conv;
69329         this_arg_conv.inner = untag_ptr(this_arg);
69330         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69332         this_arg_conv.is_owned = false;
69333         NetworkGraph_remove_stale_channels_and_tracking(&this_arg_conv);
69334 }
69335
69336 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) {
69337         LDKNetworkGraph this_arg_conv;
69338         this_arg_conv.inner = untag_ptr(this_arg);
69339         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69341         this_arg_conv.is_owned = false;
69342         NetworkGraph_remove_stale_channels_and_tracking_with_time(&this_arg_conv, current_time_unix);
69343 }
69344
69345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
69346         LDKNetworkGraph this_arg_conv;
69347         this_arg_conv.inner = untag_ptr(this_arg);
69348         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69350         this_arg_conv.is_owned = false;
69351         LDKChannelUpdate msg_conv;
69352         msg_conv.inner = untag_ptr(msg);
69353         msg_conv.is_owned = ptr_is_owned(msg);
69354         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
69355         msg_conv.is_owned = false;
69356         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
69357         *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
69358         return tag_ptr(ret_conv, true);
69359 }
69360
69361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
69362         LDKNetworkGraph this_arg_conv;
69363         this_arg_conv.inner = untag_ptr(this_arg);
69364         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69366         this_arg_conv.is_owned = false;
69367         LDKUnsignedChannelUpdate msg_conv;
69368         msg_conv.inner = untag_ptr(msg);
69369         msg_conv.is_owned = ptr_is_owned(msg);
69370         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
69371         msg_conv.is_owned = false;
69372         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
69373         *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
69374         return tag_ptr(ret_conv, true);
69375 }
69376
69377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1verify_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
69378         LDKNetworkGraph this_arg_conv;
69379         this_arg_conv.inner = untag_ptr(this_arg);
69380         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69382         this_arg_conv.is_owned = false;
69383         LDKChannelUpdate msg_conv;
69384         msg_conv.inner = untag_ptr(msg);
69385         msg_conv.is_owned = ptr_is_owned(msg);
69386         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
69387         msg_conv.is_owned = false;
69388         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
69389         *ret_conv = NetworkGraph_verify_channel_update(&this_arg_conv, &msg_conv);
69390         return tag_ptr(ret_conv, true);
69391 }
69392
69393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id) {
69394         LDKReadOnlyNetworkGraph this_arg_conv;
69395         this_arg_conv.inner = untag_ptr(this_arg);
69396         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69398         this_arg_conv.is_owned = false;
69399         LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
69400         int64_t ret_ref = 0;
69401         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69402         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69403         return ret_ref;
69404 }
69405
69406 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
69407         LDKReadOnlyNetworkGraph this_arg_conv;
69408         this_arg_conv.inner = untag_ptr(this_arg);
69409         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69411         this_arg_conv.is_owned = false;
69412         LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
69413         int64_tArray ret_arr = NULL;
69414         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
69415         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
69416         for (size_t g = 0; g < ret_var.datalen; g++) {
69417                 int64_t ret_conv_6_conv = ret_var.data[g];
69418                 ret_arr_ptr[g] = ret_conv_6_conv;
69419         }
69420         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
69421         FREE(ret_var.data);
69422         return ret_arr;
69423 }
69424
69425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1node(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
69426         LDKReadOnlyNetworkGraph this_arg_conv;
69427         this_arg_conv.inner = untag_ptr(this_arg);
69428         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69430         this_arg_conv.is_owned = false;
69431         LDKNodeId node_id_conv;
69432         node_id_conv.inner = untag_ptr(node_id);
69433         node_id_conv.is_owned = ptr_is_owned(node_id);
69434         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
69435         node_id_conv.is_owned = false;
69436         LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
69437         int64_t ret_ref = 0;
69438         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69439         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69440         return ret_ref;
69441 }
69442
69443 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1list_1nodes(JNIEnv *env, jclass clz, int64_t this_arg) {
69444         LDKReadOnlyNetworkGraph this_arg_conv;
69445         this_arg_conv.inner = untag_ptr(this_arg);
69446         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69448         this_arg_conv.is_owned = false;
69449         LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
69450         int64_tArray ret_arr = NULL;
69451         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
69452         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
69453         for (size_t i = 0; i < ret_var.datalen; i++) {
69454                 LDKNodeId ret_conv_8_var = ret_var.data[i];
69455                 int64_t ret_conv_8_ref = 0;
69456                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
69457                 ret_conv_8_ref = tag_ptr(ret_conv_8_var.inner, ret_conv_8_var.is_owned);
69458                 ret_arr_ptr[i] = ret_conv_8_ref;
69459         }
69460         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
69461         FREE(ret_var.data);
69462         return ret_arr;
69463 }
69464
69465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey) {
69466         LDKReadOnlyNetworkGraph this_arg_conv;
69467         this_arg_conv.inner = untag_ptr(this_arg);
69468         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69470         this_arg_conv.is_owned = false;
69471         LDKPublicKey pubkey_ref;
69472         CHECK((*env)->GetArrayLength(env, pubkey) == 33);
69473         (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
69474         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
69475         *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
69476         int64_t ret_ref = tag_ptr(ret_copy, true);
69477         return ret_ref;
69478 }
69479
69480 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
69481         LDKDefaultRouter this_obj_conv;
69482         this_obj_conv.inner = untag_ptr(this_obj);
69483         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69485         DefaultRouter_free(this_obj_conv);
69486 }
69487
69488 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) {
69489         LDKNetworkGraph network_graph_conv;
69490         network_graph_conv.inner = untag_ptr(network_graph);
69491         network_graph_conv.is_owned = ptr_is_owned(network_graph);
69492         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
69493         network_graph_conv.is_owned = false;
69494         void* logger_ptr = untag_ptr(logger);
69495         CHECK_ACCESS(logger_ptr);
69496         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
69497         if (logger_conv.free == LDKLogger_JCalls_free) {
69498                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69499                 LDKLogger_JCalls_cloned(&logger_conv);
69500         }
69501         void* entropy_source_ptr = untag_ptr(entropy_source);
69502         CHECK_ACCESS(entropy_source_ptr);
69503         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
69504         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
69505                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69506                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
69507         }
69508         void* scorer_ptr = untag_ptr(scorer);
69509         CHECK_ACCESS(scorer_ptr);
69510         LDKLockableScore scorer_conv = *(LDKLockableScore*)(scorer_ptr);
69511         if (scorer_conv.free == LDKLockableScore_JCalls_free) {
69512                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69513                 LDKLockableScore_JCalls_cloned(&scorer_conv);
69514         }
69515         LDKProbabilisticScoringFeeParameters score_params_conv;
69516         score_params_conv.inner = untag_ptr(score_params);
69517         score_params_conv.is_owned = ptr_is_owned(score_params);
69518         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
69519         score_params_conv = ProbabilisticScoringFeeParameters_clone(&score_params_conv);
69520         LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, entropy_source_conv, scorer_conv, score_params_conv);
69521         int64_t ret_ref = 0;
69522         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69523         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69524         return ret_ref;
69525 }
69526
69527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1as_1Router(JNIEnv *env, jclass clz, int64_t this_arg) {
69528         LDKDefaultRouter this_arg_conv;
69529         this_arg_conv.inner = untag_ptr(this_arg);
69530         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69532         this_arg_conv.is_owned = false;
69533         LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
69534         *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
69535         return tag_ptr(ret_ret, true);
69536 }
69537
69538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1as_1MessageRouter(JNIEnv *env, jclass clz, int64_t this_arg) {
69539         LDKDefaultRouter this_arg_conv;
69540         this_arg_conv.inner = untag_ptr(this_arg);
69541         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69543         this_arg_conv.is_owned = false;
69544         LDKMessageRouter* ret_ret = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
69545         *ret_ret = DefaultRouter_as_MessageRouter(&this_arg_conv);
69546         return tag_ptr(ret_ret, true);
69547 }
69548
69549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Router_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
69550         if (!ptr_is_owned(this_ptr)) return;
69551         void* this_ptr_ptr = untag_ptr(this_ptr);
69552         CHECK_ACCESS(this_ptr_ptr);
69553         LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
69554         FREE(untag_ptr(this_ptr));
69555         Router_free(this_ptr_conv);
69556 }
69557
69558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScorerAccountingForInFlightHtlcs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
69559         LDKScorerAccountingForInFlightHtlcs this_obj_conv;
69560         this_obj_conv.inner = untag_ptr(this_obj);
69561         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69563         ScorerAccountingForInFlightHtlcs_free(this_obj_conv);
69564 }
69565
69566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScorerAccountingForInFlightHtlcs_1new(JNIEnv *env, jclass clz, int64_t scorer, int64_t inflight_htlcs) {
69567         void* scorer_ptr = untag_ptr(scorer);
69568         CHECK_ACCESS(scorer_ptr);
69569         LDKScoreLookUp scorer_conv = *(LDKScoreLookUp*)(scorer_ptr);
69570         if (scorer_conv.free == LDKScoreLookUp_JCalls_free) {
69571                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69572                 LDKScoreLookUp_JCalls_cloned(&scorer_conv);
69573         }
69574         LDKInFlightHtlcs inflight_htlcs_conv;
69575         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
69576         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
69577         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
69578         inflight_htlcs_conv.is_owned = false;
69579         LDKScorerAccountingForInFlightHtlcs ret_var = ScorerAccountingForInFlightHtlcs_new(scorer_conv, &inflight_htlcs_conv);
69580         int64_t ret_ref = 0;
69581         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69582         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69583         return ret_ref;
69584 }
69585
69586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScorerAccountingForInFlightHtlcs_1as_1ScoreLookUp(JNIEnv *env, jclass clz, int64_t this_arg) {
69587         LDKScorerAccountingForInFlightHtlcs this_arg_conv;
69588         this_arg_conv.inner = untag_ptr(this_arg);
69589         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69591         this_arg_conv.is_owned = false;
69592         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
69593         *ret_ret = ScorerAccountingForInFlightHtlcs_as_ScoreLookUp(&this_arg_conv);
69594         return tag_ptr(ret_ret, true);
69595 }
69596
69597 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
69598         LDKInFlightHtlcs this_obj_conv;
69599         this_obj_conv.inner = untag_ptr(this_obj);
69600         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69602         InFlightHtlcs_free(this_obj_conv);
69603 }
69604
69605 static inline uint64_t InFlightHtlcs_clone_ptr(LDKInFlightHtlcs *NONNULL_PTR arg) {
69606         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(arg);
69607         int64_t ret_ref = 0;
69608         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69609         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69610         return ret_ref;
69611 }
69612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69613         LDKInFlightHtlcs arg_conv;
69614         arg_conv.inner = untag_ptr(arg);
69615         arg_conv.is_owned = ptr_is_owned(arg);
69616         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69617         arg_conv.is_owned = false;
69618         int64_t ret_conv = InFlightHtlcs_clone_ptr(&arg_conv);
69619         return ret_conv;
69620 }
69621
69622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69623         LDKInFlightHtlcs orig_conv;
69624         orig_conv.inner = untag_ptr(orig);
69625         orig_conv.is_owned = ptr_is_owned(orig);
69626         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69627         orig_conv.is_owned = false;
69628         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(&orig_conv);
69629         int64_t ret_ref = 0;
69630         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69631         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69632         return ret_ref;
69633 }
69634
69635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1new(JNIEnv *env, jclass clz) {
69636         LDKInFlightHtlcs ret_var = InFlightHtlcs_new();
69637         int64_t ret_ref = 0;
69638         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69639         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69640         return ret_ref;
69641 }
69642
69643 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) {
69644         LDKInFlightHtlcs this_arg_conv;
69645         this_arg_conv.inner = untag_ptr(this_arg);
69646         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69648         this_arg_conv.is_owned = false;
69649         LDKPath path_conv;
69650         path_conv.inner = untag_ptr(path);
69651         path_conv.is_owned = ptr_is_owned(path);
69652         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
69653         path_conv.is_owned = false;
69654         LDKPublicKey payer_node_id_ref;
69655         CHECK((*env)->GetArrayLength(env, payer_node_id) == 33);
69656         (*env)->GetByteArrayRegion(env, payer_node_id, 0, 33, payer_node_id_ref.compressed_form);
69657         InFlightHtlcs_process_path(&this_arg_conv, &path_conv, payer_node_id_ref);
69658 }
69659
69660 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) {
69661         LDKInFlightHtlcs this_arg_conv;
69662         this_arg_conv.inner = untag_ptr(this_arg);
69663         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69665         this_arg_conv.is_owned = false;
69666         LDKNodeId source_conv;
69667         source_conv.inner = untag_ptr(source);
69668         source_conv.is_owned = ptr_is_owned(source);
69669         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
69670         source_conv.is_owned = false;
69671         LDKNodeId target_conv;
69672         target_conv.inner = untag_ptr(target);
69673         target_conv.is_owned = ptr_is_owned(target);
69674         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
69675         target_conv.is_owned = false;
69676         InFlightHtlcs_add_inflight_htlc(&this_arg_conv, &source_conv, &target_conv, channel_scid, used_msat);
69677 }
69678
69679 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) {
69680         LDKInFlightHtlcs this_arg_conv;
69681         this_arg_conv.inner = untag_ptr(this_arg);
69682         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69684         this_arg_conv.is_owned = false;
69685         LDKNodeId source_conv;
69686         source_conv.inner = untag_ptr(source);
69687         source_conv.is_owned = ptr_is_owned(source);
69688         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
69689         source_conv.is_owned = false;
69690         LDKNodeId target_conv;
69691         target_conv.inner = untag_ptr(target);
69692         target_conv.is_owned = ptr_is_owned(target);
69693         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
69694         target_conv.is_owned = false;
69695         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
69696         *ret_copy = InFlightHtlcs_used_liquidity_msat(&this_arg_conv, &source_conv, &target_conv, channel_scid);
69697         int64_t ret_ref = tag_ptr(ret_copy, true);
69698         return ret_ref;
69699 }
69700
69701 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1write(JNIEnv *env, jclass clz, int64_t obj) {
69702         LDKInFlightHtlcs obj_conv;
69703         obj_conv.inner = untag_ptr(obj);
69704         obj_conv.is_owned = ptr_is_owned(obj);
69705         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69706         obj_conv.is_owned = false;
69707         LDKCVec_u8Z ret_var = InFlightHtlcs_write(&obj_conv);
69708         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
69709         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
69710         CVec_u8Z_free(ret_var);
69711         return ret_arr;
69712 }
69713
69714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
69715         LDKu8slice ser_ref;
69716         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
69717         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
69718         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
69719         *ret_conv = InFlightHtlcs_read(ser_ref);
69720         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
69721         return tag_ptr(ret_conv, true);
69722 }
69723
69724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
69725         LDKRouteHop this_obj_conv;
69726         this_obj_conv.inner = untag_ptr(this_obj);
69727         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69729         RouteHop_free(this_obj_conv);
69730 }
69731
69732 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
69733         LDKRouteHop this_ptr_conv;
69734         this_ptr_conv.inner = untag_ptr(this_ptr);
69735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69737         this_ptr_conv.is_owned = false;
69738         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
69739         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
69740         return ret_arr;
69741 }
69742
69743 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
69744         LDKRouteHop this_ptr_conv;
69745         this_ptr_conv.inner = untag_ptr(this_ptr);
69746         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69748         this_ptr_conv.is_owned = false;
69749         LDKPublicKey val_ref;
69750         CHECK((*env)->GetArrayLength(env, val) == 33);
69751         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
69752         RouteHop_set_pubkey(&this_ptr_conv, val_ref);
69753 }
69754
69755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
69756         LDKRouteHop this_ptr_conv;
69757         this_ptr_conv.inner = untag_ptr(this_ptr);
69758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69760         this_ptr_conv.is_owned = false;
69761         LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
69762         int64_t ret_ref = 0;
69763         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69764         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69765         return ret_ref;
69766 }
69767
69768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
69769         LDKRouteHop this_ptr_conv;
69770         this_ptr_conv.inner = untag_ptr(this_ptr);
69771         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69773         this_ptr_conv.is_owned = false;
69774         LDKNodeFeatures val_conv;
69775         val_conv.inner = untag_ptr(val);
69776         val_conv.is_owned = ptr_is_owned(val);
69777         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
69778         val_conv = NodeFeatures_clone(&val_conv);
69779         RouteHop_set_node_features(&this_ptr_conv, val_conv);
69780 }
69781
69782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
69783         LDKRouteHop this_ptr_conv;
69784         this_ptr_conv.inner = untag_ptr(this_ptr);
69785         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69787         this_ptr_conv.is_owned = false;
69788         int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
69789         return ret_conv;
69790 }
69791
69792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
69793         LDKRouteHop this_ptr_conv;
69794         this_ptr_conv.inner = untag_ptr(this_ptr);
69795         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69797         this_ptr_conv.is_owned = false;
69798         RouteHop_set_short_channel_id(&this_ptr_conv, val);
69799 }
69800
69801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
69802         LDKRouteHop this_ptr_conv;
69803         this_ptr_conv.inner = untag_ptr(this_ptr);
69804         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69806         this_ptr_conv.is_owned = false;
69807         LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
69808         int64_t ret_ref = 0;
69809         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69810         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69811         return ret_ref;
69812 }
69813
69814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
69815         LDKRouteHop this_ptr_conv;
69816         this_ptr_conv.inner = untag_ptr(this_ptr);
69817         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69819         this_ptr_conv.is_owned = false;
69820         LDKChannelFeatures val_conv;
69821         val_conv.inner = untag_ptr(val);
69822         val_conv.is_owned = ptr_is_owned(val);
69823         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
69824         val_conv = ChannelFeatures_clone(&val_conv);
69825         RouteHop_set_channel_features(&this_ptr_conv, val_conv);
69826 }
69827
69828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
69829         LDKRouteHop this_ptr_conv;
69830         this_ptr_conv.inner = untag_ptr(this_ptr);
69831         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69833         this_ptr_conv.is_owned = false;
69834         int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
69835         return ret_conv;
69836 }
69837
69838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
69839         LDKRouteHop this_ptr_conv;
69840         this_ptr_conv.inner = untag_ptr(this_ptr);
69841         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69843         this_ptr_conv.is_owned = false;
69844         RouteHop_set_fee_msat(&this_ptr_conv, val);
69845 }
69846
69847 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
69848         LDKRouteHop this_ptr_conv;
69849         this_ptr_conv.inner = untag_ptr(this_ptr);
69850         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69852         this_ptr_conv.is_owned = false;
69853         int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
69854         return ret_conv;
69855 }
69856
69857 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
69858         LDKRouteHop this_ptr_conv;
69859         this_ptr_conv.inner = untag_ptr(this_ptr);
69860         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69862         this_ptr_conv.is_owned = false;
69863         RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
69864 }
69865
69866 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1maybe_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
69867         LDKRouteHop this_ptr_conv;
69868         this_ptr_conv.inner = untag_ptr(this_ptr);
69869         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69871         this_ptr_conv.is_owned = false;
69872         jboolean ret_conv = RouteHop_get_maybe_announced_channel(&this_ptr_conv);
69873         return ret_conv;
69874 }
69875
69876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1maybe_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
69877         LDKRouteHop this_ptr_conv;
69878         this_ptr_conv.inner = untag_ptr(this_ptr);
69879         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69881         this_ptr_conv.is_owned = false;
69882         RouteHop_set_maybe_announced_channel(&this_ptr_conv, val);
69883 }
69884
69885 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) {
69886         LDKPublicKey pubkey_arg_ref;
69887         CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
69888         (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
69889         LDKNodeFeatures node_features_arg_conv;
69890         node_features_arg_conv.inner = untag_ptr(node_features_arg);
69891         node_features_arg_conv.is_owned = ptr_is_owned(node_features_arg);
69892         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
69893         node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
69894         LDKChannelFeatures channel_features_arg_conv;
69895         channel_features_arg_conv.inner = untag_ptr(channel_features_arg);
69896         channel_features_arg_conv.is_owned = ptr_is_owned(channel_features_arg);
69897         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
69898         channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
69899         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);
69900         int64_t ret_ref = 0;
69901         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69902         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69903         return ret_ref;
69904 }
69905
69906 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
69907         LDKRouteHop ret_var = RouteHop_clone(arg);
69908         int64_t ret_ref = 0;
69909         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69910         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69911         return ret_ref;
69912 }
69913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69914         LDKRouteHop arg_conv;
69915         arg_conv.inner = untag_ptr(arg);
69916         arg_conv.is_owned = ptr_is_owned(arg);
69917         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69918         arg_conv.is_owned = false;
69919         int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
69920         return ret_conv;
69921 }
69922
69923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69924         LDKRouteHop orig_conv;
69925         orig_conv.inner = untag_ptr(orig);
69926         orig_conv.is_owned = ptr_is_owned(orig);
69927         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69928         orig_conv.is_owned = false;
69929         LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
69930         int64_t ret_ref = 0;
69931         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69932         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69933         return ret_ref;
69934 }
69935
69936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
69937         LDKRouteHop o_conv;
69938         o_conv.inner = untag_ptr(o);
69939         o_conv.is_owned = ptr_is_owned(o);
69940         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
69941         o_conv.is_owned = false;
69942         int64_t ret_conv = RouteHop_hash(&o_conv);
69943         return ret_conv;
69944 }
69945
69946 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
69947         LDKRouteHop a_conv;
69948         a_conv.inner = untag_ptr(a);
69949         a_conv.is_owned = ptr_is_owned(a);
69950         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
69951         a_conv.is_owned = false;
69952         LDKRouteHop b_conv;
69953         b_conv.inner = untag_ptr(b);
69954         b_conv.is_owned = ptr_is_owned(b);
69955         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
69956         b_conv.is_owned = false;
69957         jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
69958         return ret_conv;
69959 }
69960
69961 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
69962         LDKRouteHop obj_conv;
69963         obj_conv.inner = untag_ptr(obj);
69964         obj_conv.is_owned = ptr_is_owned(obj);
69965         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69966         obj_conv.is_owned = false;
69967         LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
69968         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
69969         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
69970         CVec_u8Z_free(ret_var);
69971         return ret_arr;
69972 }
69973
69974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
69975         LDKu8slice ser_ref;
69976         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
69977         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
69978         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
69979         *ret_conv = RouteHop_read(ser_ref);
69980         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
69981         return tag_ptr(ret_conv, true);
69982 }
69983
69984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
69985         LDKBlindedTail this_obj_conv;
69986         this_obj_conv.inner = untag_ptr(this_obj);
69987         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69989         BlindedTail_free(this_obj_conv);
69990 }
69991
69992 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_BlindedTail_1get_1hops(JNIEnv *env, jclass clz, int64_t this_ptr) {
69993         LDKBlindedTail this_ptr_conv;
69994         this_ptr_conv.inner = untag_ptr(this_ptr);
69995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69997         this_ptr_conv.is_owned = false;
69998         LDKCVec_BlindedHopZ ret_var = BlindedTail_get_hops(&this_ptr_conv);
69999         int64_tArray ret_arr = NULL;
70000         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
70001         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
70002         for (size_t m = 0; m < ret_var.datalen; m++) {
70003                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
70004                 int64_t ret_conv_12_ref = 0;
70005                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
70006                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
70007                 ret_arr_ptr[m] = ret_conv_12_ref;
70008         }
70009         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
70010         FREE(ret_var.data);
70011         return ret_arr;
70012 }
70013
70014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1set_1hops(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
70015         LDKBlindedTail this_ptr_conv;
70016         this_ptr_conv.inner = untag_ptr(this_ptr);
70017         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70019         this_ptr_conv.is_owned = false;
70020         LDKCVec_BlindedHopZ val_constr;
70021         val_constr.datalen = (*env)->GetArrayLength(env, val);
70022         if (val_constr.datalen > 0)
70023                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
70024         else
70025                 val_constr.data = NULL;
70026         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
70027         for (size_t m = 0; m < val_constr.datalen; m++) {
70028                 int64_t val_conv_12 = val_vals[m];
70029                 LDKBlindedHop val_conv_12_conv;
70030                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
70031                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
70032                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
70033                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
70034                 val_constr.data[m] = val_conv_12_conv;
70035         }
70036         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
70037         BlindedTail_set_hops(&this_ptr_conv, val_constr);
70038 }
70039
70040 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedTail_1get_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
70041         LDKBlindedTail this_ptr_conv;
70042         this_ptr_conv.inner = untag_ptr(this_ptr);
70043         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70045         this_ptr_conv.is_owned = false;
70046         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
70047         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, BlindedTail_get_blinding_point(&this_ptr_conv).compressed_form);
70048         return ret_arr;
70049 }
70050
70051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1set_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
70052         LDKBlindedTail this_ptr_conv;
70053         this_ptr_conv.inner = untag_ptr(this_ptr);
70054         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70056         this_ptr_conv.is_owned = false;
70057         LDKPublicKey val_ref;
70058         CHECK((*env)->GetArrayLength(env, val) == 33);
70059         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
70060         BlindedTail_set_blinding_point(&this_ptr_conv, val_ref);
70061 }
70062
70063 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1get_1excess_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
70064         LDKBlindedTail this_ptr_conv;
70065         this_ptr_conv.inner = untag_ptr(this_ptr);
70066         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70068         this_ptr_conv.is_owned = false;
70069         int32_t ret_conv = BlindedTail_get_excess_final_cltv_expiry_delta(&this_ptr_conv);
70070         return ret_conv;
70071 }
70072
70073 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) {
70074         LDKBlindedTail this_ptr_conv;
70075         this_ptr_conv.inner = untag_ptr(this_ptr);
70076         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70078         this_ptr_conv.is_owned = false;
70079         BlindedTail_set_excess_final_cltv_expiry_delta(&this_ptr_conv, val);
70080 }
70081
70082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1get_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
70083         LDKBlindedTail this_ptr_conv;
70084         this_ptr_conv.inner = untag_ptr(this_ptr);
70085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70087         this_ptr_conv.is_owned = false;
70088         int64_t ret_conv = BlindedTail_get_final_value_msat(&this_ptr_conv);
70089         return ret_conv;
70090 }
70091
70092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1set_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
70093         LDKBlindedTail this_ptr_conv;
70094         this_ptr_conv.inner = untag_ptr(this_ptr);
70095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70097         this_ptr_conv.is_owned = false;
70098         BlindedTail_set_final_value_msat(&this_ptr_conv, val);
70099 }
70100
70101 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) {
70102         LDKCVec_BlindedHopZ hops_arg_constr;
70103         hops_arg_constr.datalen = (*env)->GetArrayLength(env, hops_arg);
70104         if (hops_arg_constr.datalen > 0)
70105                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
70106         else
70107                 hops_arg_constr.data = NULL;
70108         int64_t* hops_arg_vals = (*env)->GetLongArrayElements (env, hops_arg, NULL);
70109         for (size_t m = 0; m < hops_arg_constr.datalen; m++) {
70110                 int64_t hops_arg_conv_12 = hops_arg_vals[m];
70111                 LDKBlindedHop hops_arg_conv_12_conv;
70112                 hops_arg_conv_12_conv.inner = untag_ptr(hops_arg_conv_12);
70113                 hops_arg_conv_12_conv.is_owned = ptr_is_owned(hops_arg_conv_12);
70114                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_12_conv);
70115                 hops_arg_conv_12_conv = BlindedHop_clone(&hops_arg_conv_12_conv);
70116                 hops_arg_constr.data[m] = hops_arg_conv_12_conv;
70117         }
70118         (*env)->ReleaseLongArrayElements(env, hops_arg, hops_arg_vals, 0);
70119         LDKPublicKey blinding_point_arg_ref;
70120         CHECK((*env)->GetArrayLength(env, blinding_point_arg) == 33);
70121         (*env)->GetByteArrayRegion(env, blinding_point_arg, 0, 33, blinding_point_arg_ref.compressed_form);
70122         LDKBlindedTail ret_var = BlindedTail_new(hops_arg_constr, blinding_point_arg_ref, excess_final_cltv_expiry_delta_arg, final_value_msat_arg);
70123         int64_t ret_ref = 0;
70124         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70125         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70126         return ret_ref;
70127 }
70128
70129 static inline uint64_t BlindedTail_clone_ptr(LDKBlindedTail *NONNULL_PTR arg) {
70130         LDKBlindedTail ret_var = BlindedTail_clone(arg);
70131         int64_t ret_ref = 0;
70132         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70133         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70134         return ret_ref;
70135 }
70136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
70137         LDKBlindedTail arg_conv;
70138         arg_conv.inner = untag_ptr(arg);
70139         arg_conv.is_owned = ptr_is_owned(arg);
70140         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70141         arg_conv.is_owned = false;
70142         int64_t ret_conv = BlindedTail_clone_ptr(&arg_conv);
70143         return ret_conv;
70144 }
70145
70146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70147         LDKBlindedTail orig_conv;
70148         orig_conv.inner = untag_ptr(orig);
70149         orig_conv.is_owned = ptr_is_owned(orig);
70150         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70151         orig_conv.is_owned = false;
70152         LDKBlindedTail ret_var = BlindedTail_clone(&orig_conv);
70153         int64_t ret_ref = 0;
70154         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70155         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70156         return ret_ref;
70157 }
70158
70159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1hash(JNIEnv *env, jclass clz, int64_t o) {
70160         LDKBlindedTail o_conv;
70161         o_conv.inner = untag_ptr(o);
70162         o_conv.is_owned = ptr_is_owned(o);
70163         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
70164         o_conv.is_owned = false;
70165         int64_t ret_conv = BlindedTail_hash(&o_conv);
70166         return ret_conv;
70167 }
70168
70169 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedTail_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
70170         LDKBlindedTail a_conv;
70171         a_conv.inner = untag_ptr(a);
70172         a_conv.is_owned = ptr_is_owned(a);
70173         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70174         a_conv.is_owned = false;
70175         LDKBlindedTail b_conv;
70176         b_conv.inner = untag_ptr(b);
70177         b_conv.is_owned = ptr_is_owned(b);
70178         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
70179         b_conv.is_owned = false;
70180         jboolean ret_conv = BlindedTail_eq(&a_conv, &b_conv);
70181         return ret_conv;
70182 }
70183
70184 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedTail_1write(JNIEnv *env, jclass clz, int64_t obj) {
70185         LDKBlindedTail obj_conv;
70186         obj_conv.inner = untag_ptr(obj);
70187         obj_conv.is_owned = ptr_is_owned(obj);
70188         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70189         obj_conv.is_owned = false;
70190         LDKCVec_u8Z ret_var = BlindedTail_write(&obj_conv);
70191         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
70192         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
70193         CVec_u8Z_free(ret_var);
70194         return ret_arr;
70195 }
70196
70197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
70198         LDKu8slice ser_ref;
70199         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
70200         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
70201         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
70202         *ret_conv = BlindedTail_read(ser_ref);
70203         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
70204         return tag_ptr(ret_conv, true);
70205 }
70206
70207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Path_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
70208         LDKPath this_obj_conv;
70209         this_obj_conv.inner = untag_ptr(this_obj);
70210         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70212         Path_free(this_obj_conv);
70213 }
70214
70215 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Path_1get_1hops(JNIEnv *env, jclass clz, int64_t this_ptr) {
70216         LDKPath this_ptr_conv;
70217         this_ptr_conv.inner = untag_ptr(this_ptr);
70218         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70220         this_ptr_conv.is_owned = false;
70221         LDKCVec_RouteHopZ ret_var = Path_get_hops(&this_ptr_conv);
70222         int64_tArray ret_arr = NULL;
70223         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
70224         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
70225         for (size_t k = 0; k < ret_var.datalen; k++) {
70226                 LDKRouteHop ret_conv_10_var = ret_var.data[k];
70227                 int64_t ret_conv_10_ref = 0;
70228                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
70229                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
70230                 ret_arr_ptr[k] = ret_conv_10_ref;
70231         }
70232         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
70233         FREE(ret_var.data);
70234         return ret_arr;
70235 }
70236
70237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Path_1set_1hops(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
70238         LDKPath this_ptr_conv;
70239         this_ptr_conv.inner = untag_ptr(this_ptr);
70240         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70242         this_ptr_conv.is_owned = false;
70243         LDKCVec_RouteHopZ val_constr;
70244         val_constr.datalen = (*env)->GetArrayLength(env, val);
70245         if (val_constr.datalen > 0)
70246                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
70247         else
70248                 val_constr.data = NULL;
70249         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
70250         for (size_t k = 0; k < val_constr.datalen; k++) {
70251                 int64_t val_conv_10 = val_vals[k];
70252                 LDKRouteHop val_conv_10_conv;
70253                 val_conv_10_conv.inner = untag_ptr(val_conv_10);
70254                 val_conv_10_conv.is_owned = ptr_is_owned(val_conv_10);
70255                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_10_conv);
70256                 val_conv_10_conv = RouteHop_clone(&val_conv_10_conv);
70257                 val_constr.data[k] = val_conv_10_conv;
70258         }
70259         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
70260         Path_set_hops(&this_ptr_conv, val_constr);
70261 }
70262
70263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1get_1blinded_1tail(JNIEnv *env, jclass clz, int64_t this_ptr) {
70264         LDKPath this_ptr_conv;
70265         this_ptr_conv.inner = untag_ptr(this_ptr);
70266         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70268         this_ptr_conv.is_owned = false;
70269         LDKBlindedTail ret_var = Path_get_blinded_tail(&this_ptr_conv);
70270         int64_t ret_ref = 0;
70271         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70272         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70273         return ret_ref;
70274 }
70275
70276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Path_1set_1blinded_1tail(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
70277         LDKPath this_ptr_conv;
70278         this_ptr_conv.inner = untag_ptr(this_ptr);
70279         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70281         this_ptr_conv.is_owned = false;
70282         LDKBlindedTail val_conv;
70283         val_conv.inner = untag_ptr(val);
70284         val_conv.is_owned = ptr_is_owned(val);
70285         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
70286         val_conv = BlindedTail_clone(&val_conv);
70287         Path_set_blinded_tail(&this_ptr_conv, val_conv);
70288 }
70289
70290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1new(JNIEnv *env, jclass clz, int64_tArray hops_arg, int64_t blinded_tail_arg) {
70291         LDKCVec_RouteHopZ hops_arg_constr;
70292         hops_arg_constr.datalen = (*env)->GetArrayLength(env, hops_arg);
70293         if (hops_arg_constr.datalen > 0)
70294                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
70295         else
70296                 hops_arg_constr.data = NULL;
70297         int64_t* hops_arg_vals = (*env)->GetLongArrayElements (env, hops_arg, NULL);
70298         for (size_t k = 0; k < hops_arg_constr.datalen; k++) {
70299                 int64_t hops_arg_conv_10 = hops_arg_vals[k];
70300                 LDKRouteHop hops_arg_conv_10_conv;
70301                 hops_arg_conv_10_conv.inner = untag_ptr(hops_arg_conv_10);
70302                 hops_arg_conv_10_conv.is_owned = ptr_is_owned(hops_arg_conv_10);
70303                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_10_conv);
70304                 hops_arg_conv_10_conv = RouteHop_clone(&hops_arg_conv_10_conv);
70305                 hops_arg_constr.data[k] = hops_arg_conv_10_conv;
70306         }
70307         (*env)->ReleaseLongArrayElements(env, hops_arg, hops_arg_vals, 0);
70308         LDKBlindedTail blinded_tail_arg_conv;
70309         blinded_tail_arg_conv.inner = untag_ptr(blinded_tail_arg);
70310         blinded_tail_arg_conv.is_owned = ptr_is_owned(blinded_tail_arg);
70311         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_tail_arg_conv);
70312         blinded_tail_arg_conv = BlindedTail_clone(&blinded_tail_arg_conv);
70313         LDKPath ret_var = Path_new(hops_arg_constr, blinded_tail_arg_conv);
70314         int64_t ret_ref = 0;
70315         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70316         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70317         return ret_ref;
70318 }
70319
70320 static inline uint64_t Path_clone_ptr(LDKPath *NONNULL_PTR arg) {
70321         LDKPath ret_var = Path_clone(arg);
70322         int64_t ret_ref = 0;
70323         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70324         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70325         return ret_ref;
70326 }
70327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
70328         LDKPath arg_conv;
70329         arg_conv.inner = untag_ptr(arg);
70330         arg_conv.is_owned = ptr_is_owned(arg);
70331         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70332         arg_conv.is_owned = false;
70333         int64_t ret_conv = Path_clone_ptr(&arg_conv);
70334         return ret_conv;
70335 }
70336
70337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70338         LDKPath orig_conv;
70339         orig_conv.inner = untag_ptr(orig);
70340         orig_conv.is_owned = ptr_is_owned(orig);
70341         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70342         orig_conv.is_owned = false;
70343         LDKPath ret_var = Path_clone(&orig_conv);
70344         int64_t ret_ref = 0;
70345         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70346         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70347         return ret_ref;
70348 }
70349
70350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1hash(JNIEnv *env, jclass clz, int64_t o) {
70351         LDKPath o_conv;
70352         o_conv.inner = untag_ptr(o);
70353         o_conv.is_owned = ptr_is_owned(o);
70354         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
70355         o_conv.is_owned = false;
70356         int64_t ret_conv = Path_hash(&o_conv);
70357         return ret_conv;
70358 }
70359
70360 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Path_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
70361         LDKPath a_conv;
70362         a_conv.inner = untag_ptr(a);
70363         a_conv.is_owned = ptr_is_owned(a);
70364         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70365         a_conv.is_owned = false;
70366         LDKPath b_conv;
70367         b_conv.inner = untag_ptr(b);
70368         b_conv.is_owned = ptr_is_owned(b);
70369         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
70370         b_conv.is_owned = false;
70371         jboolean ret_conv = Path_eq(&a_conv, &b_conv);
70372         return ret_conv;
70373 }
70374
70375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
70376         LDKPath this_arg_conv;
70377         this_arg_conv.inner = untag_ptr(this_arg);
70378         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70380         this_arg_conv.is_owned = false;
70381         int64_t ret_conv = Path_fee_msat(&this_arg_conv);
70382         return ret_conv;
70383 }
70384
70385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
70386         LDKPath this_arg_conv;
70387         this_arg_conv.inner = untag_ptr(this_arg);
70388         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70390         this_arg_conv.is_owned = false;
70391         int64_t ret_conv = Path_final_value_msat(&this_arg_conv);
70392         return ret_conv;
70393 }
70394
70395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_arg) {
70396         LDKPath this_arg_conv;
70397         this_arg_conv.inner = untag_ptr(this_arg);
70398         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70400         this_arg_conv.is_owned = false;
70401         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
70402         *ret_copy = Path_final_cltv_expiry_delta(&this_arg_conv);
70403         int64_t ret_ref = tag_ptr(ret_copy, true);
70404         return ret_ref;
70405 }
70406
70407 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
70408         LDKRoute this_obj_conv;
70409         this_obj_conv.inner = untag_ptr(this_obj);
70410         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70412         Route_free(this_obj_conv);
70413 }
70414
70415 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Route_1get_1paths(JNIEnv *env, jclass clz, int64_t this_ptr) {
70416         LDKRoute this_ptr_conv;
70417         this_ptr_conv.inner = untag_ptr(this_ptr);
70418         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70420         this_ptr_conv.is_owned = false;
70421         LDKCVec_PathZ ret_var = Route_get_paths(&this_ptr_conv);
70422         int64_tArray ret_arr = NULL;
70423         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
70424         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
70425         for (size_t g = 0; g < ret_var.datalen; g++) {
70426                 LDKPath ret_conv_6_var = ret_var.data[g];
70427                 int64_t ret_conv_6_ref = 0;
70428                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
70429                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
70430                 ret_arr_ptr[g] = ret_conv_6_ref;
70431         }
70432         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
70433         FREE(ret_var.data);
70434         return ret_arr;
70435 }
70436
70437 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
70438         LDKRoute this_ptr_conv;
70439         this_ptr_conv.inner = untag_ptr(this_ptr);
70440         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70442         this_ptr_conv.is_owned = false;
70443         LDKCVec_PathZ val_constr;
70444         val_constr.datalen = (*env)->GetArrayLength(env, val);
70445         if (val_constr.datalen > 0)
70446                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
70447         else
70448                 val_constr.data = NULL;
70449         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
70450         for (size_t g = 0; g < val_constr.datalen; g++) {
70451                 int64_t val_conv_6 = val_vals[g];
70452                 LDKPath val_conv_6_conv;
70453                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
70454                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
70455                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
70456                 val_conv_6_conv = Path_clone(&val_conv_6_conv);
70457                 val_constr.data[g] = val_conv_6_conv;
70458         }
70459         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
70460         Route_set_paths(&this_ptr_conv, val_constr);
70461 }
70462
70463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1route_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
70464         LDKRoute this_ptr_conv;
70465         this_ptr_conv.inner = untag_ptr(this_ptr);
70466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70468         this_ptr_conv.is_owned = false;
70469         LDKRouteParameters ret_var = Route_get_route_params(&this_ptr_conv);
70470         int64_t ret_ref = 0;
70471         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70472         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70473         return ret_ref;
70474 }
70475
70476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1route_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
70477         LDKRoute this_ptr_conv;
70478         this_ptr_conv.inner = untag_ptr(this_ptr);
70479         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70481         this_ptr_conv.is_owned = false;
70482         LDKRouteParameters val_conv;
70483         val_conv.inner = untag_ptr(val);
70484         val_conv.is_owned = ptr_is_owned(val);
70485         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
70486         val_conv = RouteParameters_clone(&val_conv);
70487         Route_set_route_params(&this_ptr_conv, val_conv);
70488 }
70489
70490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, int64_tArray paths_arg, int64_t route_params_arg) {
70491         LDKCVec_PathZ paths_arg_constr;
70492         paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
70493         if (paths_arg_constr.datalen > 0)
70494                 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
70495         else
70496                 paths_arg_constr.data = NULL;
70497         int64_t* paths_arg_vals = (*env)->GetLongArrayElements (env, paths_arg, NULL);
70498         for (size_t g = 0; g < paths_arg_constr.datalen; g++) {
70499                 int64_t paths_arg_conv_6 = paths_arg_vals[g];
70500                 LDKPath paths_arg_conv_6_conv;
70501                 paths_arg_conv_6_conv.inner = untag_ptr(paths_arg_conv_6);
70502                 paths_arg_conv_6_conv.is_owned = ptr_is_owned(paths_arg_conv_6);
70503                 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_6_conv);
70504                 paths_arg_conv_6_conv = Path_clone(&paths_arg_conv_6_conv);
70505                 paths_arg_constr.data[g] = paths_arg_conv_6_conv;
70506         }
70507         (*env)->ReleaseLongArrayElements(env, paths_arg, paths_arg_vals, 0);
70508         LDKRouteParameters route_params_arg_conv;
70509         route_params_arg_conv.inner = untag_ptr(route_params_arg);
70510         route_params_arg_conv.is_owned = ptr_is_owned(route_params_arg);
70511         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_arg_conv);
70512         route_params_arg_conv = RouteParameters_clone(&route_params_arg_conv);
70513         LDKRoute ret_var = Route_new(paths_arg_constr, route_params_arg_conv);
70514         int64_t ret_ref = 0;
70515         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70516         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70517         return ret_ref;
70518 }
70519
70520 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
70521         LDKRoute ret_var = Route_clone(arg);
70522         int64_t ret_ref = 0;
70523         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70524         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70525         return ret_ref;
70526 }
70527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
70528         LDKRoute arg_conv;
70529         arg_conv.inner = untag_ptr(arg);
70530         arg_conv.is_owned = ptr_is_owned(arg);
70531         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70532         arg_conv.is_owned = false;
70533         int64_t ret_conv = Route_clone_ptr(&arg_conv);
70534         return ret_conv;
70535 }
70536
70537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70538         LDKRoute orig_conv;
70539         orig_conv.inner = untag_ptr(orig);
70540         orig_conv.is_owned = ptr_is_owned(orig);
70541         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70542         orig_conv.is_owned = false;
70543         LDKRoute ret_var = Route_clone(&orig_conv);
70544         int64_t ret_ref = 0;
70545         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70546         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70547         return ret_ref;
70548 }
70549
70550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1hash(JNIEnv *env, jclass clz, int64_t o) {
70551         LDKRoute o_conv;
70552         o_conv.inner = untag_ptr(o);
70553         o_conv.is_owned = ptr_is_owned(o);
70554         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
70555         o_conv.is_owned = false;
70556         int64_t ret_conv = Route_hash(&o_conv);
70557         return ret_conv;
70558 }
70559
70560 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Route_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
70561         LDKRoute a_conv;
70562         a_conv.inner = untag_ptr(a);
70563         a_conv.is_owned = ptr_is_owned(a);
70564         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70565         a_conv.is_owned = false;
70566         LDKRoute b_conv;
70567         b_conv.inner = untag_ptr(b);
70568         b_conv.is_owned = ptr_is_owned(b);
70569         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
70570         b_conv.is_owned = false;
70571         jboolean ret_conv = Route_eq(&a_conv, &b_conv);
70572         return ret_conv;
70573 }
70574
70575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1fees(JNIEnv *env, jclass clz, int64_t this_arg) {
70576         LDKRoute this_arg_conv;
70577         this_arg_conv.inner = untag_ptr(this_arg);
70578         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70580         this_arg_conv.is_owned = false;
70581         int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
70582         return ret_conv;
70583 }
70584
70585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
70586         LDKRoute this_arg_conv;
70587         this_arg_conv.inner = untag_ptr(this_arg);
70588         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70590         this_arg_conv.is_owned = false;
70591         int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
70592         return ret_conv;
70593 }
70594
70595 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
70596         LDKRoute obj_conv;
70597         obj_conv.inner = untag_ptr(obj);
70598         obj_conv.is_owned = ptr_is_owned(obj);
70599         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70600         obj_conv.is_owned = false;
70601         LDKCVec_u8Z ret_var = Route_write(&obj_conv);
70602         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
70603         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
70604         CVec_u8Z_free(ret_var);
70605         return ret_arr;
70606 }
70607
70608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
70609         LDKu8slice ser_ref;
70610         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
70611         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
70612         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
70613         *ret_conv = Route_read(ser_ref);
70614         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
70615         return tag_ptr(ret_conv, true);
70616 }
70617
70618 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
70619         LDKRouteParameters this_obj_conv;
70620         this_obj_conv.inner = untag_ptr(this_obj);
70621         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70623         RouteParameters_free(this_obj_conv);
70624 }
70625
70626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
70627         LDKRouteParameters this_ptr_conv;
70628         this_ptr_conv.inner = untag_ptr(this_ptr);
70629         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70631         this_ptr_conv.is_owned = false;
70632         LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
70633         int64_t ret_ref = 0;
70634         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70635         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70636         return ret_ref;
70637 }
70638
70639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
70640         LDKRouteParameters this_ptr_conv;
70641         this_ptr_conv.inner = untag_ptr(this_ptr);
70642         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70644         this_ptr_conv.is_owned = false;
70645         LDKPaymentParameters val_conv;
70646         val_conv.inner = untag_ptr(val);
70647         val_conv.is_owned = ptr_is_owned(val);
70648         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
70649         val_conv = PaymentParameters_clone(&val_conv);
70650         RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
70651 }
70652
70653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
70654         LDKRouteParameters this_ptr_conv;
70655         this_ptr_conv.inner = untag_ptr(this_ptr);
70656         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70658         this_ptr_conv.is_owned = false;
70659         int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
70660         return ret_conv;
70661 }
70662
70663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
70664         LDKRouteParameters this_ptr_conv;
70665         this_ptr_conv.inner = untag_ptr(this_ptr);
70666         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70668         this_ptr_conv.is_owned = false;
70669         RouteParameters_set_final_value_msat(&this_ptr_conv, val);
70670 }
70671
70672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1max_1total_1routing_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
70673         LDKRouteParameters this_ptr_conv;
70674         this_ptr_conv.inner = untag_ptr(this_ptr);
70675         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70677         this_ptr_conv.is_owned = false;
70678         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
70679         *ret_copy = RouteParameters_get_max_total_routing_fee_msat(&this_ptr_conv);
70680         int64_t ret_ref = tag_ptr(ret_copy, true);
70681         return ret_ref;
70682 }
70683
70684 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) {
70685         LDKRouteParameters this_ptr_conv;
70686         this_ptr_conv.inner = untag_ptr(this_ptr);
70687         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70689         this_ptr_conv.is_owned = false;
70690         void* val_ptr = untag_ptr(val);
70691         CHECK_ACCESS(val_ptr);
70692         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
70693         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
70694         RouteParameters_set_max_total_routing_fee_msat(&this_ptr_conv, val_conv);
70695 }
70696
70697 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) {
70698         LDKPaymentParameters payment_params_arg_conv;
70699         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
70700         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
70701         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
70702         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
70703         void* max_total_routing_fee_msat_arg_ptr = untag_ptr(max_total_routing_fee_msat_arg);
70704         CHECK_ACCESS(max_total_routing_fee_msat_arg_ptr);
70705         LDKCOption_u64Z max_total_routing_fee_msat_arg_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_arg_ptr);
70706         max_total_routing_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat_arg));
70707         LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, max_total_routing_fee_msat_arg_conv);
70708         int64_t ret_ref = 0;
70709         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70710         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70711         return ret_ref;
70712 }
70713
70714 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
70715         LDKRouteParameters ret_var = RouteParameters_clone(arg);
70716         int64_t ret_ref = 0;
70717         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70718         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70719         return ret_ref;
70720 }
70721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
70722         LDKRouteParameters arg_conv;
70723         arg_conv.inner = untag_ptr(arg);
70724         arg_conv.is_owned = ptr_is_owned(arg);
70725         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70726         arg_conv.is_owned = false;
70727         int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
70728         return ret_conv;
70729 }
70730
70731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70732         LDKRouteParameters orig_conv;
70733         orig_conv.inner = untag_ptr(orig);
70734         orig_conv.is_owned = ptr_is_owned(orig);
70735         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70736         orig_conv.is_owned = false;
70737         LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
70738         int64_t ret_ref = 0;
70739         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70740         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70741         return ret_ref;
70742 }
70743
70744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
70745         LDKRouteParameters o_conv;
70746         o_conv.inner = untag_ptr(o);
70747         o_conv.is_owned = ptr_is_owned(o);
70748         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
70749         o_conv.is_owned = false;
70750         int64_t ret_conv = RouteParameters_hash(&o_conv);
70751         return ret_conv;
70752 }
70753
70754 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
70755         LDKRouteParameters a_conv;
70756         a_conv.inner = untag_ptr(a);
70757         a_conv.is_owned = ptr_is_owned(a);
70758         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70759         a_conv.is_owned = false;
70760         LDKRouteParameters b_conv;
70761         b_conv.inner = untag_ptr(b);
70762         b_conv.is_owned = ptr_is_owned(b);
70763         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
70764         b_conv.is_owned = false;
70765         jboolean ret_conv = RouteParameters_eq(&a_conv, &b_conv);
70766         return ret_conv;
70767 }
70768
70769 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) {
70770         LDKPaymentParameters payment_params_conv;
70771         payment_params_conv.inner = untag_ptr(payment_params);
70772         payment_params_conv.is_owned = ptr_is_owned(payment_params);
70773         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_conv);
70774         payment_params_conv = PaymentParameters_clone(&payment_params_conv);
70775         LDKRouteParameters ret_var = RouteParameters_from_payment_params_and_value(payment_params_conv, final_value_msat);
70776         int64_t ret_ref = 0;
70777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70779         return ret_ref;
70780 }
70781
70782 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
70783         LDKRouteParameters obj_conv;
70784         obj_conv.inner = untag_ptr(obj);
70785         obj_conv.is_owned = ptr_is_owned(obj);
70786         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70787         obj_conv.is_owned = false;
70788         LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
70789         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
70790         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
70791         CVec_u8Z_free(ret_var);
70792         return ret_arr;
70793 }
70794
70795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
70796         LDKu8slice ser_ref;
70797         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
70798         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
70799         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
70800         *ret_conv = RouteParameters_read(ser_ref);
70801         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
70802         return tag_ptr(ret_conv, true);
70803 }
70804
70805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
70806         LDKPaymentParameters this_obj_conv;
70807         this_obj_conv.inner = untag_ptr(this_obj);
70808         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70810         PaymentParameters_free(this_obj_conv);
70811 }
70812
70813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1payee(JNIEnv *env, jclass clz, int64_t this_ptr) {
70814         LDKPaymentParameters this_ptr_conv;
70815         this_ptr_conv.inner = untag_ptr(this_ptr);
70816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70818         this_ptr_conv.is_owned = false;
70819         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
70820         *ret_copy = PaymentParameters_get_payee(&this_ptr_conv);
70821         int64_t ret_ref = tag_ptr(ret_copy, true);
70822         return ret_ref;
70823 }
70824
70825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1payee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
70826         LDKPaymentParameters this_ptr_conv;
70827         this_ptr_conv.inner = untag_ptr(this_ptr);
70828         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70830         this_ptr_conv.is_owned = false;
70831         void* val_ptr = untag_ptr(val);
70832         CHECK_ACCESS(val_ptr);
70833         LDKPayee val_conv = *(LDKPayee*)(val_ptr);
70834         val_conv = Payee_clone((LDKPayee*)untag_ptr(val));
70835         PaymentParameters_set_payee(&this_ptr_conv, val_conv);
70836 }
70837
70838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr) {
70839         LDKPaymentParameters this_ptr_conv;
70840         this_ptr_conv.inner = untag_ptr(this_ptr);
70841         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70843         this_ptr_conv.is_owned = false;
70844         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
70845         *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
70846         int64_t ret_ref = tag_ptr(ret_copy, true);
70847         return ret_ref;
70848 }
70849
70850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
70851         LDKPaymentParameters this_ptr_conv;
70852         this_ptr_conv.inner = untag_ptr(this_ptr);
70853         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70855         this_ptr_conv.is_owned = false;
70856         void* val_ptr = untag_ptr(val);
70857         CHECK_ACCESS(val_ptr);
70858         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
70859         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
70860         PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
70861 }
70862
70863 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1total_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
70864         LDKPaymentParameters this_ptr_conv;
70865         this_ptr_conv.inner = untag_ptr(this_ptr);
70866         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70868         this_ptr_conv.is_owned = false;
70869         int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
70870         return ret_conv;
70871 }
70872
70873 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) {
70874         LDKPaymentParameters this_ptr_conv;
70875         this_ptr_conv.inner = untag_ptr(this_ptr);
70876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70878         this_ptr_conv.is_owned = false;
70879         PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
70880 }
70881
70882 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1path_1count(JNIEnv *env, jclass clz, int64_t this_ptr) {
70883         LDKPaymentParameters this_ptr_conv;
70884         this_ptr_conv.inner = untag_ptr(this_ptr);
70885         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70887         this_ptr_conv.is_owned = false;
70888         int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
70889         return ret_conv;
70890 }
70891
70892 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1max_1path_1count(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
70893         LDKPaymentParameters this_ptr_conv;
70894         this_ptr_conv.inner = untag_ptr(this_ptr);
70895         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70897         this_ptr_conv.is_owned = false;
70898         PaymentParameters_set_max_path_count(&this_ptr_conv, val);
70899 }
70900
70901 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) {
70902         LDKPaymentParameters this_ptr_conv;
70903         this_ptr_conv.inner = untag_ptr(this_ptr);
70904         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70906         this_ptr_conv.is_owned = false;
70907         int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
70908         return ret_conv;
70909 }
70910
70911 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) {
70912         LDKPaymentParameters this_ptr_conv;
70913         this_ptr_conv.inner = untag_ptr(this_ptr);
70914         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70916         this_ptr_conv.is_owned = false;
70917         PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
70918 }
70919
70920 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1previously_1failed_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
70921         LDKPaymentParameters this_ptr_conv;
70922         this_ptr_conv.inner = untag_ptr(this_ptr);
70923         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70925         this_ptr_conv.is_owned = false;
70926         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
70927         int64_tArray ret_arr = NULL;
70928         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
70929         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
70930         for (size_t g = 0; g < ret_var.datalen; g++) {
70931                 int64_t ret_conv_6_conv = ret_var.data[g];
70932                 ret_arr_ptr[g] = ret_conv_6_conv;
70933         }
70934         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
70935         FREE(ret_var.data);
70936         return ret_arr;
70937 }
70938
70939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1previously_1failed_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
70940         LDKPaymentParameters this_ptr_conv;
70941         this_ptr_conv.inner = untag_ptr(this_ptr);
70942         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70944         this_ptr_conv.is_owned = false;
70945         LDKCVec_u64Z val_constr;
70946         val_constr.datalen = (*env)->GetArrayLength(env, val);
70947         if (val_constr.datalen > 0)
70948                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
70949         else
70950                 val_constr.data = NULL;
70951         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
70952         for (size_t g = 0; g < val_constr.datalen; g++) {
70953                 int64_t val_conv_6 = val_vals[g];
70954                 val_constr.data[g] = val_conv_6;
70955         }
70956         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
70957         PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
70958 }
70959
70960 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1previously_1failed_1blinded_1path_1idxs(JNIEnv *env, jclass clz, int64_t this_ptr) {
70961         LDKPaymentParameters this_ptr_conv;
70962         this_ptr_conv.inner = untag_ptr(this_ptr);
70963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70965         this_ptr_conv.is_owned = false;
70966         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_blinded_path_idxs(&this_ptr_conv);
70967         int64_tArray ret_arr = NULL;
70968         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
70969         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
70970         for (size_t g = 0; g < ret_var.datalen; g++) {
70971                 int64_t ret_conv_6_conv = ret_var.data[g];
70972                 ret_arr_ptr[g] = ret_conv_6_conv;
70973         }
70974         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
70975         FREE(ret_var.data);
70976         return ret_arr;
70977 }
70978
70979 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) {
70980         LDKPaymentParameters this_ptr_conv;
70981         this_ptr_conv.inner = untag_ptr(this_ptr);
70982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70984         this_ptr_conv.is_owned = false;
70985         LDKCVec_u64Z val_constr;
70986         val_constr.datalen = (*env)->GetArrayLength(env, val);
70987         if (val_constr.datalen > 0)
70988                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
70989         else
70990                 val_constr.data = NULL;
70991         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
70992         for (size_t g = 0; g < val_constr.datalen; g++) {
70993                 int64_t val_conv_6 = val_vals[g];
70994                 val_constr.data[g] = val_conv_6;
70995         }
70996         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
70997         PaymentParameters_set_previously_failed_blinded_path_idxs(&this_ptr_conv, val_constr);
70998 }
70999
71000 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) {
71001         void* payee_arg_ptr = untag_ptr(payee_arg);
71002         CHECK_ACCESS(payee_arg_ptr);
71003         LDKPayee payee_arg_conv = *(LDKPayee*)(payee_arg_ptr);
71004         payee_arg_conv = Payee_clone((LDKPayee*)untag_ptr(payee_arg));
71005         void* expiry_time_arg_ptr = untag_ptr(expiry_time_arg);
71006         CHECK_ACCESS(expiry_time_arg_ptr);
71007         LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
71008         expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(expiry_time_arg));
71009         LDKCVec_u64Z previously_failed_channels_arg_constr;
71010         previously_failed_channels_arg_constr.datalen = (*env)->GetArrayLength(env, previously_failed_channels_arg);
71011         if (previously_failed_channels_arg_constr.datalen > 0)
71012                 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
71013         else
71014                 previously_failed_channels_arg_constr.data = NULL;
71015         int64_t* previously_failed_channels_arg_vals = (*env)->GetLongArrayElements (env, previously_failed_channels_arg, NULL);
71016         for (size_t g = 0; g < previously_failed_channels_arg_constr.datalen; g++) {
71017                 int64_t previously_failed_channels_arg_conv_6 = previously_failed_channels_arg_vals[g];
71018                 previously_failed_channels_arg_constr.data[g] = previously_failed_channels_arg_conv_6;
71019         }
71020         (*env)->ReleaseLongArrayElements(env, previously_failed_channels_arg, previously_failed_channels_arg_vals, 0);
71021         LDKCVec_u64Z previously_failed_blinded_path_idxs_arg_constr;
71022         previously_failed_blinded_path_idxs_arg_constr.datalen = (*env)->GetArrayLength(env, previously_failed_blinded_path_idxs_arg);
71023         if (previously_failed_blinded_path_idxs_arg_constr.datalen > 0)
71024                 previously_failed_blinded_path_idxs_arg_constr.data = MALLOC(previously_failed_blinded_path_idxs_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
71025         else
71026                 previously_failed_blinded_path_idxs_arg_constr.data = NULL;
71027         int64_t* previously_failed_blinded_path_idxs_arg_vals = (*env)->GetLongArrayElements (env, previously_failed_blinded_path_idxs_arg, NULL);
71028         for (size_t g = 0; g < previously_failed_blinded_path_idxs_arg_constr.datalen; g++) {
71029                 int64_t previously_failed_blinded_path_idxs_arg_conv_6 = previously_failed_blinded_path_idxs_arg_vals[g];
71030                 previously_failed_blinded_path_idxs_arg_constr.data[g] = previously_failed_blinded_path_idxs_arg_conv_6;
71031         }
71032         (*env)->ReleaseLongArrayElements(env, previously_failed_blinded_path_idxs_arg, previously_failed_blinded_path_idxs_arg_vals, 0);
71033         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);
71034         int64_t ret_ref = 0;
71035         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71036         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71037         return ret_ref;
71038 }
71039
71040 static inline uint64_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
71041         LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
71042         int64_t ret_ref = 0;
71043         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71044         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71045         return ret_ref;
71046 }
71047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71048         LDKPaymentParameters arg_conv;
71049         arg_conv.inner = untag_ptr(arg);
71050         arg_conv.is_owned = ptr_is_owned(arg);
71051         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71052         arg_conv.is_owned = false;
71053         int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
71054         return ret_conv;
71055 }
71056
71057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71058         LDKPaymentParameters orig_conv;
71059         orig_conv.inner = untag_ptr(orig);
71060         orig_conv.is_owned = ptr_is_owned(orig);
71061         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71062         orig_conv.is_owned = false;
71063         LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
71064         int64_t ret_ref = 0;
71065         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71066         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71067         return ret_ref;
71068 }
71069
71070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
71071         LDKPaymentParameters o_conv;
71072         o_conv.inner = untag_ptr(o);
71073         o_conv.is_owned = ptr_is_owned(o);
71074         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
71075         o_conv.is_owned = false;
71076         int64_t ret_conv = PaymentParameters_hash(&o_conv);
71077         return ret_conv;
71078 }
71079
71080 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
71081         LDKPaymentParameters a_conv;
71082         a_conv.inner = untag_ptr(a);
71083         a_conv.is_owned = ptr_is_owned(a);
71084         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
71085         a_conv.is_owned = false;
71086         LDKPaymentParameters b_conv;
71087         b_conv.inner = untag_ptr(b);
71088         b_conv.is_owned = ptr_is_owned(b);
71089         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
71090         b_conv.is_owned = false;
71091         jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
71092         return ret_conv;
71093 }
71094
71095 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
71096         LDKPaymentParameters obj_conv;
71097         obj_conv.inner = untag_ptr(obj);
71098         obj_conv.is_owned = ptr_is_owned(obj);
71099         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71100         obj_conv.is_owned = false;
71101         LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
71102         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
71103         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
71104         CVec_u8Z_free(ret_var);
71105         return ret_arr;
71106 }
71107
71108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser, int32_t arg) {
71109         LDKu8slice ser_ref;
71110         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
71111         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
71112         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
71113         *ret_conv = PaymentParameters_read(ser_ref, arg);
71114         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
71115         return tag_ptr(ret_conv, true);
71116 }
71117
71118 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) {
71119         LDKPublicKey payee_pubkey_ref;
71120         CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
71121         (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
71122         LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref, final_cltv_expiry_delta);
71123         int64_t ret_ref = 0;
71124         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71125         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71126         return ret_ref;
71127 }
71128
71129 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) {
71130         LDKPublicKey payee_pubkey_ref;
71131         CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
71132         (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
71133         LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref, final_cltv_expiry_delta, allow_mpp);
71134         int64_t ret_ref = 0;
71135         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71136         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71137         return ret_ref;
71138 }
71139
71140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1from_1bolt12_1invoice(JNIEnv *env, jclass clz, int64_t invoice) {
71141         LDKBolt12Invoice invoice_conv;
71142         invoice_conv.inner = untag_ptr(invoice);
71143         invoice_conv.is_owned = ptr_is_owned(invoice);
71144         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
71145         invoice_conv.is_owned = false;
71146         LDKPaymentParameters ret_var = PaymentParameters_from_bolt12_invoice(&invoice_conv);
71147         int64_t ret_ref = 0;
71148         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71149         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71150         return ret_ref;
71151 }
71152
71153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1blinded(JNIEnv *env, jclass clz, int64_tArray blinded_route_hints) {
71154         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ blinded_route_hints_constr;
71155         blinded_route_hints_constr.datalen = (*env)->GetArrayLength(env, blinded_route_hints);
71156         if (blinded_route_hints_constr.datalen > 0)
71157                 blinded_route_hints_constr.data = MALLOC(blinded_route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
71158         else
71159                 blinded_route_hints_constr.data = NULL;
71160         int64_t* blinded_route_hints_vals = (*env)->GetLongArrayElements (env, blinded_route_hints, NULL);
71161         for (size_t l = 0; l < blinded_route_hints_constr.datalen; l++) {
71162                 int64_t blinded_route_hints_conv_37 = blinded_route_hints_vals[l];
71163                 void* blinded_route_hints_conv_37_ptr = untag_ptr(blinded_route_hints_conv_37);
71164                 CHECK_ACCESS(blinded_route_hints_conv_37_ptr);
71165                 LDKC2Tuple_BlindedPayInfoBlindedPathZ blinded_route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(blinded_route_hints_conv_37_ptr);
71166                 blinded_route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(blinded_route_hints_conv_37));
71167                 blinded_route_hints_constr.data[l] = blinded_route_hints_conv_37_conv;
71168         }
71169         (*env)->ReleaseLongArrayElements(env, blinded_route_hints, blinded_route_hints_vals, 0);
71170         LDKPaymentParameters ret_var = PaymentParameters_blinded(blinded_route_hints_constr);
71171         int64_t ret_ref = 0;
71172         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71173         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71174         return ret_ref;
71175 }
71176
71177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
71178         if (!ptr_is_owned(this_ptr)) return;
71179         void* this_ptr_ptr = untag_ptr(this_ptr);
71180         CHECK_ACCESS(this_ptr_ptr);
71181         LDKPayee this_ptr_conv = *(LDKPayee*)(this_ptr_ptr);
71182         FREE(untag_ptr(this_ptr));
71183         Payee_free(this_ptr_conv);
71184 }
71185
71186 static inline uint64_t Payee_clone_ptr(LDKPayee *NONNULL_PTR arg) {
71187         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
71188         *ret_copy = Payee_clone(arg);
71189         int64_t ret_ref = tag_ptr(ret_copy, true);
71190         return ret_ref;
71191 }
71192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71193         LDKPayee* arg_conv = (LDKPayee*)untag_ptr(arg);
71194         int64_t ret_conv = Payee_clone_ptr(arg_conv);
71195         return ret_conv;
71196 }
71197
71198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71199         LDKPayee* orig_conv = (LDKPayee*)untag_ptr(orig);
71200         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
71201         *ret_copy = Payee_clone(orig_conv);
71202         int64_t ret_ref = tag_ptr(ret_copy, true);
71203         return ret_ref;
71204 }
71205
71206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1blinded(JNIEnv *env, jclass clz, int64_tArray route_hints, int64_t features) {
71207         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_constr;
71208         route_hints_constr.datalen = (*env)->GetArrayLength(env, route_hints);
71209         if (route_hints_constr.datalen > 0)
71210                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
71211         else
71212                 route_hints_constr.data = NULL;
71213         int64_t* route_hints_vals = (*env)->GetLongArrayElements (env, route_hints, NULL);
71214         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
71215                 int64_t route_hints_conv_37 = route_hints_vals[l];
71216                 void* route_hints_conv_37_ptr = untag_ptr(route_hints_conv_37);
71217                 CHECK_ACCESS(route_hints_conv_37_ptr);
71218                 LDKC2Tuple_BlindedPayInfoBlindedPathZ route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(route_hints_conv_37_ptr);
71219                 route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(route_hints_conv_37));
71220                 route_hints_constr.data[l] = route_hints_conv_37_conv;
71221         }
71222         (*env)->ReleaseLongArrayElements(env, route_hints, route_hints_vals, 0);
71223         LDKBolt12InvoiceFeatures features_conv;
71224         features_conv.inner = untag_ptr(features);
71225         features_conv.is_owned = ptr_is_owned(features);
71226         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
71227         features_conv = Bolt12InvoiceFeatures_clone(&features_conv);
71228         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
71229         *ret_copy = Payee_blinded(route_hints_constr, features_conv);
71230         int64_t ret_ref = tag_ptr(ret_copy, true);
71231         return ret_ref;
71232 }
71233
71234 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) {
71235         LDKPublicKey node_id_ref;
71236         CHECK((*env)->GetArrayLength(env, node_id) == 33);
71237         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
71238         LDKCVec_RouteHintZ route_hints_constr;
71239         route_hints_constr.datalen = (*env)->GetArrayLength(env, route_hints);
71240         if (route_hints_constr.datalen > 0)
71241                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
71242         else
71243                 route_hints_constr.data = NULL;
71244         int64_t* route_hints_vals = (*env)->GetLongArrayElements (env, route_hints, NULL);
71245         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
71246                 int64_t route_hints_conv_11 = route_hints_vals[l];
71247                 LDKRouteHint route_hints_conv_11_conv;
71248                 route_hints_conv_11_conv.inner = untag_ptr(route_hints_conv_11);
71249                 route_hints_conv_11_conv.is_owned = ptr_is_owned(route_hints_conv_11);
71250                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_conv);
71251                 route_hints_conv_11_conv = RouteHint_clone(&route_hints_conv_11_conv);
71252                 route_hints_constr.data[l] = route_hints_conv_11_conv;
71253         }
71254         (*env)->ReleaseLongArrayElements(env, route_hints, route_hints_vals, 0);
71255         LDKBolt11InvoiceFeatures features_conv;
71256         features_conv.inner = untag_ptr(features);
71257         features_conv.is_owned = ptr_is_owned(features);
71258         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
71259         features_conv = Bolt11InvoiceFeatures_clone(&features_conv);
71260         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
71261         *ret_copy = Payee_clear(node_id_ref, route_hints_constr, features_conv, final_cltv_expiry_delta);
71262         int64_t ret_ref = tag_ptr(ret_copy, true);
71263         return ret_ref;
71264 }
71265
71266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1hash(JNIEnv *env, jclass clz, int64_t o) {
71267         LDKPayee* o_conv = (LDKPayee*)untag_ptr(o);
71268         int64_t ret_conv = Payee_hash(o_conv);
71269         return ret_conv;
71270 }
71271
71272 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Payee_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
71273         LDKPayee* a_conv = (LDKPayee*)untag_ptr(a);
71274         LDKPayee* b_conv = (LDKPayee*)untag_ptr(b);
71275         jboolean ret_conv = Payee_eq(a_conv, b_conv);
71276         return ret_conv;
71277 }
71278
71279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
71280         LDKRouteHint this_obj_conv;
71281         this_obj_conv.inner = untag_ptr(this_obj);
71282         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71284         RouteHint_free(this_obj_conv);
71285 }
71286
71287 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
71288         LDKRouteHint this_ptr_conv;
71289         this_ptr_conv.inner = untag_ptr(this_ptr);
71290         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71292         this_ptr_conv.is_owned = false;
71293         LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
71294         int64_tArray ret_arr = NULL;
71295         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
71296         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
71297         for (size_t o = 0; o < ret_var.datalen; o++) {
71298                 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
71299                 int64_t ret_conv_14_ref = 0;
71300                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
71301                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
71302                 ret_arr_ptr[o] = ret_conv_14_ref;
71303         }
71304         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
71305         FREE(ret_var.data);
71306         return ret_arr;
71307 }
71308
71309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
71310         LDKRouteHint this_ptr_conv;
71311         this_ptr_conv.inner = untag_ptr(this_ptr);
71312         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71314         this_ptr_conv.is_owned = false;
71315         LDKCVec_RouteHintHopZ val_constr;
71316         val_constr.datalen = (*env)->GetArrayLength(env, val);
71317         if (val_constr.datalen > 0)
71318                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
71319         else
71320                 val_constr.data = NULL;
71321         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
71322         for (size_t o = 0; o < val_constr.datalen; o++) {
71323                 int64_t val_conv_14 = val_vals[o];
71324                 LDKRouteHintHop val_conv_14_conv;
71325                 val_conv_14_conv.inner = untag_ptr(val_conv_14);
71326                 val_conv_14_conv.is_owned = ptr_is_owned(val_conv_14);
71327                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
71328                 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
71329                 val_constr.data[o] = val_conv_14_conv;
71330         }
71331         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
71332         RouteHint_set_a(&this_ptr_conv, val_constr);
71333 }
71334
71335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1new(JNIEnv *env, jclass clz, int64_tArray a_arg) {
71336         LDKCVec_RouteHintHopZ a_arg_constr;
71337         a_arg_constr.datalen = (*env)->GetArrayLength(env, a_arg);
71338         if (a_arg_constr.datalen > 0)
71339                 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
71340         else
71341                 a_arg_constr.data = NULL;
71342         int64_t* a_arg_vals = (*env)->GetLongArrayElements (env, a_arg, NULL);
71343         for (size_t o = 0; o < a_arg_constr.datalen; o++) {
71344                 int64_t a_arg_conv_14 = a_arg_vals[o];
71345                 LDKRouteHintHop a_arg_conv_14_conv;
71346                 a_arg_conv_14_conv.inner = untag_ptr(a_arg_conv_14);
71347                 a_arg_conv_14_conv.is_owned = ptr_is_owned(a_arg_conv_14);
71348                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
71349                 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
71350                 a_arg_constr.data[o] = a_arg_conv_14_conv;
71351         }
71352         (*env)->ReleaseLongArrayElements(env, a_arg, a_arg_vals, 0);
71353         LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
71354         int64_t ret_ref = 0;
71355         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71356         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71357         return ret_ref;
71358 }
71359
71360 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
71361         LDKRouteHint ret_var = RouteHint_clone(arg);
71362         int64_t ret_ref = 0;
71363         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71364         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71365         return ret_ref;
71366 }
71367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71368         LDKRouteHint arg_conv;
71369         arg_conv.inner = untag_ptr(arg);
71370         arg_conv.is_owned = ptr_is_owned(arg);
71371         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71372         arg_conv.is_owned = false;
71373         int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
71374         return ret_conv;
71375 }
71376
71377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71378         LDKRouteHint orig_conv;
71379         orig_conv.inner = untag_ptr(orig);
71380         orig_conv.is_owned = ptr_is_owned(orig);
71381         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71382         orig_conv.is_owned = false;
71383         LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
71384         int64_t ret_ref = 0;
71385         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71386         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71387         return ret_ref;
71388 }
71389
71390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1hash(JNIEnv *env, jclass clz, int64_t o) {
71391         LDKRouteHint o_conv;
71392         o_conv.inner = untag_ptr(o);
71393         o_conv.is_owned = ptr_is_owned(o);
71394         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
71395         o_conv.is_owned = false;
71396         int64_t ret_conv = RouteHint_hash(&o_conv);
71397         return ret_conv;
71398 }
71399
71400 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
71401         LDKRouteHint a_conv;
71402         a_conv.inner = untag_ptr(a);
71403         a_conv.is_owned = ptr_is_owned(a);
71404         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
71405         a_conv.is_owned = false;
71406         LDKRouteHint b_conv;
71407         b_conv.inner = untag_ptr(b);
71408         b_conv.is_owned = ptr_is_owned(b);
71409         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
71410         b_conv.is_owned = false;
71411         jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
71412         return ret_conv;
71413 }
71414
71415 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1write(JNIEnv *env, jclass clz, int64_t obj) {
71416         LDKRouteHint obj_conv;
71417         obj_conv.inner = untag_ptr(obj);
71418         obj_conv.is_owned = ptr_is_owned(obj);
71419         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71420         obj_conv.is_owned = false;
71421         LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
71422         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
71423         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
71424         CVec_u8Z_free(ret_var);
71425         return ret_arr;
71426 }
71427
71428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
71429         LDKu8slice ser_ref;
71430         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
71431         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
71432         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
71433         *ret_conv = RouteHint_read(ser_ref);
71434         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
71435         return tag_ptr(ret_conv, true);
71436 }
71437
71438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
71439         LDKRouteHintHop this_obj_conv;
71440         this_obj_conv.inner = untag_ptr(this_obj);
71441         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71443         RouteHintHop_free(this_obj_conv);
71444 }
71445
71446 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
71447         LDKRouteHintHop this_ptr_conv;
71448         this_ptr_conv.inner = untag_ptr(this_ptr);
71449         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71451         this_ptr_conv.is_owned = false;
71452         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
71453         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form);
71454         return ret_arr;
71455 }
71456
71457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
71458         LDKRouteHintHop this_ptr_conv;
71459         this_ptr_conv.inner = untag_ptr(this_ptr);
71460         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71462         this_ptr_conv.is_owned = false;
71463         LDKPublicKey val_ref;
71464         CHECK((*env)->GetArrayLength(env, val) == 33);
71465         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
71466         RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
71467 }
71468
71469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
71470         LDKRouteHintHop this_ptr_conv;
71471         this_ptr_conv.inner = untag_ptr(this_ptr);
71472         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71474         this_ptr_conv.is_owned = false;
71475         int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
71476         return ret_conv;
71477 }
71478
71479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
71480         LDKRouteHintHop this_ptr_conv;
71481         this_ptr_conv.inner = untag_ptr(this_ptr);
71482         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71484         this_ptr_conv.is_owned = false;
71485         RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
71486 }
71487
71488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
71489         LDKRouteHintHop this_ptr_conv;
71490         this_ptr_conv.inner = untag_ptr(this_ptr);
71491         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71493         this_ptr_conv.is_owned = false;
71494         LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
71495         int64_t ret_ref = 0;
71496         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71497         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71498         return ret_ref;
71499 }
71500
71501 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
71502         LDKRouteHintHop this_ptr_conv;
71503         this_ptr_conv.inner = untag_ptr(this_ptr);
71504         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71506         this_ptr_conv.is_owned = false;
71507         LDKRoutingFees val_conv;
71508         val_conv.inner = untag_ptr(val);
71509         val_conv.is_owned = ptr_is_owned(val);
71510         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71511         val_conv = RoutingFees_clone(&val_conv);
71512         RouteHintHop_set_fees(&this_ptr_conv, val_conv);
71513 }
71514
71515 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
71516         LDKRouteHintHop this_ptr_conv;
71517         this_ptr_conv.inner = untag_ptr(this_ptr);
71518         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71520         this_ptr_conv.is_owned = false;
71521         int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
71522         return ret_conv;
71523 }
71524
71525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
71526         LDKRouteHintHop this_ptr_conv;
71527         this_ptr_conv.inner = untag_ptr(this_ptr);
71528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71530         this_ptr_conv.is_owned = false;
71531         RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
71532 }
71533
71534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
71535         LDKRouteHintHop this_ptr_conv;
71536         this_ptr_conv.inner = untag_ptr(this_ptr);
71537         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71539         this_ptr_conv.is_owned = false;
71540         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
71541         *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
71542         int64_t ret_ref = tag_ptr(ret_copy, true);
71543         return ret_ref;
71544 }
71545
71546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
71547         LDKRouteHintHop this_ptr_conv;
71548         this_ptr_conv.inner = untag_ptr(this_ptr);
71549         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71551         this_ptr_conv.is_owned = false;
71552         void* val_ptr = untag_ptr(val);
71553         CHECK_ACCESS(val_ptr);
71554         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
71555         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
71556         RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
71557 }
71558
71559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
71560         LDKRouteHintHop this_ptr_conv;
71561         this_ptr_conv.inner = untag_ptr(this_ptr);
71562         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71564         this_ptr_conv.is_owned = false;
71565         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
71566         *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
71567         int64_t ret_ref = tag_ptr(ret_copy, true);
71568         return ret_ref;
71569 }
71570
71571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
71572         LDKRouteHintHop this_ptr_conv;
71573         this_ptr_conv.inner = untag_ptr(this_ptr);
71574         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71576         this_ptr_conv.is_owned = false;
71577         void* val_ptr = untag_ptr(val);
71578         CHECK_ACCESS(val_ptr);
71579         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
71580         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
71581         RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
71582 }
71583
71584 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) {
71585         LDKPublicKey src_node_id_arg_ref;
71586         CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
71587         (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
71588         LDKRoutingFees fees_arg_conv;
71589         fees_arg_conv.inner = untag_ptr(fees_arg);
71590         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
71591         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
71592         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
71593         void* htlc_minimum_msat_arg_ptr = untag_ptr(htlc_minimum_msat_arg);
71594         CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
71595         LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
71596         htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_minimum_msat_arg));
71597         void* htlc_maximum_msat_arg_ptr = untag_ptr(htlc_maximum_msat_arg);
71598         CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
71599         LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
71600         htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat_arg));
71601         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);
71602         int64_t ret_ref = 0;
71603         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71604         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71605         return ret_ref;
71606 }
71607
71608 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
71609         LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
71610         int64_t ret_ref = 0;
71611         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71612         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71613         return ret_ref;
71614 }
71615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71616         LDKRouteHintHop arg_conv;
71617         arg_conv.inner = untag_ptr(arg);
71618         arg_conv.is_owned = ptr_is_owned(arg);
71619         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71620         arg_conv.is_owned = false;
71621         int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
71622         return ret_conv;
71623 }
71624
71625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71626         LDKRouteHintHop orig_conv;
71627         orig_conv.inner = untag_ptr(orig);
71628         orig_conv.is_owned = ptr_is_owned(orig);
71629         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71630         orig_conv.is_owned = false;
71631         LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
71632         int64_t ret_ref = 0;
71633         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71634         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71635         return ret_ref;
71636 }
71637
71638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
71639         LDKRouteHintHop o_conv;
71640         o_conv.inner = untag_ptr(o);
71641         o_conv.is_owned = ptr_is_owned(o);
71642         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
71643         o_conv.is_owned = false;
71644         int64_t ret_conv = RouteHintHop_hash(&o_conv);
71645         return ret_conv;
71646 }
71647
71648 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
71649         LDKRouteHintHop a_conv;
71650         a_conv.inner = untag_ptr(a);
71651         a_conv.is_owned = ptr_is_owned(a);
71652         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
71653         a_conv.is_owned = false;
71654         LDKRouteHintHop b_conv;
71655         b_conv.inner = untag_ptr(b);
71656         b_conv.is_owned = ptr_is_owned(b);
71657         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
71658         b_conv.is_owned = false;
71659         jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
71660         return ret_conv;
71661 }
71662
71663 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
71664         LDKRouteHintHop obj_conv;
71665         obj_conv.inner = untag_ptr(obj);
71666         obj_conv.is_owned = ptr_is_owned(obj);
71667         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71668         obj_conv.is_owned = false;
71669         LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
71670         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
71671         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
71672         CVec_u8Z_free(ret_var);
71673         return ret_arr;
71674 }
71675
71676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
71677         LDKu8slice ser_ref;
71678         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
71679         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
71680         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
71681         *ret_conv = RouteHintHop_read(ser_ref);
71682         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
71683         return tag_ptr(ret_conv, true);
71684 }
71685
71686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FirstHopCandidate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
71687         LDKFirstHopCandidate this_obj_conv;
71688         this_obj_conv.inner = untag_ptr(this_obj);
71689         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71691         FirstHopCandidate_free(this_obj_conv);
71692 }
71693
71694 static inline uint64_t FirstHopCandidate_clone_ptr(LDKFirstHopCandidate *NONNULL_PTR arg) {
71695         LDKFirstHopCandidate ret_var = FirstHopCandidate_clone(arg);
71696         int64_t ret_ref = 0;
71697         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71698         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71699         return ret_ref;
71700 }
71701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FirstHopCandidate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71702         LDKFirstHopCandidate arg_conv;
71703         arg_conv.inner = untag_ptr(arg);
71704         arg_conv.is_owned = ptr_is_owned(arg);
71705         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71706         arg_conv.is_owned = false;
71707         int64_t ret_conv = FirstHopCandidate_clone_ptr(&arg_conv);
71708         return ret_conv;
71709 }
71710
71711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FirstHopCandidate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71712         LDKFirstHopCandidate orig_conv;
71713         orig_conv.inner = untag_ptr(orig);
71714         orig_conv.is_owned = ptr_is_owned(orig);
71715         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71716         orig_conv.is_owned = false;
71717         LDKFirstHopCandidate ret_var = FirstHopCandidate_clone(&orig_conv);
71718         int64_t ret_ref = 0;
71719         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71720         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71721         return ret_ref;
71722 }
71723
71724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PublicHopCandidate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
71725         LDKPublicHopCandidate this_obj_conv;
71726         this_obj_conv.inner = untag_ptr(this_obj);
71727         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71729         PublicHopCandidate_free(this_obj_conv);
71730 }
71731
71732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PublicHopCandidate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
71733         LDKPublicHopCandidate this_ptr_conv;
71734         this_ptr_conv.inner = untag_ptr(this_ptr);
71735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71737         this_ptr_conv.is_owned = false;
71738         int64_t ret_conv = PublicHopCandidate_get_short_channel_id(&this_ptr_conv);
71739         return ret_conv;
71740 }
71741
71742 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PublicHopCandidate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
71743         LDKPublicHopCandidate this_ptr_conv;
71744         this_ptr_conv.inner = untag_ptr(this_ptr);
71745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71747         this_ptr_conv.is_owned = false;
71748         PublicHopCandidate_set_short_channel_id(&this_ptr_conv, val);
71749 }
71750
71751 static inline uint64_t PublicHopCandidate_clone_ptr(LDKPublicHopCandidate *NONNULL_PTR arg) {
71752         LDKPublicHopCandidate ret_var = PublicHopCandidate_clone(arg);
71753         int64_t ret_ref = 0;
71754         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71755         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71756         return ret_ref;
71757 }
71758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PublicHopCandidate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71759         LDKPublicHopCandidate arg_conv;
71760         arg_conv.inner = untag_ptr(arg);
71761         arg_conv.is_owned = ptr_is_owned(arg);
71762         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71763         arg_conv.is_owned = false;
71764         int64_t ret_conv = PublicHopCandidate_clone_ptr(&arg_conv);
71765         return ret_conv;
71766 }
71767
71768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PublicHopCandidate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71769         LDKPublicHopCandidate orig_conv;
71770         orig_conv.inner = untag_ptr(orig);
71771         orig_conv.is_owned = ptr_is_owned(orig);
71772         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71773         orig_conv.is_owned = false;
71774         LDKPublicHopCandidate ret_var = PublicHopCandidate_clone(&orig_conv);
71775         int64_t ret_ref = 0;
71776         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71777         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71778         return ret_ref;
71779 }
71780
71781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateHopCandidate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
71782         LDKPrivateHopCandidate this_obj_conv;
71783         this_obj_conv.inner = untag_ptr(this_obj);
71784         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71786         PrivateHopCandidate_free(this_obj_conv);
71787 }
71788
71789 static inline uint64_t PrivateHopCandidate_clone_ptr(LDKPrivateHopCandidate *NONNULL_PTR arg) {
71790         LDKPrivateHopCandidate ret_var = PrivateHopCandidate_clone(arg);
71791         int64_t ret_ref = 0;
71792         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71793         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71794         return ret_ref;
71795 }
71796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateHopCandidate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71797         LDKPrivateHopCandidate arg_conv;
71798         arg_conv.inner = untag_ptr(arg);
71799         arg_conv.is_owned = ptr_is_owned(arg);
71800         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71801         arg_conv.is_owned = false;
71802         int64_t ret_conv = PrivateHopCandidate_clone_ptr(&arg_conv);
71803         return ret_conv;
71804 }
71805
71806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateHopCandidate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71807         LDKPrivateHopCandidate orig_conv;
71808         orig_conv.inner = untag_ptr(orig);
71809         orig_conv.is_owned = ptr_is_owned(orig);
71810         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71811         orig_conv.is_owned = false;
71812         LDKPrivateHopCandidate ret_var = PrivateHopCandidate_clone(&orig_conv);
71813         int64_t ret_ref = 0;
71814         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71815         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71816         return ret_ref;
71817 }
71818
71819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPathCandidate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
71820         LDKBlindedPathCandidate this_obj_conv;
71821         this_obj_conv.inner = untag_ptr(this_obj);
71822         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71824         BlindedPathCandidate_free(this_obj_conv);
71825 }
71826
71827 static inline uint64_t BlindedPathCandidate_clone_ptr(LDKBlindedPathCandidate *NONNULL_PTR arg) {
71828         LDKBlindedPathCandidate ret_var = BlindedPathCandidate_clone(arg);
71829         int64_t ret_ref = 0;
71830         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71831         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71832         return ret_ref;
71833 }
71834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPathCandidate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71835         LDKBlindedPathCandidate arg_conv;
71836         arg_conv.inner = untag_ptr(arg);
71837         arg_conv.is_owned = ptr_is_owned(arg);
71838         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71839         arg_conv.is_owned = false;
71840         int64_t ret_conv = BlindedPathCandidate_clone_ptr(&arg_conv);
71841         return ret_conv;
71842 }
71843
71844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPathCandidate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71845         LDKBlindedPathCandidate orig_conv;
71846         orig_conv.inner = untag_ptr(orig);
71847         orig_conv.is_owned = ptr_is_owned(orig);
71848         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71849         orig_conv.is_owned = false;
71850         LDKBlindedPathCandidate ret_var = BlindedPathCandidate_clone(&orig_conv);
71851         int64_t ret_ref = 0;
71852         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71853         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71854         return ret_ref;
71855 }
71856
71857 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OneHopBlindedPathCandidate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
71858         LDKOneHopBlindedPathCandidate this_obj_conv;
71859         this_obj_conv.inner = untag_ptr(this_obj);
71860         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71862         OneHopBlindedPathCandidate_free(this_obj_conv);
71863 }
71864
71865 static inline uint64_t OneHopBlindedPathCandidate_clone_ptr(LDKOneHopBlindedPathCandidate *NONNULL_PTR arg) {
71866         LDKOneHopBlindedPathCandidate ret_var = OneHopBlindedPathCandidate_clone(arg);
71867         int64_t ret_ref = 0;
71868         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71869         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71870         return ret_ref;
71871 }
71872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OneHopBlindedPathCandidate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71873         LDKOneHopBlindedPathCandidate arg_conv;
71874         arg_conv.inner = untag_ptr(arg);
71875         arg_conv.is_owned = ptr_is_owned(arg);
71876         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71877         arg_conv.is_owned = false;
71878         int64_t ret_conv = OneHopBlindedPathCandidate_clone_ptr(&arg_conv);
71879         return ret_conv;
71880 }
71881
71882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OneHopBlindedPathCandidate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71883         LDKOneHopBlindedPathCandidate orig_conv;
71884         orig_conv.inner = untag_ptr(orig);
71885         orig_conv.is_owned = ptr_is_owned(orig);
71886         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71887         orig_conv.is_owned = false;
71888         LDKOneHopBlindedPathCandidate ret_var = OneHopBlindedPathCandidate_clone(&orig_conv);
71889         int64_t ret_ref = 0;
71890         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71891         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71892         return ret_ref;
71893 }
71894
71895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
71896         if (!ptr_is_owned(this_ptr)) return;
71897         void* this_ptr_ptr = untag_ptr(this_ptr);
71898         CHECK_ACCESS(this_ptr_ptr);
71899         LDKCandidateRouteHop this_ptr_conv = *(LDKCandidateRouteHop*)(this_ptr_ptr);
71900         FREE(untag_ptr(this_ptr));
71901         CandidateRouteHop_free(this_ptr_conv);
71902 }
71903
71904 static inline uint64_t CandidateRouteHop_clone_ptr(LDKCandidateRouteHop *NONNULL_PTR arg) {
71905         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
71906         *ret_copy = CandidateRouteHop_clone(arg);
71907         int64_t ret_ref = tag_ptr(ret_copy, true);
71908         return ret_ref;
71909 }
71910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71911         LDKCandidateRouteHop* arg_conv = (LDKCandidateRouteHop*)untag_ptr(arg);
71912         int64_t ret_conv = CandidateRouteHop_clone_ptr(arg_conv);
71913         return ret_conv;
71914 }
71915
71916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71917         LDKCandidateRouteHop* orig_conv = (LDKCandidateRouteHop*)untag_ptr(orig);
71918         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
71919         *ret_copy = CandidateRouteHop_clone(orig_conv);
71920         int64_t ret_ref = tag_ptr(ret_copy, true);
71921         return ret_ref;
71922 }
71923
71924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1first_1hop(JNIEnv *env, jclass clz, int64_t a) {
71925         LDKFirstHopCandidate a_conv;
71926         a_conv.inner = untag_ptr(a);
71927         a_conv.is_owned = ptr_is_owned(a);
71928         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
71929         a_conv = FirstHopCandidate_clone(&a_conv);
71930         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
71931         *ret_copy = CandidateRouteHop_first_hop(a_conv);
71932         int64_t ret_ref = tag_ptr(ret_copy, true);
71933         return ret_ref;
71934 }
71935
71936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1public_1hop(JNIEnv *env, jclass clz, int64_t a) {
71937         LDKPublicHopCandidate a_conv;
71938         a_conv.inner = untag_ptr(a);
71939         a_conv.is_owned = ptr_is_owned(a);
71940         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
71941         a_conv = PublicHopCandidate_clone(&a_conv);
71942         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
71943         *ret_copy = CandidateRouteHop_public_hop(a_conv);
71944         int64_t ret_ref = tag_ptr(ret_copy, true);
71945         return ret_ref;
71946 }
71947
71948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1private_1hop(JNIEnv *env, jclass clz, int64_t a) {
71949         LDKPrivateHopCandidate a_conv;
71950         a_conv.inner = untag_ptr(a);
71951         a_conv.is_owned = ptr_is_owned(a);
71952         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
71953         a_conv = PrivateHopCandidate_clone(&a_conv);
71954         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
71955         *ret_copy = CandidateRouteHop_private_hop(a_conv);
71956         int64_t ret_ref = tag_ptr(ret_copy, true);
71957         return ret_ref;
71958 }
71959
71960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1blinded(JNIEnv *env, jclass clz, int64_t a) {
71961         LDKBlindedPathCandidate a_conv;
71962         a_conv.inner = untag_ptr(a);
71963         a_conv.is_owned = ptr_is_owned(a);
71964         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
71965         a_conv = BlindedPathCandidate_clone(&a_conv);
71966         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
71967         *ret_copy = CandidateRouteHop_blinded(a_conv);
71968         int64_t ret_ref = tag_ptr(ret_copy, true);
71969         return ret_ref;
71970 }
71971
71972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1one_1hop_1blinded(JNIEnv *env, jclass clz, int64_t a) {
71973         LDKOneHopBlindedPathCandidate a_conv;
71974         a_conv.inner = untag_ptr(a);
71975         a_conv.is_owned = ptr_is_owned(a);
71976         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
71977         a_conv = OneHopBlindedPathCandidate_clone(&a_conv);
71978         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
71979         *ret_copy = CandidateRouteHop_one_hop_blinded(a_conv);
71980         int64_t ret_ref = tag_ptr(ret_copy, true);
71981         return ret_ref;
71982 }
71983
71984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1globally_1unique_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
71985         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
71986         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
71987         *ret_copy = CandidateRouteHop_globally_unique_short_channel_id(this_arg_conv);
71988         int64_t ret_ref = tag_ptr(ret_copy, true);
71989         return ret_ref;
71990 }
71991
71992 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_arg) {
71993         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
71994         int32_t ret_conv = CandidateRouteHop_cltv_expiry_delta(this_arg_conv);
71995         return ret_conv;
71996 }
71997
71998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
71999         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
72000         int64_t ret_conv = CandidateRouteHop_htlc_minimum_msat(this_arg_conv);
72001         return ret_conv;
72002 }
72003
72004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1fees(JNIEnv *env, jclass clz, int64_t this_arg) {
72005         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
72006         LDKRoutingFees ret_var = CandidateRouteHop_fees(this_arg_conv);
72007         int64_t ret_ref = 0;
72008         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72009         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72010         return ret_ref;
72011 }
72012
72013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1source(JNIEnv *env, jclass clz, int64_t this_arg) {
72014         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
72015         LDKNodeId ret_var = CandidateRouteHop_source(this_arg_conv);
72016         int64_t ret_ref = 0;
72017         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72018         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72019         return ret_ref;
72020 }
72021
72022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1target(JNIEnv *env, jclass clz, int64_t this_arg) {
72023         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
72024         LDKNodeId ret_var = CandidateRouteHop_target(this_arg_conv);
72025         int64_t ret_ref = 0;
72026         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72027         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72028         return ret_ref;
72029 }
72030
72031 JNIEXPORT 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) {
72032         LDKPublicKey our_node_pubkey_ref;
72033         CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
72034         (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
72035         LDKRouteParameters route_params_conv;
72036         route_params_conv.inner = untag_ptr(route_params);
72037         route_params_conv.is_owned = ptr_is_owned(route_params);
72038         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
72039         route_params_conv.is_owned = false;
72040         LDKNetworkGraph network_graph_conv;
72041         network_graph_conv.inner = untag_ptr(network_graph);
72042         network_graph_conv.is_owned = ptr_is_owned(network_graph);
72043         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
72044         network_graph_conv.is_owned = false;
72045         LDKCVec_ChannelDetailsZ first_hops_constr;
72046         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
72047         if (first_hops != NULL) {
72048                 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
72049                 if (first_hops_constr.datalen > 0)
72050                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
72051                 else
72052                         first_hops_constr.data = NULL;
72053                 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
72054                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
72055                         int64_t first_hops_conv_16 = first_hops_vals[q];
72056                         LDKChannelDetails first_hops_conv_16_conv;
72057                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
72058                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
72059                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
72060                         first_hops_conv_16_conv.is_owned = false;
72061                         first_hops_constr.data[q] = first_hops_conv_16_conv;
72062                 }
72063                 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
72064                 first_hops_ptr = &first_hops_constr;
72065         }
72066         void* logger_ptr = untag_ptr(logger);
72067         CHECK_ACCESS(logger_ptr);
72068         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
72069         if (logger_conv.free == LDKLogger_JCalls_free) {
72070                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
72071                 LDKLogger_JCalls_cloned(&logger_conv);
72072         }
72073         void* scorer_ptr = untag_ptr(scorer);
72074         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
72075         LDKScoreLookUp* scorer_conv = (LDKScoreLookUp*)scorer_ptr;
72076         LDKProbabilisticScoringFeeParameters score_params_conv;
72077         score_params_conv.inner = untag_ptr(score_params);
72078         score_params_conv.is_owned = ptr_is_owned(score_params);
72079         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
72080         score_params_conv.is_owned = false;
72081         uint8_t random_seed_bytes_arr[32];
72082         CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
72083         (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr);
72084         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
72085         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
72086         *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);
72087         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
72088         return tag_ptr(ret_conv, true);
72089 }
72090
72091 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) {
72092         LDKPublicKey our_node_pubkey_ref;
72093         CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
72094         (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
72095         LDKCVec_PublicKeyZ hops_constr;
72096         hops_constr.datalen = (*env)->GetArrayLength(env, hops);
72097         if (hops_constr.datalen > 0)
72098                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
72099         else
72100                 hops_constr.data = NULL;
72101         for (size_t i = 0; i < hops_constr.datalen; i++) {
72102                 int8_tArray hops_conv_8 = (*env)->GetObjectArrayElement(env, hops, i);
72103                 LDKPublicKey hops_conv_8_ref;
72104                 CHECK((*env)->GetArrayLength(env, hops_conv_8) == 33);
72105                 (*env)->GetByteArrayRegion(env, hops_conv_8, 0, 33, hops_conv_8_ref.compressed_form);
72106                 hops_constr.data[i] = hops_conv_8_ref;
72107         }
72108         LDKRouteParameters route_params_conv;
72109         route_params_conv.inner = untag_ptr(route_params);
72110         route_params_conv.is_owned = ptr_is_owned(route_params);
72111         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
72112         route_params_conv.is_owned = false;
72113         LDKNetworkGraph network_graph_conv;
72114         network_graph_conv.inner = untag_ptr(network_graph);
72115         network_graph_conv.is_owned = ptr_is_owned(network_graph);
72116         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
72117         network_graph_conv.is_owned = false;
72118         void* logger_ptr = untag_ptr(logger);
72119         CHECK_ACCESS(logger_ptr);
72120         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
72121         if (logger_conv.free == LDKLogger_JCalls_free) {
72122                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
72123                 LDKLogger_JCalls_cloned(&logger_conv);
72124         }
72125         uint8_t random_seed_bytes_arr[32];
72126         CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
72127         (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr);
72128         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
72129         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
72130         *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
72131         return tag_ptr(ret_conv, true);
72132 }
72133
72134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoreLookUp_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
72135         if (!ptr_is_owned(this_ptr)) return;
72136         void* this_ptr_ptr = untag_ptr(this_ptr);
72137         CHECK_ACCESS(this_ptr_ptr);
72138         LDKScoreLookUp this_ptr_conv = *(LDKScoreLookUp*)(this_ptr_ptr);
72139         FREE(untag_ptr(this_ptr));
72140         ScoreLookUp_free(this_ptr_conv);
72141 }
72142
72143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoreUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
72144         if (!ptr_is_owned(this_ptr)) return;
72145         void* this_ptr_ptr = untag_ptr(this_ptr);
72146         CHECK_ACCESS(this_ptr_ptr);
72147         LDKScoreUpdate this_ptr_conv = *(LDKScoreUpdate*)(this_ptr_ptr);
72148         FREE(untag_ptr(this_ptr));
72149         ScoreUpdate_free(this_ptr_conv);
72150 }
72151
72152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
72153         if (!ptr_is_owned(this_ptr)) return;
72154         void* this_ptr_ptr = untag_ptr(this_ptr);
72155         CHECK_ACCESS(this_ptr_ptr);
72156         LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
72157         FREE(untag_ptr(this_ptr));
72158         Score_free(this_ptr_conv);
72159 }
72160
72161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockableScore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
72162         if (!ptr_is_owned(this_ptr)) return;
72163         void* this_ptr_ptr = untag_ptr(this_ptr);
72164         CHECK_ACCESS(this_ptr_ptr);
72165         LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
72166         FREE(untag_ptr(this_ptr));
72167         LockableScore_free(this_ptr_conv);
72168 }
72169
72170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WriteableScore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
72171         if (!ptr_is_owned(this_ptr)) return;
72172         void* this_ptr_ptr = untag_ptr(this_ptr);
72173         CHECK_ACCESS(this_ptr_ptr);
72174         LDKWriteableScore this_ptr_conv = *(LDKWriteableScore*)(this_ptr_ptr);
72175         FREE(untag_ptr(this_ptr));
72176         WriteableScore_free(this_ptr_conv);
72177 }
72178
72179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72180         LDKMultiThreadedLockableScore this_obj_conv;
72181         this_obj_conv.inner = untag_ptr(this_obj);
72182         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72184         MultiThreadedLockableScore_free(this_obj_conv);
72185 }
72186
72187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1as_1LockableScore(JNIEnv *env, jclass clz, int64_t this_arg) {
72188         LDKMultiThreadedLockableScore this_arg_conv;
72189         this_arg_conv.inner = untag_ptr(this_arg);
72190         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72192         this_arg_conv.is_owned = false;
72193         LDKLockableScore* ret_ret = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
72194         *ret_ret = MultiThreadedLockableScore_as_LockableScore(&this_arg_conv);
72195         return tag_ptr(ret_ret, true);
72196 }
72197
72198 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1write(JNIEnv *env, jclass clz, int64_t obj) {
72199         LDKMultiThreadedLockableScore obj_conv;
72200         obj_conv.inner = untag_ptr(obj);
72201         obj_conv.is_owned = ptr_is_owned(obj);
72202         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
72203         obj_conv.is_owned = false;
72204         LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
72205         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
72206         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
72207         CVec_u8Z_free(ret_var);
72208         return ret_arr;
72209 }
72210
72211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1as_1WriteableScore(JNIEnv *env, jclass clz, int64_t this_arg) {
72212         LDKMultiThreadedLockableScore this_arg_conv;
72213         this_arg_conv.inner = untag_ptr(this_arg);
72214         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72216         this_arg_conv.is_owned = false;
72217         LDKWriteableScore* ret_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
72218         *ret_ret = MultiThreadedLockableScore_as_WriteableScore(&this_arg_conv);
72219         return tag_ptr(ret_ret, true);
72220 }
72221
72222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1new(JNIEnv *env, jclass clz, int64_t score) {
72223         void* score_ptr = untag_ptr(score);
72224         CHECK_ACCESS(score_ptr);
72225         LDKScore score_conv = *(LDKScore*)(score_ptr);
72226         if (score_conv.free == LDKScore_JCalls_free) {
72227                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
72228                 LDKScore_JCalls_cloned(&score_conv);
72229         }
72230         LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
72231         int64_t ret_ref = 0;
72232         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72233         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72234         return ret_ref;
72235 }
72236
72237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLockRead_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72238         LDKMultiThreadedScoreLockRead this_obj_conv;
72239         this_obj_conv.inner = untag_ptr(this_obj);
72240         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72242         MultiThreadedScoreLockRead_free(this_obj_conv);
72243 }
72244
72245 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLockWrite_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72246         LDKMultiThreadedScoreLockWrite this_obj_conv;
72247         this_obj_conv.inner = untag_ptr(this_obj);
72248         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72250         MultiThreadedScoreLockWrite_free(this_obj_conv);
72251 }
72252
72253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLockRead_1as_1ScoreLookUp(JNIEnv *env, jclass clz, int64_t this_arg) {
72254         LDKMultiThreadedScoreLockRead this_arg_conv;
72255         this_arg_conv.inner = untag_ptr(this_arg);
72256         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72258         this_arg_conv.is_owned = false;
72259         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
72260         *ret_ret = MultiThreadedScoreLockRead_as_ScoreLookUp(&this_arg_conv);
72261         return tag_ptr(ret_ret, true);
72262 }
72263
72264 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLockWrite_1write(JNIEnv *env, jclass clz, int64_t obj) {
72265         LDKMultiThreadedScoreLockWrite obj_conv;
72266         obj_conv.inner = untag_ptr(obj);
72267         obj_conv.is_owned = ptr_is_owned(obj);
72268         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
72269         obj_conv.is_owned = false;
72270         LDKCVec_u8Z ret_var = MultiThreadedScoreLockWrite_write(&obj_conv);
72271         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
72272         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
72273         CVec_u8Z_free(ret_var);
72274         return ret_arr;
72275 }
72276
72277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLockWrite_1as_1ScoreUpdate(JNIEnv *env, jclass clz, int64_t this_arg) {
72278         LDKMultiThreadedScoreLockWrite this_arg_conv;
72279         this_arg_conv.inner = untag_ptr(this_arg);
72280         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72282         this_arg_conv.is_owned = false;
72283         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
72284         *ret_ret = MultiThreadedScoreLockWrite_as_ScoreUpdate(&this_arg_conv);
72285         return tag_ptr(ret_ret, true);
72286 }
72287
72288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72289         LDKChannelUsage this_obj_conv;
72290         this_obj_conv.inner = untag_ptr(this_obj);
72291         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72293         ChannelUsage_free(this_obj_conv);
72294 }
72295
72296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
72297         LDKChannelUsage this_ptr_conv;
72298         this_ptr_conv.inner = untag_ptr(this_ptr);
72299         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72301         this_ptr_conv.is_owned = false;
72302         int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
72303         return ret_conv;
72304 }
72305
72306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72307         LDKChannelUsage this_ptr_conv;
72308         this_ptr_conv.inner = untag_ptr(this_ptr);
72309         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72311         this_ptr_conv.is_owned = false;
72312         ChannelUsage_set_amount_msat(&this_ptr_conv, val);
72313 }
72314
72315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1inflight_1htlc_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
72316         LDKChannelUsage this_ptr_conv;
72317         this_ptr_conv.inner = untag_ptr(this_ptr);
72318         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72320         this_ptr_conv.is_owned = false;
72321         int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
72322         return ret_conv;
72323 }
72324
72325 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1inflight_1htlc_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72326         LDKChannelUsage this_ptr_conv;
72327         this_ptr_conv.inner = untag_ptr(this_ptr);
72328         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72330         this_ptr_conv.is_owned = false;
72331         ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
72332 }
72333
72334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_ptr) {
72335         LDKChannelUsage this_ptr_conv;
72336         this_ptr_conv.inner = untag_ptr(this_ptr);
72337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72339         this_ptr_conv.is_owned = false;
72340         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
72341         *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
72342         int64_t ret_ref = tag_ptr(ret_copy, true);
72343         return ret_ref;
72344 }
72345
72346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72347         LDKChannelUsage this_ptr_conv;
72348         this_ptr_conv.inner = untag_ptr(this_ptr);
72349         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72351         this_ptr_conv.is_owned = false;
72352         void* val_ptr = untag_ptr(val);
72353         CHECK_ACCESS(val_ptr);
72354         LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
72355         val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(val));
72356         ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
72357 }
72358
72359 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) {
72360         void* effective_capacity_arg_ptr = untag_ptr(effective_capacity_arg);
72361         CHECK_ACCESS(effective_capacity_arg_ptr);
72362         LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
72363         effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(effective_capacity_arg));
72364         LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
72365         int64_t ret_ref = 0;
72366         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72367         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72368         return ret_ref;
72369 }
72370
72371 static inline uint64_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
72372         LDKChannelUsage ret_var = ChannelUsage_clone(arg);
72373         int64_t ret_ref = 0;
72374         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72375         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72376         return ret_ref;
72377 }
72378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
72379         LDKChannelUsage arg_conv;
72380         arg_conv.inner = untag_ptr(arg);
72381         arg_conv.is_owned = ptr_is_owned(arg);
72382         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72383         arg_conv.is_owned = false;
72384         int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
72385         return ret_conv;
72386 }
72387
72388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
72389         LDKChannelUsage orig_conv;
72390         orig_conv.inner = untag_ptr(orig);
72391         orig_conv.is_owned = ptr_is_owned(orig);
72392         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72393         orig_conv.is_owned = false;
72394         LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
72395         int64_t ret_ref = 0;
72396         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72397         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72398         return ret_ref;
72399 }
72400
72401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72402         LDKFixedPenaltyScorer this_obj_conv;
72403         this_obj_conv.inner = untag_ptr(this_obj);
72404         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72406         FixedPenaltyScorer_free(this_obj_conv);
72407 }
72408
72409 static inline uint64_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
72410         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
72411         int64_t ret_ref = 0;
72412         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72413         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72414         return ret_ref;
72415 }
72416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
72417         LDKFixedPenaltyScorer arg_conv;
72418         arg_conv.inner = untag_ptr(arg);
72419         arg_conv.is_owned = ptr_is_owned(arg);
72420         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72421         arg_conv.is_owned = false;
72422         int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
72423         return ret_conv;
72424 }
72425
72426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone(JNIEnv *env, jclass clz, int64_t orig) {
72427         LDKFixedPenaltyScorer orig_conv;
72428         orig_conv.inner = untag_ptr(orig);
72429         orig_conv.is_owned = ptr_is_owned(orig);
72430         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72431         orig_conv.is_owned = false;
72432         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
72433         int64_t ret_ref = 0;
72434         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72435         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72436         return ret_ref;
72437 }
72438
72439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1with_1penalty(JNIEnv *env, jclass clz, int64_t penalty_msat) {
72440         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
72441         int64_t ret_ref = 0;
72442         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72443         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72444         return ret_ref;
72445 }
72446
72447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1as_1ScoreLookUp(JNIEnv *env, jclass clz, int64_t this_arg) {
72448         LDKFixedPenaltyScorer this_arg_conv;
72449         this_arg_conv.inner = untag_ptr(this_arg);
72450         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72452         this_arg_conv.is_owned = false;
72453         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
72454         *ret_ret = FixedPenaltyScorer_as_ScoreLookUp(&this_arg_conv);
72455         return tag_ptr(ret_ret, true);
72456 }
72457
72458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1as_1ScoreUpdate(JNIEnv *env, jclass clz, int64_t this_arg) {
72459         LDKFixedPenaltyScorer this_arg_conv;
72460         this_arg_conv.inner = untag_ptr(this_arg);
72461         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72463         this_arg_conv.is_owned = false;
72464         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
72465         *ret_ret = FixedPenaltyScorer_as_ScoreUpdate(&this_arg_conv);
72466         return tag_ptr(ret_ret, true);
72467 }
72468
72469 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
72470         LDKFixedPenaltyScorer obj_conv;
72471         obj_conv.inner = untag_ptr(obj);
72472         obj_conv.is_owned = ptr_is_owned(obj);
72473         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
72474         obj_conv.is_owned = false;
72475         LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
72476         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
72477         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
72478         CVec_u8Z_free(ret_var);
72479         return ret_arr;
72480 }
72481
72482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
72483         LDKu8slice ser_ref;
72484         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
72485         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
72486         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
72487         *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
72488         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
72489         return tag_ptr(ret_conv, true);
72490 }
72491
72492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72493         LDKProbabilisticScorer this_obj_conv;
72494         this_obj_conv.inner = untag_ptr(this_obj);
72495         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72497         ProbabilisticScorer_free(this_obj_conv);
72498 }
72499
72500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72501         LDKProbabilisticScoringFeeParameters this_obj_conv;
72502         this_obj_conv.inner = untag_ptr(this_obj);
72503         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72505         ProbabilisticScoringFeeParameters_free(this_obj_conv);
72506 }
72507
72508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
72509         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72510         this_ptr_conv.inner = untag_ptr(this_ptr);
72511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72513         this_ptr_conv.is_owned = false;
72514         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_msat(&this_ptr_conv);
72515         return ret_conv;
72516 }
72517
72518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1set_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72519         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72520         this_ptr_conv.inner = untag_ptr(this_ptr);
72521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72523         this_ptr_conv.is_owned = false;
72524         ProbabilisticScoringFeeParameters_set_base_penalty_msat(&this_ptr_conv, val);
72525 }
72526
72527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1base_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
72528         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72529         this_ptr_conv.inner = untag_ptr(this_ptr);
72530         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72532         this_ptr_conv.is_owned = false;
72533         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
72534         return ret_conv;
72535 }
72536
72537 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) {
72538         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72539         this_ptr_conv.inner = untag_ptr(this_ptr);
72540         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72542         this_ptr_conv.is_owned = false;
72543         ProbabilisticScoringFeeParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
72544 }
72545
72546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
72547         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72548         this_ptr_conv.inner = untag_ptr(this_ptr);
72549         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72551         this_ptr_conv.is_owned = false;
72552         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
72553         return ret_conv;
72554 }
72555
72556 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) {
72557         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72558         this_ptr_conv.inner = untag_ptr(this_ptr);
72559         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72561         this_ptr_conv.is_owned = false;
72562         ProbabilisticScoringFeeParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
72563 }
72564
72565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1liquidity_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
72566         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72567         this_ptr_conv.inner = untag_ptr(this_ptr);
72568         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72570         this_ptr_conv.is_owned = false;
72571         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
72572         return ret_conv;
72573 }
72574
72575 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) {
72576         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72577         this_ptr_conv.inner = untag_ptr(this_ptr);
72578         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72580         this_ptr_conv.is_owned = false;
72581         ProbabilisticScoringFeeParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
72582 }
72583
72584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1historical_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
72585         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72586         this_ptr_conv.inner = untag_ptr(this_ptr);
72587         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72589         this_ptr_conv.is_owned = false;
72590         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv);
72591         return ret_conv;
72592 }
72593
72594 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) {
72595         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72596         this_ptr_conv.inner = untag_ptr(this_ptr);
72597         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72599         this_ptr_conv.is_owned = false;
72600         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
72601 }
72602
72603 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) {
72604         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72605         this_ptr_conv.inner = untag_ptr(this_ptr);
72606         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72608         this_ptr_conv.is_owned = false;
72609         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
72610         return ret_conv;
72611 }
72612
72613 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) {
72614         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72615         this_ptr_conv.inner = untag_ptr(this_ptr);
72616         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72618         this_ptr_conv.is_owned = false;
72619         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
72620 }
72621
72622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1anti_1probing_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
72623         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72624         this_ptr_conv.inner = untag_ptr(this_ptr);
72625         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72627         this_ptr_conv.is_owned = false;
72628         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
72629         return ret_conv;
72630 }
72631
72632 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) {
72633         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72634         this_ptr_conv.inner = untag_ptr(this_ptr);
72635         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72637         this_ptr_conv.is_owned = false;
72638         ProbabilisticScoringFeeParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
72639 }
72640
72641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1considered_1impossible_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
72642         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72643         this_ptr_conv.inner = untag_ptr(this_ptr);
72644         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72646         this_ptr_conv.is_owned = false;
72647         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
72648         return ret_conv;
72649 }
72650
72651 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) {
72652         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72653         this_ptr_conv.inner = untag_ptr(this_ptr);
72654         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72656         this_ptr_conv.is_owned = false;
72657         ProbabilisticScoringFeeParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
72658 }
72659
72660 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1linear_1success_1probability(JNIEnv *env, jclass clz, int64_t this_ptr) {
72661         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72662         this_ptr_conv.inner = untag_ptr(this_ptr);
72663         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72665         this_ptr_conv.is_owned = false;
72666         jboolean ret_conv = ProbabilisticScoringFeeParameters_get_linear_success_probability(&this_ptr_conv);
72667         return ret_conv;
72668 }
72669
72670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1set_1linear_1success_1probability(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
72671         LDKProbabilisticScoringFeeParameters 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         ProbabilisticScoringFeeParameters_set_linear_success_probability(&this_ptr_conv, val);
72677 }
72678
72679 static inline uint64_t ProbabilisticScoringFeeParameters_clone_ptr(LDKProbabilisticScoringFeeParameters *NONNULL_PTR arg) {
72680         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(arg);
72681         int64_t ret_ref = 0;
72682         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72683         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72684         return ret_ref;
72685 }
72686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
72687         LDKProbabilisticScoringFeeParameters arg_conv;
72688         arg_conv.inner = untag_ptr(arg);
72689         arg_conv.is_owned = ptr_is_owned(arg);
72690         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72691         arg_conv.is_owned = false;
72692         int64_t ret_conv = ProbabilisticScoringFeeParameters_clone_ptr(&arg_conv);
72693         return ret_conv;
72694 }
72695
72696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
72697         LDKProbabilisticScoringFeeParameters orig_conv;
72698         orig_conv.inner = untag_ptr(orig);
72699         orig_conv.is_owned = ptr_is_owned(orig);
72700         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72701         orig_conv.is_owned = false;
72702         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(&orig_conv);
72703         int64_t ret_ref = 0;
72704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72706         return ret_ref;
72707 }
72708
72709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1default(JNIEnv *env, jclass clz) {
72710         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_default();
72711         int64_t ret_ref = 0;
72712         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72713         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72714         return ret_ref;
72715 }
72716
72717 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1add_1banned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
72718         LDKProbabilisticScoringFeeParameters this_arg_conv;
72719         this_arg_conv.inner = untag_ptr(this_arg);
72720         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72722         this_arg_conv.is_owned = false;
72723         LDKNodeId node_id_conv;
72724         node_id_conv.inner = untag_ptr(node_id);
72725         node_id_conv.is_owned = ptr_is_owned(node_id);
72726         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
72727         node_id_conv.is_owned = false;
72728         ProbabilisticScoringFeeParameters_add_banned(&this_arg_conv, &node_id_conv);
72729 }
72730
72731 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) {
72732         LDKProbabilisticScoringFeeParameters this_arg_conv;
72733         this_arg_conv.inner = untag_ptr(this_arg);
72734         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72736         this_arg_conv.is_owned = false;
72737         LDKCVec_NodeIdZ node_ids_constr;
72738         node_ids_constr.datalen = (*env)->GetArrayLength(env, node_ids);
72739         if (node_ids_constr.datalen > 0)
72740                 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
72741         else
72742                 node_ids_constr.data = NULL;
72743         int64_t* node_ids_vals = (*env)->GetLongArrayElements (env, node_ids, NULL);
72744         for (size_t i = 0; i < node_ids_constr.datalen; i++) {
72745                 int64_t node_ids_conv_8 = node_ids_vals[i];
72746                 LDKNodeId node_ids_conv_8_conv;
72747                 node_ids_conv_8_conv.inner = untag_ptr(node_ids_conv_8);
72748                 node_ids_conv_8_conv.is_owned = ptr_is_owned(node_ids_conv_8);
72749                 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
72750                 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
72751                 node_ids_constr.data[i] = node_ids_conv_8_conv;
72752         }
72753         (*env)->ReleaseLongArrayElements(env, node_ids, node_ids_vals, 0);
72754         ProbabilisticScoringFeeParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
72755 }
72756
72757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1remove_1banned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
72758         LDKProbabilisticScoringFeeParameters this_arg_conv;
72759         this_arg_conv.inner = untag_ptr(this_arg);
72760         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72762         this_arg_conv.is_owned = false;
72763         LDKNodeId node_id_conv;
72764         node_id_conv.inner = untag_ptr(node_id);
72765         node_id_conv.is_owned = ptr_is_owned(node_id);
72766         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
72767         node_id_conv.is_owned = false;
72768         ProbabilisticScoringFeeParameters_remove_banned(&this_arg_conv, &node_id_conv);
72769 }
72770
72771 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) {
72772         LDKProbabilisticScoringFeeParameters this_arg_conv;
72773         this_arg_conv.inner = untag_ptr(this_arg);
72774         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72776         this_arg_conv.is_owned = false;
72777         LDKNodeId node_id_conv;
72778         node_id_conv.inner = untag_ptr(node_id);
72779         node_id_conv.is_owned = ptr_is_owned(node_id);
72780         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
72781         node_id_conv.is_owned = false;
72782         ProbabilisticScoringFeeParameters_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
72783 }
72784
72785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1remove_1manual_1penalty(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
72786         LDKProbabilisticScoringFeeParameters this_arg_conv;
72787         this_arg_conv.inner = untag_ptr(this_arg);
72788         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72790         this_arg_conv.is_owned = false;
72791         LDKNodeId node_id_conv;
72792         node_id_conv.inner = untag_ptr(node_id);
72793         node_id_conv.is_owned = ptr_is_owned(node_id);
72794         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
72795         node_id_conv.is_owned = false;
72796         ProbabilisticScoringFeeParameters_remove_manual_penalty(&this_arg_conv, &node_id_conv);
72797 }
72798
72799 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1clear_1manual_1penalties(JNIEnv *env, jclass clz, int64_t this_arg) {
72800         LDKProbabilisticScoringFeeParameters this_arg_conv;
72801         this_arg_conv.inner = untag_ptr(this_arg);
72802         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72804         this_arg_conv.is_owned = false;
72805         ProbabilisticScoringFeeParameters_clear_manual_penalties(&this_arg_conv);
72806 }
72807
72808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72809         LDKProbabilisticScoringDecayParameters this_obj_conv;
72810         this_obj_conv.inner = untag_ptr(this_obj);
72811         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72813         ProbabilisticScoringDecayParameters_free(this_obj_conv);
72814 }
72815
72816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1get_1historical_1no_1updates_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) {
72817         LDKProbabilisticScoringDecayParameters this_ptr_conv;
72818         this_ptr_conv.inner = untag_ptr(this_ptr);
72819         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72821         this_ptr_conv.is_owned = false;
72822         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_historical_no_updates_half_life(&this_ptr_conv);
72823         return ret_conv;
72824 }
72825
72826 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) {
72827         LDKProbabilisticScoringDecayParameters this_ptr_conv;
72828         this_ptr_conv.inner = untag_ptr(this_ptr);
72829         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72831         this_ptr_conv.is_owned = false;
72832         ProbabilisticScoringDecayParameters_set_historical_no_updates_half_life(&this_ptr_conv, val);
72833 }
72834
72835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1get_1liquidity_1offset_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) {
72836         LDKProbabilisticScoringDecayParameters this_ptr_conv;
72837         this_ptr_conv.inner = untag_ptr(this_ptr);
72838         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72840         this_ptr_conv.is_owned = false;
72841         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(&this_ptr_conv);
72842         return ret_conv;
72843 }
72844
72845 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) {
72846         LDKProbabilisticScoringDecayParameters this_ptr_conv;
72847         this_ptr_conv.inner = untag_ptr(this_ptr);
72848         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72850         this_ptr_conv.is_owned = false;
72851         ProbabilisticScoringDecayParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
72852 }
72853
72854 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) {
72855         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_new(historical_no_updates_half_life_arg, liquidity_offset_half_life_arg);
72856         int64_t ret_ref = 0;
72857         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72858         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72859         return ret_ref;
72860 }
72861
72862 static inline uint64_t ProbabilisticScoringDecayParameters_clone_ptr(LDKProbabilisticScoringDecayParameters *NONNULL_PTR arg) {
72863         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(arg);
72864         int64_t ret_ref = 0;
72865         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72866         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72867         return ret_ref;
72868 }
72869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
72870         LDKProbabilisticScoringDecayParameters arg_conv;
72871         arg_conv.inner = untag_ptr(arg);
72872         arg_conv.is_owned = ptr_is_owned(arg);
72873         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72874         arg_conv.is_owned = false;
72875         int64_t ret_conv = ProbabilisticScoringDecayParameters_clone_ptr(&arg_conv);
72876         return ret_conv;
72877 }
72878
72879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
72880         LDKProbabilisticScoringDecayParameters orig_conv;
72881         orig_conv.inner = untag_ptr(orig);
72882         orig_conv.is_owned = ptr_is_owned(orig);
72883         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72884         orig_conv.is_owned = false;
72885         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(&orig_conv);
72886         int64_t ret_ref = 0;
72887         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72888         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72889         return ret_ref;
72890 }
72891
72892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1default(JNIEnv *env, jclass clz) {
72893         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_default();
72894         int64_t ret_ref = 0;
72895         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72896         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72897         return ret_ref;
72898 }
72899
72900 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) {
72901         LDKProbabilisticScoringDecayParameters decay_params_conv;
72902         decay_params_conv.inner = untag_ptr(decay_params);
72903         decay_params_conv.is_owned = ptr_is_owned(decay_params);
72904         CHECK_INNER_FIELD_ACCESS_OR_NULL(decay_params_conv);
72905         decay_params_conv = ProbabilisticScoringDecayParameters_clone(&decay_params_conv);
72906         LDKNetworkGraph network_graph_conv;
72907         network_graph_conv.inner = untag_ptr(network_graph);
72908         network_graph_conv.is_owned = ptr_is_owned(network_graph);
72909         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
72910         network_graph_conv.is_owned = false;
72911         void* logger_ptr = untag_ptr(logger);
72912         CHECK_ACCESS(logger_ptr);
72913         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
72914         if (logger_conv.free == LDKLogger_JCalls_free) {
72915                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
72916                 LDKLogger_JCalls_cloned(&logger_conv);
72917         }
72918         LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(decay_params_conv, &network_graph_conv, logger_conv);
72919         int64_t ret_ref = 0;
72920         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72921         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72922         return ret_ref;
72923 }
72924
72925 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1debug_1log_1liquidity_1stats(JNIEnv *env, jclass clz, int64_t this_arg) {
72926         LDKProbabilisticScorer this_arg_conv;
72927         this_arg_conv.inner = untag_ptr(this_arg);
72928         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72930         this_arg_conv.is_owned = false;
72931         ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
72932 }
72933
72934 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) {
72935         LDKProbabilisticScorer this_arg_conv;
72936         this_arg_conv.inner = untag_ptr(this_arg);
72937         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72939         this_arg_conv.is_owned = false;
72940         LDKNodeId target_conv;
72941         target_conv.inner = untag_ptr(target);
72942         target_conv.is_owned = ptr_is_owned(target);
72943         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
72944         target_conv.is_owned = false;
72945         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
72946         *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
72947         int64_t ret_ref = tag_ptr(ret_copy, true);
72948         return ret_ref;
72949 }
72950
72951 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) {
72952         LDKProbabilisticScorer this_arg_conv;
72953         this_arg_conv.inner = untag_ptr(this_arg);
72954         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72956         this_arg_conv.is_owned = false;
72957         LDKNodeId target_conv;
72958         target_conv.inner = untag_ptr(target);
72959         target_conv.is_owned = ptr_is_owned(target);
72960         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
72961         target_conv.is_owned = false;
72962         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
72963         *ret_copy = ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(&this_arg_conv, scid, &target_conv);
72964         int64_t ret_ref = tag_ptr(ret_copy, true);
72965         return ret_ref;
72966 }
72967
72968 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) {
72969         LDKProbabilisticScorer this_arg_conv;
72970         this_arg_conv.inner = untag_ptr(this_arg);
72971         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72973         this_arg_conv.is_owned = false;
72974         LDKNodeId target_conv;
72975         target_conv.inner = untag_ptr(target);
72976         target_conv.is_owned = ptr_is_owned(target);
72977         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
72978         target_conv.is_owned = false;
72979         LDKProbabilisticScoringFeeParameters params_conv;
72980         params_conv.inner = untag_ptr(params);
72981         params_conv.is_owned = ptr_is_owned(params);
72982         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
72983         params_conv.is_owned = false;
72984         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
72985         *ret_copy = ProbabilisticScorer_historical_estimated_payment_success_probability(&this_arg_conv, scid, &target_conv, amount_msat, &params_conv);
72986         int64_t ret_ref = tag_ptr(ret_copy, true);
72987         return ret_ref;
72988 }
72989
72990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1as_1ScoreLookUp(JNIEnv *env, jclass clz, int64_t this_arg) {
72991         LDKProbabilisticScorer this_arg_conv;
72992         this_arg_conv.inner = untag_ptr(this_arg);
72993         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72995         this_arg_conv.is_owned = false;
72996         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
72997         *ret_ret = ProbabilisticScorer_as_ScoreLookUp(&this_arg_conv);
72998         return tag_ptr(ret_ret, true);
72999 }
73000
73001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1as_1ScoreUpdate(JNIEnv *env, jclass clz, int64_t this_arg) {
73002         LDKProbabilisticScorer this_arg_conv;
73003         this_arg_conv.inner = untag_ptr(this_arg);
73004         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73006         this_arg_conv.is_owned = false;
73007         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
73008         *ret_ret = ProbabilisticScorer_as_ScoreUpdate(&this_arg_conv);
73009         return tag_ptr(ret_ret, true);
73010 }
73011
73012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
73013         LDKProbabilisticScorer this_arg_conv;
73014         this_arg_conv.inner = untag_ptr(this_arg);
73015         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73017         this_arg_conv.is_owned = false;
73018         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
73019         *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
73020         return tag_ptr(ret_ret, true);
73021 }
73022
73023 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
73024         LDKProbabilisticScorer obj_conv;
73025         obj_conv.inner = untag_ptr(obj);
73026         obj_conv.is_owned = ptr_is_owned(obj);
73027         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
73028         obj_conv.is_owned = false;
73029         LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
73030         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
73031         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
73032         CVec_u8Z_free(ret_var);
73033         return ret_arr;
73034 }
73035
73036 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) {
73037         LDKu8slice ser_ref;
73038         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
73039         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
73040         LDKProbabilisticScoringDecayParameters arg_a_conv;
73041         arg_a_conv.inner = untag_ptr(arg_a);
73042         arg_a_conv.is_owned = ptr_is_owned(arg_a);
73043         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
73044         arg_a_conv = ProbabilisticScoringDecayParameters_clone(&arg_a_conv);
73045         LDKNetworkGraph arg_b_conv;
73046         arg_b_conv.inner = untag_ptr(arg_b);
73047         arg_b_conv.is_owned = ptr_is_owned(arg_b);
73048         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
73049         arg_b_conv.is_owned = false;
73050         void* arg_c_ptr = untag_ptr(arg_c);
73051         CHECK_ACCESS(arg_c_ptr);
73052         LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
73053         if (arg_c_conv.free == LDKLogger_JCalls_free) {
73054                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
73055                 LDKLogger_JCalls_cloned(&arg_c_conv);
73056         }
73057         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
73058         *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
73059         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
73060         return tag_ptr(ret_conv, true);
73061 }
73062
73063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73064         LDKDelayedPaymentOutputDescriptor this_obj_conv;
73065         this_obj_conv.inner = untag_ptr(this_obj);
73066         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73068         DelayedPaymentOutputDescriptor_free(this_obj_conv);
73069 }
73070
73071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
73072         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73073         this_ptr_conv.inner = untag_ptr(this_ptr);
73074         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73076         this_ptr_conv.is_owned = false;
73077         LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
73078         int64_t ret_ref = 0;
73079         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73080         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73081         return ret_ref;
73082 }
73083
73084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
73085         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73086         this_ptr_conv.inner = untag_ptr(this_ptr);
73087         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73089         this_ptr_conv.is_owned = false;
73090         LDKOutPoint val_conv;
73091         val_conv.inner = untag_ptr(val);
73092         val_conv.is_owned = ptr_is_owned(val);
73093         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
73094         val_conv = OutPoint_clone(&val_conv);
73095         DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
73096 }
73097
73098 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
73099         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73100         this_ptr_conv.inner = untag_ptr(this_ptr);
73101         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73103         this_ptr_conv.is_owned = false;
73104         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
73105         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
73106         return ret_arr;
73107 }
73108
73109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
73110         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73111         this_ptr_conv.inner = untag_ptr(this_ptr);
73112         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73114         this_ptr_conv.is_owned = false;
73115         LDKPublicKey val_ref;
73116         CHECK((*env)->GetArrayLength(env, val) == 33);
73117         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
73118         DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
73119 }
73120
73121 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
73122         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73123         this_ptr_conv.inner = untag_ptr(this_ptr);
73124         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73126         this_ptr_conv.is_owned = false;
73127         int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
73128         return ret_conv;
73129 }
73130
73131 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
73132         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73133         this_ptr_conv.inner = untag_ptr(this_ptr);
73134         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73136         this_ptr_conv.is_owned = false;
73137         DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
73138 }
73139
73140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
73141         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73142         this_ptr_conv.inner = untag_ptr(this_ptr);
73143         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73145         this_ptr_conv.is_owned = false;
73146         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
73147         *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
73148         return tag_ptr(ret_ref, true);
73149 }
73150
73151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
73152         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73153         this_ptr_conv.inner = untag_ptr(this_ptr);
73154         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73156         this_ptr_conv.is_owned = false;
73157         void* val_ptr = untag_ptr(val);
73158         CHECK_ACCESS(val_ptr);
73159         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
73160         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
73161         DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
73162 }
73163
73164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
73165         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73166         this_ptr_conv.inner = untag_ptr(this_ptr);
73167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73169         this_ptr_conv.is_owned = false;
73170         LDKRevocationKey ret_var = DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv);
73171         int64_t ret_ref = 0;
73172         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73173         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73174         return ret_ref;
73175 }
73176
73177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
73178         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73179         this_ptr_conv.inner = untag_ptr(this_ptr);
73180         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73182         this_ptr_conv.is_owned = false;
73183         LDKRevocationKey val_conv;
73184         val_conv.inner = untag_ptr(val);
73185         val_conv.is_owned = ptr_is_owned(val);
73186         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
73187         val_conv = RevocationKey_clone(&val_conv);
73188         DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_conv);
73189 }
73190
73191 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
73192         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73193         this_ptr_conv.inner = untag_ptr(this_ptr);
73194         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73196         this_ptr_conv.is_owned = false;
73197         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
73198         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
73199         return ret_arr;
73200 }
73201
73202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
73203         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73204         this_ptr_conv.inner = untag_ptr(this_ptr);
73205         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73207         this_ptr_conv.is_owned = false;
73208         LDKThirtyTwoBytes val_ref;
73209         CHECK((*env)->GetArrayLength(env, val) == 32);
73210         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
73211         DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
73212 }
73213
73214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
73215         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73216         this_ptr_conv.inner = untag_ptr(this_ptr);
73217         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73219         this_ptr_conv.is_owned = false;
73220         int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
73221         return ret_conv;
73222 }
73223
73224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
73225         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73226         this_ptr_conv.inner = untag_ptr(this_ptr);
73227         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73229         this_ptr_conv.is_owned = false;
73230         DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
73231 }
73232
73233 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) {
73234         LDKOutPoint outpoint_arg_conv;
73235         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
73236         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
73237         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
73238         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
73239         LDKPublicKey per_commitment_point_arg_ref;
73240         CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
73241         (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
73242         void* output_arg_ptr = untag_ptr(output_arg);
73243         CHECK_ACCESS(output_arg_ptr);
73244         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
73245         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
73246         LDKRevocationKey revocation_pubkey_arg_conv;
73247         revocation_pubkey_arg_conv.inner = untag_ptr(revocation_pubkey_arg);
73248         revocation_pubkey_arg_conv.is_owned = ptr_is_owned(revocation_pubkey_arg);
73249         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_pubkey_arg_conv);
73250         revocation_pubkey_arg_conv = RevocationKey_clone(&revocation_pubkey_arg_conv);
73251         LDKThirtyTwoBytes channel_keys_id_arg_ref;
73252         CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
73253         (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
73254         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);
73255         int64_t ret_ref = 0;
73256         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73257         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73258         return ret_ref;
73259 }
73260
73261 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
73262         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
73263         int64_t ret_ref = 0;
73264         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73265         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73266         return ret_ref;
73267 }
73268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73269         LDKDelayedPaymentOutputDescriptor arg_conv;
73270         arg_conv.inner = untag_ptr(arg);
73271         arg_conv.is_owned = ptr_is_owned(arg);
73272         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73273         arg_conv.is_owned = false;
73274         int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
73275         return ret_conv;
73276 }
73277
73278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73279         LDKDelayedPaymentOutputDescriptor orig_conv;
73280         orig_conv.inner = untag_ptr(orig);
73281         orig_conv.is_owned = ptr_is_owned(orig);
73282         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73283         orig_conv.is_owned = false;
73284         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
73285         int64_t ret_ref = 0;
73286         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73287         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73288         return ret_ref;
73289 }
73290
73291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1hash(JNIEnv *env, jclass clz, int64_t o) {
73292         LDKDelayedPaymentOutputDescriptor o_conv;
73293         o_conv.inner = untag_ptr(o);
73294         o_conv.is_owned = ptr_is_owned(o);
73295         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73296         o_conv.is_owned = false;
73297         int64_t ret_conv = DelayedPaymentOutputDescriptor_hash(&o_conv);
73298         return ret_conv;
73299 }
73300
73301 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73302         LDKDelayedPaymentOutputDescriptor a_conv;
73303         a_conv.inner = untag_ptr(a);
73304         a_conv.is_owned = ptr_is_owned(a);
73305         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73306         a_conv.is_owned = false;
73307         LDKDelayedPaymentOutputDescriptor b_conv;
73308         b_conv.inner = untag_ptr(b);
73309         b_conv.is_owned = ptr_is_owned(b);
73310         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73311         b_conv.is_owned = false;
73312         jboolean ret_conv = DelayedPaymentOutputDescriptor_eq(&a_conv, &b_conv);
73313         return ret_conv;
73314 }
73315
73316 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
73317         LDKDelayedPaymentOutputDescriptor obj_conv;
73318         obj_conv.inner = untag_ptr(obj);
73319         obj_conv.is_owned = ptr_is_owned(obj);
73320         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
73321         obj_conv.is_owned = false;
73322         LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
73323         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
73324         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
73325         CVec_u8Z_free(ret_var);
73326         return ret_arr;
73327 }
73328
73329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
73330         LDKu8slice ser_ref;
73331         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
73332         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
73333         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
73334         *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
73335         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
73336         return tag_ptr(ret_conv, true);
73337 }
73338
73339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73340         LDKStaticPaymentOutputDescriptor this_obj_conv;
73341         this_obj_conv.inner = untag_ptr(this_obj);
73342         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73344         StaticPaymentOutputDescriptor_free(this_obj_conv);
73345 }
73346
73347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
73348         LDKStaticPaymentOutputDescriptor this_ptr_conv;
73349         this_ptr_conv.inner = untag_ptr(this_ptr);
73350         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73352         this_ptr_conv.is_owned = false;
73353         LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
73354         int64_t ret_ref = 0;
73355         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73356         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73357         return ret_ref;
73358 }
73359
73360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
73361         LDKStaticPaymentOutputDescriptor this_ptr_conv;
73362         this_ptr_conv.inner = untag_ptr(this_ptr);
73363         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73365         this_ptr_conv.is_owned = false;
73366         LDKOutPoint val_conv;
73367         val_conv.inner = untag_ptr(val);
73368         val_conv.is_owned = ptr_is_owned(val);
73369         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
73370         val_conv = OutPoint_clone(&val_conv);
73371         StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
73372 }
73373
73374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
73375         LDKStaticPaymentOutputDescriptor this_ptr_conv;
73376         this_ptr_conv.inner = untag_ptr(this_ptr);
73377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73379         this_ptr_conv.is_owned = false;
73380         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
73381         *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
73382         return tag_ptr(ret_ref, true);
73383 }
73384
73385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
73386         LDKStaticPaymentOutputDescriptor this_ptr_conv;
73387         this_ptr_conv.inner = untag_ptr(this_ptr);
73388         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73390         this_ptr_conv.is_owned = false;
73391         void* val_ptr = untag_ptr(val);
73392         CHECK_ACCESS(val_ptr);
73393         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
73394         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
73395         StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
73396 }
73397
73398 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
73399         LDKStaticPaymentOutputDescriptor this_ptr_conv;
73400         this_ptr_conv.inner = untag_ptr(this_ptr);
73401         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73403         this_ptr_conv.is_owned = false;
73404         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
73405         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
73406         return ret_arr;
73407 }
73408
73409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
73410         LDKStaticPaymentOutputDescriptor this_ptr_conv;
73411         this_ptr_conv.inner = untag_ptr(this_ptr);
73412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73414         this_ptr_conv.is_owned = false;
73415         LDKThirtyTwoBytes val_ref;
73416         CHECK((*env)->GetArrayLength(env, val) == 32);
73417         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
73418         StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
73419 }
73420
73421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
73422         LDKStaticPaymentOutputDescriptor this_ptr_conv;
73423         this_ptr_conv.inner = untag_ptr(this_ptr);
73424         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73426         this_ptr_conv.is_owned = false;
73427         int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
73428         return ret_conv;
73429 }
73430
73431 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
73432         LDKStaticPaymentOutputDescriptor this_ptr_conv;
73433         this_ptr_conv.inner = untag_ptr(this_ptr);
73434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73436         this_ptr_conv.is_owned = false;
73437         StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
73438 }
73439
73440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
73441         LDKStaticPaymentOutputDescriptor this_ptr_conv;
73442         this_ptr_conv.inner = untag_ptr(this_ptr);
73443         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73445         this_ptr_conv.is_owned = false;
73446         LDKChannelTransactionParameters ret_var = StaticPaymentOutputDescriptor_get_channel_transaction_parameters(&this_ptr_conv);
73447         int64_t ret_ref = 0;
73448         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73449         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73450         return ret_ref;
73451 }
73452
73453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
73454         LDKStaticPaymentOutputDescriptor this_ptr_conv;
73455         this_ptr_conv.inner = untag_ptr(this_ptr);
73456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73458         this_ptr_conv.is_owned = false;
73459         LDKChannelTransactionParameters val_conv;
73460         val_conv.inner = untag_ptr(val);
73461         val_conv.is_owned = ptr_is_owned(val);
73462         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
73463         val_conv = ChannelTransactionParameters_clone(&val_conv);
73464         StaticPaymentOutputDescriptor_set_channel_transaction_parameters(&this_ptr_conv, val_conv);
73465 }
73466
73467 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) {
73468         LDKOutPoint outpoint_arg_conv;
73469         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
73470         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
73471         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
73472         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
73473         void* output_arg_ptr = untag_ptr(output_arg);
73474         CHECK_ACCESS(output_arg_ptr);
73475         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
73476         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
73477         LDKThirtyTwoBytes channel_keys_id_arg_ref;
73478         CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
73479         (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
73480         LDKChannelTransactionParameters channel_transaction_parameters_arg_conv;
73481         channel_transaction_parameters_arg_conv.inner = untag_ptr(channel_transaction_parameters_arg);
73482         channel_transaction_parameters_arg_conv.is_owned = ptr_is_owned(channel_transaction_parameters_arg);
73483         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_transaction_parameters_arg_conv);
73484         channel_transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&channel_transaction_parameters_arg_conv);
73485         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);
73486         int64_t ret_ref = 0;
73487         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73488         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73489         return ret_ref;
73490 }
73491
73492 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
73493         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
73494         int64_t ret_ref = 0;
73495         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73496         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73497         return ret_ref;
73498 }
73499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73500         LDKStaticPaymentOutputDescriptor arg_conv;
73501         arg_conv.inner = untag_ptr(arg);
73502         arg_conv.is_owned = ptr_is_owned(arg);
73503         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73504         arg_conv.is_owned = false;
73505         int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
73506         return ret_conv;
73507 }
73508
73509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73510         LDKStaticPaymentOutputDescriptor orig_conv;
73511         orig_conv.inner = untag_ptr(orig);
73512         orig_conv.is_owned = ptr_is_owned(orig);
73513         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73514         orig_conv.is_owned = false;
73515         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
73516         int64_t ret_ref = 0;
73517         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73518         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73519         return ret_ref;
73520 }
73521
73522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1hash(JNIEnv *env, jclass clz, int64_t o) {
73523         LDKStaticPaymentOutputDescriptor o_conv;
73524         o_conv.inner = untag_ptr(o);
73525         o_conv.is_owned = ptr_is_owned(o);
73526         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73527         o_conv.is_owned = false;
73528         int64_t ret_conv = StaticPaymentOutputDescriptor_hash(&o_conv);
73529         return ret_conv;
73530 }
73531
73532 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73533         LDKStaticPaymentOutputDescriptor a_conv;
73534         a_conv.inner = untag_ptr(a);
73535         a_conv.is_owned = ptr_is_owned(a);
73536         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73537         a_conv.is_owned = false;
73538         LDKStaticPaymentOutputDescriptor b_conv;
73539         b_conv.inner = untag_ptr(b);
73540         b_conv.is_owned = ptr_is_owned(b);
73541         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73542         b_conv.is_owned = false;
73543         jboolean ret_conv = StaticPaymentOutputDescriptor_eq(&a_conv, &b_conv);
73544         return ret_conv;
73545 }
73546
73547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1witness_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
73548         LDKStaticPaymentOutputDescriptor this_arg_conv;
73549         this_arg_conv.inner = untag_ptr(this_arg);
73550         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73552         this_arg_conv.is_owned = false;
73553         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
73554         *ret_copy = StaticPaymentOutputDescriptor_witness_script(&this_arg_conv);
73555         int64_t ret_ref = tag_ptr(ret_copy, true);
73556         return ret_ref;
73557 }
73558
73559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1max_1witness_1length(JNIEnv *env, jclass clz, int64_t this_arg) {
73560         LDKStaticPaymentOutputDescriptor this_arg_conv;
73561         this_arg_conv.inner = untag_ptr(this_arg);
73562         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73564         this_arg_conv.is_owned = false;
73565         int64_t ret_conv = StaticPaymentOutputDescriptor_max_witness_length(&this_arg_conv);
73566         return ret_conv;
73567 }
73568
73569 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
73570         LDKStaticPaymentOutputDescriptor obj_conv;
73571         obj_conv.inner = untag_ptr(obj);
73572         obj_conv.is_owned = ptr_is_owned(obj);
73573         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
73574         obj_conv.is_owned = false;
73575         LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
73576         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
73577         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
73578         CVec_u8Z_free(ret_var);
73579         return ret_arr;
73580 }
73581
73582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
73583         LDKu8slice ser_ref;
73584         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
73585         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
73586         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
73587         *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
73588         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
73589         return tag_ptr(ret_conv, true);
73590 }
73591
73592 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
73593         if (!ptr_is_owned(this_ptr)) return;
73594         void* this_ptr_ptr = untag_ptr(this_ptr);
73595         CHECK_ACCESS(this_ptr_ptr);
73596         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
73597         FREE(untag_ptr(this_ptr));
73598         SpendableOutputDescriptor_free(this_ptr_conv);
73599 }
73600
73601 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
73602         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
73603         *ret_copy = SpendableOutputDescriptor_clone(arg);
73604         int64_t ret_ref = tag_ptr(ret_copy, true);
73605         return ret_ref;
73606 }
73607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73608         LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)untag_ptr(arg);
73609         int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
73610         return ret_conv;
73611 }
73612
73613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73614         LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)untag_ptr(orig);
73615         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
73616         *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
73617         int64_t ret_ref = tag_ptr(ret_copy, true);
73618         return ret_ref;
73619 }
73620
73621 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) {
73622         LDKOutPoint outpoint_conv;
73623         outpoint_conv.inner = untag_ptr(outpoint);
73624         outpoint_conv.is_owned = ptr_is_owned(outpoint);
73625         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
73626         outpoint_conv = OutPoint_clone(&outpoint_conv);
73627         void* output_ptr = untag_ptr(output);
73628         CHECK_ACCESS(output_ptr);
73629         LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
73630         output_conv = TxOut_clone((LDKTxOut*)untag_ptr(output));
73631         LDKThirtyTwoBytes channel_keys_id_ref;
73632         CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
73633         (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
73634         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
73635         *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv, channel_keys_id_ref);
73636         int64_t ret_ref = tag_ptr(ret_copy, true);
73637         return ret_ref;
73638 }
73639
73640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1delayed_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
73641         LDKDelayedPaymentOutputDescriptor a_conv;
73642         a_conv.inner = untag_ptr(a);
73643         a_conv.is_owned = ptr_is_owned(a);
73644         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73645         a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
73646         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
73647         *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
73648         int64_t ret_ref = tag_ptr(ret_copy, true);
73649         return ret_ref;
73650 }
73651
73652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
73653         LDKStaticPaymentOutputDescriptor a_conv;
73654         a_conv.inner = untag_ptr(a);
73655         a_conv.is_owned = ptr_is_owned(a);
73656         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73657         a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
73658         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
73659         *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
73660         int64_t ret_ref = tag_ptr(ret_copy, true);
73661         return ret_ref;
73662 }
73663
73664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1hash(JNIEnv *env, jclass clz, int64_t o) {
73665         LDKSpendableOutputDescriptor* o_conv = (LDKSpendableOutputDescriptor*)untag_ptr(o);
73666         int64_t ret_conv = SpendableOutputDescriptor_hash(o_conv);
73667         return ret_conv;
73668 }
73669
73670 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73671         LDKSpendableOutputDescriptor* a_conv = (LDKSpendableOutputDescriptor*)untag_ptr(a);
73672         LDKSpendableOutputDescriptor* b_conv = (LDKSpendableOutputDescriptor*)untag_ptr(b);
73673         jboolean ret_conv = SpendableOutputDescriptor_eq(a_conv, b_conv);
73674         return ret_conv;
73675 }
73676
73677 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
73678         LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)untag_ptr(obj);
73679         LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
73680         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
73681         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
73682         CVec_u8Z_free(ret_var);
73683         return ret_arr;
73684 }
73685
73686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
73687         LDKu8slice ser_ref;
73688         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
73689         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
73690         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
73691         *ret_conv = SpendableOutputDescriptor_read(ser_ref);
73692         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
73693         return tag_ptr(ret_conv, true);
73694 }
73695
73696 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) {
73697         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
73698         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
73699         if (descriptors_constr.datalen > 0)
73700                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
73701         else
73702                 descriptors_constr.data = NULL;
73703         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
73704         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
73705                 int64_t descriptors_conv_27 = descriptors_vals[b];
73706                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
73707                 CHECK_ACCESS(descriptors_conv_27_ptr);
73708                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
73709                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
73710                 descriptors_constr.data[b] = descriptors_conv_27_conv;
73711         }
73712         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
73713         LDKCVec_TxOutZ outputs_constr;
73714         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
73715         if (outputs_constr.datalen > 0)
73716                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
73717         else
73718                 outputs_constr.data = NULL;
73719         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
73720         for (size_t h = 0; h < outputs_constr.datalen; h++) {
73721                 int64_t outputs_conv_7 = outputs_vals[h];
73722                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
73723                 CHECK_ACCESS(outputs_conv_7_ptr);
73724                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
73725                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
73726                 outputs_constr.data[h] = outputs_conv_7_conv;
73727         }
73728         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
73729         LDKCVec_u8Z change_destination_script_ref;
73730         change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
73731         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
73732         (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
73733         void* locktime_ptr = untag_ptr(locktime);
73734         CHECK_ACCESS(locktime_ptr);
73735         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
73736         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
73737         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
73738         *ret_conv = SpendableOutputDescriptor_create_spendable_outputs_psbt(descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
73739         return tag_ptr(ret_conv, true);
73740 }
73741
73742 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73743         LDKChannelDerivationParameters this_obj_conv;
73744         this_obj_conv.inner = untag_ptr(this_obj);
73745         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73747         ChannelDerivationParameters_free(this_obj_conv);
73748 }
73749
73750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1get_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
73751         LDKChannelDerivationParameters this_ptr_conv;
73752         this_ptr_conv.inner = untag_ptr(this_ptr);
73753         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73755         this_ptr_conv.is_owned = false;
73756         int64_t ret_conv = ChannelDerivationParameters_get_value_satoshis(&this_ptr_conv);
73757         return ret_conv;
73758 }
73759
73760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1set_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
73761         LDKChannelDerivationParameters this_ptr_conv;
73762         this_ptr_conv.inner = untag_ptr(this_ptr);
73763         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73765         this_ptr_conv.is_owned = false;
73766         ChannelDerivationParameters_set_value_satoshis(&this_ptr_conv, val);
73767 }
73768
73769 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1get_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
73770         LDKChannelDerivationParameters this_ptr_conv;
73771         this_ptr_conv.inner = untag_ptr(this_ptr);
73772         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73774         this_ptr_conv.is_owned = false;
73775         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
73776         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDerivationParameters_get_keys_id(&this_ptr_conv));
73777         return ret_arr;
73778 }
73779
73780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1set_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
73781         LDKChannelDerivationParameters this_ptr_conv;
73782         this_ptr_conv.inner = untag_ptr(this_ptr);
73783         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73785         this_ptr_conv.is_owned = false;
73786         LDKThirtyTwoBytes val_ref;
73787         CHECK((*env)->GetArrayLength(env, val) == 32);
73788         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
73789         ChannelDerivationParameters_set_keys_id(&this_ptr_conv, val_ref);
73790 }
73791
73792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1get_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
73793         LDKChannelDerivationParameters this_ptr_conv;
73794         this_ptr_conv.inner = untag_ptr(this_ptr);
73795         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73797         this_ptr_conv.is_owned = false;
73798         LDKChannelTransactionParameters ret_var = ChannelDerivationParameters_get_transaction_parameters(&this_ptr_conv);
73799         int64_t ret_ref = 0;
73800         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73801         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73802         return ret_ref;
73803 }
73804
73805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1set_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
73806         LDKChannelDerivationParameters this_ptr_conv;
73807         this_ptr_conv.inner = untag_ptr(this_ptr);
73808         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73810         this_ptr_conv.is_owned = false;
73811         LDKChannelTransactionParameters val_conv;
73812         val_conv.inner = untag_ptr(val);
73813         val_conv.is_owned = ptr_is_owned(val);
73814         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
73815         val_conv = ChannelTransactionParameters_clone(&val_conv);
73816         ChannelDerivationParameters_set_transaction_parameters(&this_ptr_conv, val_conv);
73817 }
73818
73819 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) {
73820         LDKThirtyTwoBytes keys_id_arg_ref;
73821         CHECK((*env)->GetArrayLength(env, keys_id_arg) == 32);
73822         (*env)->GetByteArrayRegion(env, keys_id_arg, 0, 32, keys_id_arg_ref.data);
73823         LDKChannelTransactionParameters transaction_parameters_arg_conv;
73824         transaction_parameters_arg_conv.inner = untag_ptr(transaction_parameters_arg);
73825         transaction_parameters_arg_conv.is_owned = ptr_is_owned(transaction_parameters_arg);
73826         CHECK_INNER_FIELD_ACCESS_OR_NULL(transaction_parameters_arg_conv);
73827         transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&transaction_parameters_arg_conv);
73828         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_new(value_satoshis_arg, keys_id_arg_ref, transaction_parameters_arg_conv);
73829         int64_t ret_ref = 0;
73830         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73831         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73832         return ret_ref;
73833 }
73834
73835 static inline uint64_t ChannelDerivationParameters_clone_ptr(LDKChannelDerivationParameters *NONNULL_PTR arg) {
73836         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(arg);
73837         int64_t ret_ref = 0;
73838         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73839         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73840         return ret_ref;
73841 }
73842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73843         LDKChannelDerivationParameters arg_conv;
73844         arg_conv.inner = untag_ptr(arg);
73845         arg_conv.is_owned = ptr_is_owned(arg);
73846         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73847         arg_conv.is_owned = false;
73848         int64_t ret_conv = ChannelDerivationParameters_clone_ptr(&arg_conv);
73849         return ret_conv;
73850 }
73851
73852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73853         LDKChannelDerivationParameters orig_conv;
73854         orig_conv.inner = untag_ptr(orig);
73855         orig_conv.is_owned = ptr_is_owned(orig);
73856         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73857         orig_conv.is_owned = false;
73858         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(&orig_conv);
73859         int64_t ret_ref = 0;
73860         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73861         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73862         return ret_ref;
73863 }
73864
73865 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73866         LDKChannelDerivationParameters a_conv;
73867         a_conv.inner = untag_ptr(a);
73868         a_conv.is_owned = ptr_is_owned(a);
73869         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73870         a_conv.is_owned = false;
73871         LDKChannelDerivationParameters b_conv;
73872         b_conv.inner = untag_ptr(b);
73873         b_conv.is_owned = ptr_is_owned(b);
73874         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73875         b_conv.is_owned = false;
73876         jboolean ret_conv = ChannelDerivationParameters_eq(&a_conv, &b_conv);
73877         return ret_conv;
73878 }
73879
73880 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
73881         LDKChannelDerivationParameters obj_conv;
73882         obj_conv.inner = untag_ptr(obj);
73883         obj_conv.is_owned = ptr_is_owned(obj);
73884         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
73885         obj_conv.is_owned = false;
73886         LDKCVec_u8Z ret_var = ChannelDerivationParameters_write(&obj_conv);
73887         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
73888         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
73889         CVec_u8Z_free(ret_var);
73890         return ret_arr;
73891 }
73892
73893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
73894         LDKu8slice ser_ref;
73895         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
73896         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
73897         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
73898         *ret_conv = ChannelDerivationParameters_read(ser_ref);
73899         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
73900         return tag_ptr(ret_conv, true);
73901 }
73902
73903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73904         LDKHTLCDescriptor this_obj_conv;
73905         this_obj_conv.inner = untag_ptr(this_obj);
73906         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73908         HTLCDescriptor_free(this_obj_conv);
73909 }
73910
73911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
73912         LDKHTLCDescriptor this_ptr_conv;
73913         this_ptr_conv.inner = untag_ptr(this_ptr);
73914         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73916         this_ptr_conv.is_owned = false;
73917         LDKChannelDerivationParameters ret_var = HTLCDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
73918         int64_t ret_ref = 0;
73919         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73920         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73921         return ret_ref;
73922 }
73923
73924 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
73925         LDKHTLCDescriptor this_ptr_conv;
73926         this_ptr_conv.inner = untag_ptr(this_ptr);
73927         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73929         this_ptr_conv.is_owned = false;
73930         LDKChannelDerivationParameters val_conv;
73931         val_conv.inner = untag_ptr(val);
73932         val_conv.is_owned = ptr_is_owned(val);
73933         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
73934         val_conv = ChannelDerivationParameters_clone(&val_conv);
73935         HTLCDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
73936 }
73937
73938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1per_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
73939         LDKHTLCDescriptor this_ptr_conv;
73940         this_ptr_conv.inner = untag_ptr(this_ptr);
73941         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73943         this_ptr_conv.is_owned = false;
73944         int64_t ret_conv = HTLCDescriptor_get_per_commitment_number(&this_ptr_conv);
73945         return ret_conv;
73946 }
73947
73948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1per_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
73949         LDKHTLCDescriptor this_ptr_conv;
73950         this_ptr_conv.inner = untag_ptr(this_ptr);
73951         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73953         this_ptr_conv.is_owned = false;
73954         HTLCDescriptor_set_per_commitment_number(&this_ptr_conv, val);
73955 }
73956
73957 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
73958         LDKHTLCDescriptor this_ptr_conv;
73959         this_ptr_conv.inner = untag_ptr(this_ptr);
73960         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73962         this_ptr_conv.is_owned = false;
73963         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
73964         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, HTLCDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
73965         return ret_arr;
73966 }
73967
73968 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
73969         LDKHTLCDescriptor this_ptr_conv;
73970         this_ptr_conv.inner = untag_ptr(this_ptr);
73971         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73973         this_ptr_conv.is_owned = false;
73974         LDKPublicKey val_ref;
73975         CHECK((*env)->GetArrayLength(env, val) == 33);
73976         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
73977         HTLCDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
73978 }
73979
73980 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
73981         LDKHTLCDescriptor this_ptr_conv;
73982         this_ptr_conv.inner = untag_ptr(this_ptr);
73983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73985         this_ptr_conv.is_owned = false;
73986         int32_t ret_conv = HTLCDescriptor_get_feerate_per_kw(&this_ptr_conv);
73987         return ret_conv;
73988 }
73989
73990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
73991         LDKHTLCDescriptor this_ptr_conv;
73992         this_ptr_conv.inner = untag_ptr(this_ptr);
73993         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73995         this_ptr_conv.is_owned = false;
73996         HTLCDescriptor_set_feerate_per_kw(&this_ptr_conv, val);
73997 }
73998
73999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1htlc(JNIEnv *env, jclass clz, int64_t this_ptr) {
74000         LDKHTLCDescriptor this_ptr_conv;
74001         this_ptr_conv.inner = untag_ptr(this_ptr);
74002         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74004         this_ptr_conv.is_owned = false;
74005         LDKHTLCOutputInCommitment ret_var = HTLCDescriptor_get_htlc(&this_ptr_conv);
74006         int64_t ret_ref = 0;
74007         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74008         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74009         return ret_ref;
74010 }
74011
74012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1htlc(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
74013         LDKHTLCDescriptor this_ptr_conv;
74014         this_ptr_conv.inner = untag_ptr(this_ptr);
74015         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74017         this_ptr_conv.is_owned = false;
74018         LDKHTLCOutputInCommitment val_conv;
74019         val_conv.inner = untag_ptr(val);
74020         val_conv.is_owned = ptr_is_owned(val);
74021         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74022         val_conv = HTLCOutputInCommitment_clone(&val_conv);
74023         HTLCDescriptor_set_htlc(&this_ptr_conv, val_conv);
74024 }
74025
74026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
74027         LDKHTLCDescriptor this_ptr_conv;
74028         this_ptr_conv.inner = untag_ptr(this_ptr);
74029         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74031         this_ptr_conv.is_owned = false;
74032         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
74033         *ret_copy = HTLCDescriptor_get_preimage(&this_ptr_conv);
74034         int64_t ret_ref = tag_ptr(ret_copy, true);
74035         return ret_ref;
74036 }
74037
74038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
74039         LDKHTLCDescriptor this_ptr_conv;
74040         this_ptr_conv.inner = untag_ptr(this_ptr);
74041         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74043         this_ptr_conv.is_owned = false;
74044         void* val_ptr = untag_ptr(val);
74045         CHECK_ACCESS(val_ptr);
74046         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
74047         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
74048         HTLCDescriptor_set_preimage(&this_ptr_conv, val_conv);
74049 }
74050
74051 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
74052         LDKHTLCDescriptor this_ptr_conv;
74053         this_ptr_conv.inner = untag_ptr(this_ptr);
74054         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74056         this_ptr_conv.is_owned = false;
74057         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
74058         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HTLCDescriptor_get_counterparty_sig(&this_ptr_conv).compact_form);
74059         return ret_arr;
74060 }
74061
74062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
74063         LDKHTLCDescriptor this_ptr_conv;
74064         this_ptr_conv.inner = untag_ptr(this_ptr);
74065         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74067         this_ptr_conv.is_owned = false;
74068         LDKECDSASignature val_ref;
74069         CHECK((*env)->GetArrayLength(env, val) == 64);
74070         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
74071         HTLCDescriptor_set_counterparty_sig(&this_ptr_conv, val_ref);
74072 }
74073
74074 static inline uint64_t HTLCDescriptor_clone_ptr(LDKHTLCDescriptor *NONNULL_PTR arg) {
74075         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(arg);
74076         int64_t ret_ref = 0;
74077         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74078         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74079         return ret_ref;
74080 }
74081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
74082         LDKHTLCDescriptor arg_conv;
74083         arg_conv.inner = untag_ptr(arg);
74084         arg_conv.is_owned = ptr_is_owned(arg);
74085         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74086         arg_conv.is_owned = false;
74087         int64_t ret_conv = HTLCDescriptor_clone_ptr(&arg_conv);
74088         return ret_conv;
74089 }
74090
74091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74092         LDKHTLCDescriptor orig_conv;
74093         orig_conv.inner = untag_ptr(orig);
74094         orig_conv.is_owned = ptr_is_owned(orig);
74095         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74096         orig_conv.is_owned = false;
74097         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(&orig_conv);
74098         int64_t ret_ref = 0;
74099         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74100         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74101         return ret_ref;
74102 }
74103
74104 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
74105         LDKHTLCDescriptor a_conv;
74106         a_conv.inner = untag_ptr(a);
74107         a_conv.is_owned = ptr_is_owned(a);
74108         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74109         a_conv.is_owned = false;
74110         LDKHTLCDescriptor b_conv;
74111         b_conv.inner = untag_ptr(b);
74112         b_conv.is_owned = ptr_is_owned(b);
74113         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74114         b_conv.is_owned = false;
74115         jboolean ret_conv = HTLCDescriptor_eq(&a_conv, &b_conv);
74116         return ret_conv;
74117 }
74118
74119 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
74120         LDKHTLCDescriptor obj_conv;
74121         obj_conv.inner = untag_ptr(obj);
74122         obj_conv.is_owned = ptr_is_owned(obj);
74123         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
74124         obj_conv.is_owned = false;
74125         LDKCVec_u8Z ret_var = HTLCDescriptor_write(&obj_conv);
74126         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
74127         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
74128         CVec_u8Z_free(ret_var);
74129         return ret_arr;
74130 }
74131
74132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
74133         LDKu8slice ser_ref;
74134         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
74135         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
74136         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
74137         *ret_conv = HTLCDescriptor_read(ser_ref);
74138         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
74139         return tag_ptr(ret_conv, true);
74140 }
74141
74142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
74143         LDKHTLCDescriptor this_arg_conv;
74144         this_arg_conv.inner = untag_ptr(this_arg);
74145         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74147         this_arg_conv.is_owned = false;
74148         LDKOutPoint ret_var = HTLCDescriptor_outpoint(&this_arg_conv);
74149         int64_t ret_ref = 0;
74150         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74151         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74152         return ret_ref;
74153 }
74154
74155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1previous_1utxo(JNIEnv *env, jclass clz, int64_t this_arg) {
74156         LDKHTLCDescriptor this_arg_conv;
74157         this_arg_conv.inner = untag_ptr(this_arg);
74158         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74160         this_arg_conv.is_owned = false;
74161         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
74162         *ret_ref = HTLCDescriptor_previous_utxo(&this_arg_conv);
74163         return tag_ptr(ret_ref, true);
74164 }
74165
74166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1unsigned_1tx_1input(JNIEnv *env, jclass clz, int64_t this_arg) {
74167         LDKHTLCDescriptor this_arg_conv;
74168         this_arg_conv.inner = untag_ptr(this_arg);
74169         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74171         this_arg_conv.is_owned = false;
74172         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
74173         *ret_ref = HTLCDescriptor_unsigned_tx_input(&this_arg_conv);
74174         return tag_ptr(ret_ref, true);
74175 }
74176
74177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1tx_1output(JNIEnv *env, jclass clz, int64_t this_arg) {
74178         LDKHTLCDescriptor this_arg_conv;
74179         this_arg_conv.inner = untag_ptr(this_arg);
74180         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74182         this_arg_conv.is_owned = false;
74183         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
74184         *ret_ref = HTLCDescriptor_tx_output(&this_arg_conv);
74185         return tag_ptr(ret_ref, true);
74186 }
74187
74188 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1witness_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
74189         LDKHTLCDescriptor this_arg_conv;
74190         this_arg_conv.inner = untag_ptr(this_arg);
74191         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74193         this_arg_conv.is_owned = false;
74194         LDKCVec_u8Z ret_var = HTLCDescriptor_witness_script(&this_arg_conv);
74195         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
74196         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
74197         CVec_u8Z_free(ret_var);
74198         return ret_arr;
74199 }
74200
74201 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) {
74202         LDKHTLCDescriptor this_arg_conv;
74203         this_arg_conv.inner = untag_ptr(this_arg);
74204         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74206         this_arg_conv.is_owned = false;
74207         LDKECDSASignature signature_ref;
74208         CHECK((*env)->GetArrayLength(env, signature) == 64);
74209         (*env)->GetByteArrayRegion(env, signature, 0, 64, signature_ref.compact_form);
74210         LDKu8slice witness_script_ref;
74211         witness_script_ref.datalen = (*env)->GetArrayLength(env, witness_script);
74212         witness_script_ref.data = (*env)->GetByteArrayElements (env, witness_script, NULL);
74213         LDKWitness ret_var = HTLCDescriptor_tx_input_witness(&this_arg_conv, signature_ref, witness_script_ref);
74214         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
74215         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
74216         Witness_free(ret_var);
74217         (*env)->ReleaseByteArrayElements(env, witness_script, (int8_t*)witness_script_ref.data, 0);
74218         return ret_arr;
74219 }
74220
74221 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) {
74222         LDKHTLCDescriptor this_arg_conv;
74223         this_arg_conv.inner = untag_ptr(this_arg);
74224         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74226         this_arg_conv.is_owned = false;
74227         void* signer_provider_ptr = untag_ptr(signer_provider);
74228         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
74229         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
74230         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
74231         *ret_ret = HTLCDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
74232         return tag_ptr(ret_ret, true);
74233 }
74234
74235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
74236         if (!ptr_is_owned(this_ptr)) return;
74237         void* this_ptr_ptr = untag_ptr(this_ptr);
74238         CHECK_ACCESS(this_ptr_ptr);
74239         LDKChannelSigner this_ptr_conv = *(LDKChannelSigner*)(this_ptr_ptr);
74240         FREE(untag_ptr(this_ptr));
74241         ChannelSigner_free(this_ptr_conv);
74242 }
74243
74244 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74245         LDKRecipient* orig_conv = (LDKRecipient*)untag_ptr(orig);
74246         jclass ret_conv = LDKRecipient_to_java(env, Recipient_clone(orig_conv));
74247         return ret_conv;
74248 }
74249
74250 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1node(JNIEnv *env, jclass clz) {
74251         jclass ret_conv = LDKRecipient_to_java(env, Recipient_node());
74252         return ret_conv;
74253 }
74254
74255 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1phantom_1node(JNIEnv *env, jclass clz) {
74256         jclass ret_conv = LDKRecipient_to_java(env, Recipient_phantom_node());
74257         return ret_conv;
74258 }
74259
74260 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EntropySource_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
74261         if (!ptr_is_owned(this_ptr)) return;
74262         void* this_ptr_ptr = untag_ptr(this_ptr);
74263         CHECK_ACCESS(this_ptr_ptr);
74264         LDKEntropySource this_ptr_conv = *(LDKEntropySource*)(this_ptr_ptr);
74265         FREE(untag_ptr(this_ptr));
74266         EntropySource_free(this_ptr_conv);
74267 }
74268
74269 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
74270         if (!ptr_is_owned(this_ptr)) return;
74271         void* this_ptr_ptr = untag_ptr(this_ptr);
74272         CHECK_ACCESS(this_ptr_ptr);
74273         LDKNodeSigner this_ptr_conv = *(LDKNodeSigner*)(this_ptr_ptr);
74274         FREE(untag_ptr(this_ptr));
74275         NodeSigner_free(this_ptr_conv);
74276 }
74277
74278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignerProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
74279         if (!ptr_is_owned(this_ptr)) return;
74280         void* this_ptr_ptr = untag_ptr(this_ptr);
74281         CHECK_ACCESS(this_ptr_ptr);
74282         LDKSignerProvider this_ptr_conv = *(LDKSignerProvider*)(this_ptr_ptr);
74283         FREE(untag_ptr(this_ptr));
74284         SignerProvider_free(this_ptr_conv);
74285 }
74286
74287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
74288         LDKInMemorySigner this_obj_conv;
74289         this_obj_conv.inner = untag_ptr(this_obj);
74290         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74292         InMemorySigner_free(this_obj_conv);
74293 }
74294
74295 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
74296         LDKInMemorySigner this_ptr_conv;
74297         this_ptr_conv.inner = untag_ptr(this_ptr);
74298         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74300         this_ptr_conv.is_owned = false;
74301         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
74302         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_funding_key(&this_ptr_conv));
74303         return ret_arr;
74304 }
74305
74306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
74307         LDKInMemorySigner this_ptr_conv;
74308         this_ptr_conv.inner = untag_ptr(this_ptr);
74309         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74311         this_ptr_conv.is_owned = false;
74312         LDKSecretKey val_ref;
74313         CHECK((*env)->GetArrayLength(env, val) == 32);
74314         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
74315         InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
74316 }
74317
74318 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
74319         LDKInMemorySigner this_ptr_conv;
74320         this_ptr_conv.inner = untag_ptr(this_ptr);
74321         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74323         this_ptr_conv.is_owned = false;
74324         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
74325         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_revocation_base_key(&this_ptr_conv));
74326         return ret_arr;
74327 }
74328
74329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
74330         LDKInMemorySigner this_ptr_conv;
74331         this_ptr_conv.inner = untag_ptr(this_ptr);
74332         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74334         this_ptr_conv.is_owned = false;
74335         LDKSecretKey val_ref;
74336         CHECK((*env)->GetArrayLength(env, val) == 32);
74337         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
74338         InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
74339 }
74340
74341 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
74342         LDKInMemorySigner this_ptr_conv;
74343         this_ptr_conv.inner = untag_ptr(this_ptr);
74344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74346         this_ptr_conv.is_owned = false;
74347         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
74348         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_payment_key(&this_ptr_conv));
74349         return ret_arr;
74350 }
74351
74352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
74353         LDKInMemorySigner this_ptr_conv;
74354         this_ptr_conv.inner = untag_ptr(this_ptr);
74355         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74357         this_ptr_conv.is_owned = false;
74358         LDKSecretKey val_ref;
74359         CHECK((*env)->GetArrayLength(env, val) == 32);
74360         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
74361         InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
74362 }
74363
74364 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
74365         LDKInMemorySigner this_ptr_conv;
74366         this_ptr_conv.inner = untag_ptr(this_ptr);
74367         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74369         this_ptr_conv.is_owned = false;
74370         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
74371         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv));
74372         return ret_arr;
74373 }
74374
74375 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) {
74376         LDKInMemorySigner this_ptr_conv;
74377         this_ptr_conv.inner = untag_ptr(this_ptr);
74378         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74380         this_ptr_conv.is_owned = false;
74381         LDKSecretKey val_ref;
74382         CHECK((*env)->GetArrayLength(env, val) == 32);
74383         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
74384         InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
74385 }
74386
74387 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
74388         LDKInMemorySigner this_ptr_conv;
74389         this_ptr_conv.inner = untag_ptr(this_ptr);
74390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74392         this_ptr_conv.is_owned = false;
74393         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
74394         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_htlc_base_key(&this_ptr_conv));
74395         return ret_arr;
74396 }
74397
74398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
74399         LDKInMemorySigner this_ptr_conv;
74400         this_ptr_conv.inner = untag_ptr(this_ptr);
74401         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74403         this_ptr_conv.is_owned = false;
74404         LDKSecretKey val_ref;
74405         CHECK((*env)->GetArrayLength(env, val) == 32);
74406         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
74407         InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
74408 }
74409
74410 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
74411         LDKInMemorySigner this_ptr_conv;
74412         this_ptr_conv.inner = untag_ptr(this_ptr);
74413         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74415         this_ptr_conv.is_owned = false;
74416         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
74417         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_commitment_seed(&this_ptr_conv));
74418         return ret_arr;
74419 }
74420
74421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
74422         LDKInMemorySigner 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         LDKThirtyTwoBytes val_ref;
74428         CHECK((*env)->GetArrayLength(env, val) == 32);
74429         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
74430         InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
74431 }
74432
74433 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
74434         LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
74435         int64_t ret_ref = 0;
74436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74438         return ret_ref;
74439 }
74440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
74441         LDKInMemorySigner arg_conv;
74442         arg_conv.inner = untag_ptr(arg);
74443         arg_conv.is_owned = ptr_is_owned(arg);
74444         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74445         arg_conv.is_owned = false;
74446         int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
74447         return ret_conv;
74448 }
74449
74450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74451         LDKInMemorySigner orig_conv;
74452         orig_conv.inner = untag_ptr(orig);
74453         orig_conv.is_owned = ptr_is_owned(orig);
74454         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74455         orig_conv.is_owned = false;
74456         LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
74457         int64_t ret_ref = 0;
74458         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74459         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74460         return ret_ref;
74461 }
74462
74463 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) {
74464         LDKSecretKey funding_key_ref;
74465         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
74466         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
74467         LDKSecretKey revocation_base_key_ref;
74468         CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
74469         (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
74470         LDKSecretKey payment_key_ref;
74471         CHECK((*env)->GetArrayLength(env, payment_key) == 32);
74472         (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
74473         LDKSecretKey delayed_payment_base_key_ref;
74474         CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
74475         (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
74476         LDKSecretKey htlc_base_key_ref;
74477         CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
74478         (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
74479         LDKThirtyTwoBytes commitment_seed_ref;
74480         CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
74481         (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
74482         LDKThirtyTwoBytes channel_keys_id_ref;
74483         CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
74484         (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
74485         LDKThirtyTwoBytes rand_bytes_unique_start_ref;
74486         CHECK((*env)->GetArrayLength(env, rand_bytes_unique_start) == 32);
74487         (*env)->GetByteArrayRegion(env, rand_bytes_unique_start, 0, 32, rand_bytes_unique_start_ref.data);
74488         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);
74489         int64_t ret_ref = 0;
74490         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74491         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74492         return ret_ref;
74493 }
74494
74495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
74496         LDKInMemorySigner this_arg_conv;
74497         this_arg_conv.inner = untag_ptr(this_arg);
74498         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74500         this_arg_conv.is_owned = false;
74501         LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
74502         int64_t ret_ref = 0;
74503         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74504         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74505         return ret_ref;
74506 }
74507
74508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
74509         LDKInMemorySigner this_arg_conv;
74510         this_arg_conv.inner = untag_ptr(this_arg);
74511         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74513         this_arg_conv.is_owned = false;
74514         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
74515         *ret_copy = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
74516         int64_t ret_ref = tag_ptr(ret_copy, true);
74517         return ret_ref;
74518 }
74519
74520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
74521         LDKInMemorySigner this_arg_conv;
74522         this_arg_conv.inner = untag_ptr(this_arg);
74523         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74525         this_arg_conv.is_owned = false;
74526         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
74527         *ret_copy = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
74528         int64_t ret_ref = tag_ptr(ret_copy, true);
74529         return ret_ref;
74530 }
74531
74532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
74533         LDKInMemorySigner this_arg_conv;
74534         this_arg_conv.inner = untag_ptr(this_arg);
74535         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74537         this_arg_conv.is_owned = false;
74538         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
74539         *ret_copy = InMemorySigner_is_outbound(&this_arg_conv);
74540         int64_t ret_ref = tag_ptr(ret_copy, true);
74541         return ret_ref;
74542 }
74543
74544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
74545         LDKInMemorySigner this_arg_conv;
74546         this_arg_conv.inner = untag_ptr(this_arg);
74547         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74549         this_arg_conv.is_owned = false;
74550         LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
74551         int64_t ret_ref = 0;
74552         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74553         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74554         return ret_ref;
74555 }
74556
74557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
74558         LDKInMemorySigner this_arg_conv;
74559         this_arg_conv.inner = untag_ptr(this_arg);
74560         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74562         this_arg_conv.is_owned = false;
74563         LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
74564         int64_t ret_ref = 0;
74565         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74566         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74567         return ret_ref;
74568 }
74569
74570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
74571         LDKInMemorySigner this_arg_conv;
74572         this_arg_conv.inner = untag_ptr(this_arg);
74573         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74575         this_arg_conv.is_owned = false;
74576         LDKChannelTypeFeatures ret_var = InMemorySigner_channel_type_features(&this_arg_conv);
74577         int64_t ret_ref = 0;
74578         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74579         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74580         return ret_ref;
74581 }
74582
74583 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) {
74584         LDKInMemorySigner this_arg_conv;
74585         this_arg_conv.inner = untag_ptr(this_arg);
74586         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74588         this_arg_conv.is_owned = false;
74589         LDKTransaction spend_tx_ref;
74590         spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
74591         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
74592         (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
74593         spend_tx_ref.data_is_owned = true;
74594         LDKStaticPaymentOutputDescriptor descriptor_conv;
74595         descriptor_conv.inner = untag_ptr(descriptor);
74596         descriptor_conv.is_owned = ptr_is_owned(descriptor);
74597         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
74598         descriptor_conv.is_owned = false;
74599         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
74600         *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
74601         return tag_ptr(ret_conv, true);
74602 }
74603
74604 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) {
74605         LDKInMemorySigner this_arg_conv;
74606         this_arg_conv.inner = untag_ptr(this_arg);
74607         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74609         this_arg_conv.is_owned = false;
74610         LDKTransaction spend_tx_ref;
74611         spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
74612         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
74613         (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
74614         spend_tx_ref.data_is_owned = true;
74615         LDKDelayedPaymentOutputDescriptor descriptor_conv;
74616         descriptor_conv.inner = untag_ptr(descriptor);
74617         descriptor_conv.is_owned = ptr_is_owned(descriptor);
74618         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
74619         descriptor_conv.is_owned = false;
74620         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
74621         *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
74622         return tag_ptr(ret_conv, true);
74623 }
74624
74625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1EntropySource(JNIEnv *env, jclass clz, int64_t this_arg) {
74626         LDKInMemorySigner this_arg_conv;
74627         this_arg_conv.inner = untag_ptr(this_arg);
74628         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74630         this_arg_conv.is_owned = false;
74631         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
74632         *ret_ret = InMemorySigner_as_EntropySource(&this_arg_conv);
74633         return tag_ptr(ret_ret, true);
74634 }
74635
74636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1ChannelSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
74637         LDKInMemorySigner this_arg_conv;
74638         this_arg_conv.inner = untag_ptr(this_arg);
74639         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74641         this_arg_conv.is_owned = false;
74642         LDKChannelSigner* ret_ret = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
74643         *ret_ret = InMemorySigner_as_ChannelSigner(&this_arg_conv);
74644         return tag_ptr(ret_ret, true);
74645 }
74646
74647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1EcdsaChannelSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
74648         LDKInMemorySigner this_arg_conv;
74649         this_arg_conv.inner = untag_ptr(this_arg);
74650         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74652         this_arg_conv.is_owned = false;
74653         LDKEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
74654         *ret_ret = InMemorySigner_as_EcdsaChannelSigner(&this_arg_conv);
74655         return tag_ptr(ret_ret, true);
74656 }
74657
74658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1WriteableEcdsaChannelSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
74659         LDKInMemorySigner this_arg_conv;
74660         this_arg_conv.inner = untag_ptr(this_arg);
74661         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74663         this_arg_conv.is_owned = false;
74664         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
74665         *ret_ret = InMemorySigner_as_WriteableEcdsaChannelSigner(&this_arg_conv);
74666         return tag_ptr(ret_ret, true);
74667 }
74668
74669 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
74670         LDKInMemorySigner obj_conv;
74671         obj_conv.inner = untag_ptr(obj);
74672         obj_conv.is_owned = ptr_is_owned(obj);
74673         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
74674         obj_conv.is_owned = false;
74675         LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
74676         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
74677         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
74678         CVec_u8Z_free(ret_var);
74679         return ret_arr;
74680 }
74681
74682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
74683         LDKu8slice ser_ref;
74684         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
74685         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
74686         void* arg_ptr = untag_ptr(arg);
74687         CHECK_ACCESS(arg_ptr);
74688         LDKEntropySource arg_conv = *(LDKEntropySource*)(arg_ptr);
74689         if (arg_conv.free == LDKEntropySource_JCalls_free) {
74690                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
74691                 LDKEntropySource_JCalls_cloned(&arg_conv);
74692         }
74693         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
74694         *ret_conv = InMemorySigner_read(ser_ref, arg_conv);
74695         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
74696         return tag_ptr(ret_conv, true);
74697 }
74698
74699 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
74700         LDKKeysManager this_obj_conv;
74701         this_obj_conv.inner = untag_ptr(this_obj);
74702         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74704         KeysManager_free(this_obj_conv);
74705 }
74706
74707 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) {
74708         uint8_t seed_arr[32];
74709         CHECK((*env)->GetArrayLength(env, seed) == 32);
74710         (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
74711         uint8_t (*seed_ref)[32] = &seed_arr;
74712         LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
74713         int64_t ret_ref = 0;
74714         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74715         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74716         return ret_ref;
74717 }
74718
74719 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysManager_1get_1node_1secret_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
74720         LDKKeysManager this_arg_conv;
74721         this_arg_conv.inner = untag_ptr(this_arg);
74722         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74724         this_arg_conv.is_owned = false;
74725         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
74726         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, KeysManager_get_node_secret_key(&this_arg_conv).bytes);
74727         return ret_arr;
74728 }
74729
74730 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) {
74731         LDKKeysManager this_arg_conv;
74732         this_arg_conv.inner = untag_ptr(this_arg);
74733         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74735         this_arg_conv.is_owned = false;
74736         uint8_t params_arr[32];
74737         CHECK((*env)->GetArrayLength(env, params) == 32);
74738         (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
74739         uint8_t (*params_ref)[32] = &params_arr;
74740         LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
74741         int64_t ret_ref = 0;
74742         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74743         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74744         return ret_ref;
74745 }
74746
74747 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) {
74748         LDKKeysManager this_arg_conv;
74749         this_arg_conv.inner = untag_ptr(this_arg);
74750         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74752         this_arg_conv.is_owned = false;
74753         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
74754         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
74755         if (descriptors_constr.datalen > 0)
74756                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
74757         else
74758                 descriptors_constr.data = NULL;
74759         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
74760         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
74761                 int64_t descriptors_conv_27 = descriptors_vals[b];
74762                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
74763                 CHECK_ACCESS(descriptors_conv_27_ptr);
74764                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
74765                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
74766                 descriptors_constr.data[b] = descriptors_conv_27_conv;
74767         }
74768         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
74769         LDKCVec_u8Z psbt_ref;
74770         psbt_ref.datalen = (*env)->GetArrayLength(env, psbt);
74771         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
74772         (*env)->GetByteArrayRegion(env, psbt, 0, psbt_ref.datalen, psbt_ref.data);
74773         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
74774         *ret_conv = KeysManager_sign_spendable_outputs_psbt(&this_arg_conv, descriptors_constr, psbt_ref);
74775         return tag_ptr(ret_conv, true);
74776 }
74777
74778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1spend_1spendable_1outputs(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray descriptors, int64_tArray outputs, int8_tArray change_destination_script, int32_t feerate_sat_per_1000_weight, int64_t locktime) {
74779         LDKKeysManager this_arg_conv;
74780         this_arg_conv.inner = untag_ptr(this_arg);
74781         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74783         this_arg_conv.is_owned = false;
74784         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
74785         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
74786         if (descriptors_constr.datalen > 0)
74787                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
74788         else
74789                 descriptors_constr.data = NULL;
74790         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
74791         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
74792                 int64_t descriptors_conv_27 = descriptors_vals[b];
74793                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
74794                 CHECK_ACCESS(descriptors_conv_27_ptr);
74795                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
74796                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
74797                 descriptors_constr.data[b] = descriptors_conv_27_conv;
74798         }
74799         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
74800         LDKCVec_TxOutZ outputs_constr;
74801         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
74802         if (outputs_constr.datalen > 0)
74803                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
74804         else
74805                 outputs_constr.data = NULL;
74806         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
74807         for (size_t h = 0; h < outputs_constr.datalen; h++) {
74808                 int64_t outputs_conv_7 = outputs_vals[h];
74809                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
74810                 CHECK_ACCESS(outputs_conv_7_ptr);
74811                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
74812                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
74813                 outputs_constr.data[h] = outputs_conv_7_conv;
74814         }
74815         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
74816         LDKCVec_u8Z change_destination_script_ref;
74817         change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
74818         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
74819         (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
74820         void* locktime_ptr = untag_ptr(locktime);
74821         CHECK_ACCESS(locktime_ptr);
74822         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
74823         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
74824         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
74825         *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
74826         return tag_ptr(ret_conv, true);
74827 }
74828
74829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1EntropySource(JNIEnv *env, jclass clz, int64_t this_arg) {
74830         LDKKeysManager this_arg_conv;
74831         this_arg_conv.inner = untag_ptr(this_arg);
74832         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74834         this_arg_conv.is_owned = false;
74835         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
74836         *ret_ret = KeysManager_as_EntropySource(&this_arg_conv);
74837         return tag_ptr(ret_ret, true);
74838 }
74839
74840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1NodeSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
74841         LDKKeysManager this_arg_conv;
74842         this_arg_conv.inner = untag_ptr(this_arg);
74843         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74845         this_arg_conv.is_owned = false;
74846         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
74847         *ret_ret = KeysManager_as_NodeSigner(&this_arg_conv);
74848         return tag_ptr(ret_ret, true);
74849 }
74850
74851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1SignerProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
74852         LDKKeysManager this_arg_conv;
74853         this_arg_conv.inner = untag_ptr(this_arg);
74854         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74856         this_arg_conv.is_owned = false;
74857         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
74858         *ret_ret = KeysManager_as_SignerProvider(&this_arg_conv);
74859         return tag_ptr(ret_ret, true);
74860 }
74861
74862 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
74863         LDKPhantomKeysManager this_obj_conv;
74864         this_obj_conv.inner = untag_ptr(this_obj);
74865         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74867         PhantomKeysManager_free(this_obj_conv);
74868 }
74869
74870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1EntropySource(JNIEnv *env, jclass clz, int64_t this_arg) {
74871         LDKPhantomKeysManager this_arg_conv;
74872         this_arg_conv.inner = untag_ptr(this_arg);
74873         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74875         this_arg_conv.is_owned = false;
74876         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
74877         *ret_ret = PhantomKeysManager_as_EntropySource(&this_arg_conv);
74878         return tag_ptr(ret_ret, true);
74879 }
74880
74881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1NodeSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
74882         LDKPhantomKeysManager this_arg_conv;
74883         this_arg_conv.inner = untag_ptr(this_arg);
74884         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74886         this_arg_conv.is_owned = false;
74887         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
74888         *ret_ret = PhantomKeysManager_as_NodeSigner(&this_arg_conv);
74889         return tag_ptr(ret_ret, true);
74890 }
74891
74892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1SignerProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
74893         LDKPhantomKeysManager this_arg_conv;
74894         this_arg_conv.inner = untag_ptr(this_arg);
74895         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74897         this_arg_conv.is_owned = false;
74898         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
74899         *ret_ret = PhantomKeysManager_as_SignerProvider(&this_arg_conv);
74900         return tag_ptr(ret_ret, true);
74901 }
74902
74903 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) {
74904         uint8_t seed_arr[32];
74905         CHECK((*env)->GetArrayLength(env, seed) == 32);
74906         (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
74907         uint8_t (*seed_ref)[32] = &seed_arr;
74908         uint8_t cross_node_seed_arr[32];
74909         CHECK((*env)->GetArrayLength(env, cross_node_seed) == 32);
74910         (*env)->GetByteArrayRegion(env, cross_node_seed, 0, 32, cross_node_seed_arr);
74911         uint8_t (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
74912         LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
74913         int64_t ret_ref = 0;
74914         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74915         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74916         return ret_ref;
74917 }
74918
74919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1spend_1spendable_1outputs(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray descriptors, int64_tArray outputs, int8_tArray change_destination_script, int32_t feerate_sat_per_1000_weight, int64_t locktime) {
74920         LDKPhantomKeysManager this_arg_conv;
74921         this_arg_conv.inner = untag_ptr(this_arg);
74922         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74924         this_arg_conv.is_owned = false;
74925         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
74926         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
74927         if (descriptors_constr.datalen > 0)
74928                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
74929         else
74930                 descriptors_constr.data = NULL;
74931         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
74932         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
74933                 int64_t descriptors_conv_27 = descriptors_vals[b];
74934                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
74935                 CHECK_ACCESS(descriptors_conv_27_ptr);
74936                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
74937                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
74938                 descriptors_constr.data[b] = descriptors_conv_27_conv;
74939         }
74940         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
74941         LDKCVec_TxOutZ outputs_constr;
74942         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
74943         if (outputs_constr.datalen > 0)
74944                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
74945         else
74946                 outputs_constr.data = NULL;
74947         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
74948         for (size_t h = 0; h < outputs_constr.datalen; h++) {
74949                 int64_t outputs_conv_7 = outputs_vals[h];
74950                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
74951                 CHECK_ACCESS(outputs_conv_7_ptr);
74952                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
74953                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
74954                 outputs_constr.data[h] = outputs_conv_7_conv;
74955         }
74956         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
74957         LDKCVec_u8Z change_destination_script_ref;
74958         change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
74959         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
74960         (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
74961         void* locktime_ptr = untag_ptr(locktime);
74962         CHECK_ACCESS(locktime_ptr);
74963         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
74964         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
74965         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
74966         *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
74967         return tag_ptr(ret_conv, true);
74968 }
74969
74970 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) {
74971         LDKPhantomKeysManager this_arg_conv;
74972         this_arg_conv.inner = untag_ptr(this_arg);
74973         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74975         this_arg_conv.is_owned = false;
74976         uint8_t params_arr[32];
74977         CHECK((*env)->GetArrayLength(env, params) == 32);
74978         (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
74979         uint8_t (*params_ref)[32] = &params_arr;
74980         LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
74981         int64_t ret_ref = 0;
74982         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74983         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74984         return ret_ref;
74985 }
74986
74987 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1get_1node_1secret_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
74988         LDKPhantomKeysManager this_arg_conv;
74989         this_arg_conv.inner = untag_ptr(this_arg);
74990         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74992         this_arg_conv.is_owned = false;
74993         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
74994         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, PhantomKeysManager_get_node_secret_key(&this_arg_conv).bytes);
74995         return ret_arr;
74996 }
74997
74998 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1get_1phantom_1node_1secret_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
74999         LDKPhantomKeysManager this_arg_conv;
75000         this_arg_conv.inner = untag_ptr(this_arg);
75001         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75003         this_arg_conv.is_owned = false;
75004         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
75005         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, PhantomKeysManager_get_phantom_node_secret_key(&this_arg_conv).bytes);
75006         return ret_arr;
75007 }
75008
75009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
75010         if (!ptr_is_owned(this_ptr)) return;
75011         void* this_ptr_ptr = untag_ptr(this_ptr);
75012         CHECK_ACCESS(this_ptr_ptr);
75013         LDKEcdsaChannelSigner this_ptr_conv = *(LDKEcdsaChannelSigner*)(this_ptr_ptr);
75014         FREE(untag_ptr(this_ptr));
75015         EcdsaChannelSigner_free(this_ptr_conv);
75016 }
75017
75018 static inline uint64_t WriteableEcdsaChannelSigner_clone_ptr(LDKWriteableEcdsaChannelSigner *NONNULL_PTR arg) {
75019         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
75020         *ret_ret = WriteableEcdsaChannelSigner_clone(arg);
75021         return tag_ptr(ret_ret, true);
75022 }
75023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
75024         void* arg_ptr = untag_ptr(arg);
75025         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
75026         LDKWriteableEcdsaChannelSigner* arg_conv = (LDKWriteableEcdsaChannelSigner*)arg_ptr;
75027         int64_t ret_conv = WriteableEcdsaChannelSigner_clone_ptr(arg_conv);
75028         return ret_conv;
75029 }
75030
75031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
75032         void* orig_ptr = untag_ptr(orig);
75033         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
75034         LDKWriteableEcdsaChannelSigner* orig_conv = (LDKWriteableEcdsaChannelSigner*)orig_ptr;
75035         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
75036         *ret_ret = WriteableEcdsaChannelSigner_clone(orig_conv);
75037         return tag_ptr(ret_ret, true);
75038 }
75039
75040 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
75041         if (!ptr_is_owned(this_ptr)) return;
75042         void* this_ptr_ptr = untag_ptr(this_ptr);
75043         CHECK_ACCESS(this_ptr_ptr);
75044         LDKWriteableEcdsaChannelSigner this_ptr_conv = *(LDKWriteableEcdsaChannelSigner*)(this_ptr_ptr);
75045         FREE(untag_ptr(this_ptr));
75046         WriteableEcdsaChannelSigner_free(this_ptr_conv);
75047 }
75048
75049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
75050         LDKOnionMessenger this_obj_conv;
75051         this_obj_conv.inner = untag_ptr(this_obj);
75052         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75054         OnionMessenger_free(this_obj_conv);
75055 }
75056
75057 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageRouter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
75058         if (!ptr_is_owned(this_ptr)) return;
75059         void* this_ptr_ptr = untag_ptr(this_ptr);
75060         CHECK_ACCESS(this_ptr_ptr);
75061         LDKMessageRouter this_ptr_conv = *(LDKMessageRouter*)(this_ptr_ptr);
75062         FREE(untag_ptr(this_ptr));
75063         MessageRouter_free(this_ptr_conv);
75064 }
75065
75066 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DefaultMessageRouter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
75067         LDKDefaultMessageRouter this_obj_conv;
75068         this_obj_conv.inner = untag_ptr(this_obj);
75069         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75071         DefaultMessageRouter_free(this_obj_conv);
75072 }
75073
75074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultMessageRouter_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t entropy_source) {
75075         LDKNetworkGraph network_graph_conv;
75076         network_graph_conv.inner = untag_ptr(network_graph);
75077         network_graph_conv.is_owned = ptr_is_owned(network_graph);
75078         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
75079         network_graph_conv.is_owned = false;
75080         void* entropy_source_ptr = untag_ptr(entropy_source);
75081         CHECK_ACCESS(entropy_source_ptr);
75082         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
75083         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
75084                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75085                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
75086         }
75087         LDKDefaultMessageRouter ret_var = DefaultMessageRouter_new(&network_graph_conv, entropy_source_conv);
75088         int64_t ret_ref = 0;
75089         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75090         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75091         return ret_ref;
75092 }
75093
75094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultMessageRouter_1as_1MessageRouter(JNIEnv *env, jclass clz, int64_t this_arg) {
75095         LDKDefaultMessageRouter this_arg_conv;
75096         this_arg_conv.inner = untag_ptr(this_arg);
75097         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75099         this_arg_conv.is_owned = false;
75100         LDKMessageRouter* ret_ret = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
75101         *ret_ret = DefaultMessageRouter_as_MessageRouter(&this_arg_conv);
75102         return tag_ptr(ret_ret, true);
75103 }
75104
75105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
75106         LDKOnionMessagePath this_obj_conv;
75107         this_obj_conv.inner = untag_ptr(this_obj);
75108         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75110         OnionMessagePath_free(this_obj_conv);
75111 }
75112
75113 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1get_1intermediate_1nodes(JNIEnv *env, jclass clz, int64_t this_ptr) {
75114         LDKOnionMessagePath this_ptr_conv;
75115         this_ptr_conv.inner = untag_ptr(this_ptr);
75116         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75118         this_ptr_conv.is_owned = false;
75119         LDKCVec_PublicKeyZ ret_var = OnionMessagePath_get_intermediate_nodes(&this_ptr_conv);
75120         jobjectArray ret_arr = NULL;
75121         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
75122         ;
75123         for (size_t i = 0; i < ret_var.datalen; i++) {
75124                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33);
75125                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
75126                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
75127         }
75128         
75129         FREE(ret_var.data);
75130         return ret_arr;
75131 }
75132
75133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1set_1intermediate_1nodes(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
75134         LDKOnionMessagePath this_ptr_conv;
75135         this_ptr_conv.inner = untag_ptr(this_ptr);
75136         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75138         this_ptr_conv.is_owned = false;
75139         LDKCVec_PublicKeyZ val_constr;
75140         val_constr.datalen = (*env)->GetArrayLength(env, val);
75141         if (val_constr.datalen > 0)
75142                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
75143         else
75144                 val_constr.data = NULL;
75145         for (size_t i = 0; i < val_constr.datalen; i++) {
75146                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
75147                 LDKPublicKey val_conv_8_ref;
75148                 CHECK((*env)->GetArrayLength(env, val_conv_8) == 33);
75149                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 33, val_conv_8_ref.compressed_form);
75150                 val_constr.data[i] = val_conv_8_ref;
75151         }
75152         OnionMessagePath_set_intermediate_nodes(&this_ptr_conv, val_constr);
75153 }
75154
75155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1get_1destination(JNIEnv *env, jclass clz, int64_t this_ptr) {
75156         LDKOnionMessagePath this_ptr_conv;
75157         this_ptr_conv.inner = untag_ptr(this_ptr);
75158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75160         this_ptr_conv.is_owned = false;
75161         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
75162         *ret_copy = OnionMessagePath_get_destination(&this_ptr_conv);
75163         int64_t ret_ref = tag_ptr(ret_copy, true);
75164         return ret_ref;
75165 }
75166
75167 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1set_1destination(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
75168         LDKOnionMessagePath this_ptr_conv;
75169         this_ptr_conv.inner = untag_ptr(this_ptr);
75170         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75172         this_ptr_conv.is_owned = false;
75173         void* val_ptr = untag_ptr(val);
75174         CHECK_ACCESS(val_ptr);
75175         LDKDestination val_conv = *(LDKDestination*)(val_ptr);
75176         val_conv = Destination_clone((LDKDestination*)untag_ptr(val));
75177         OnionMessagePath_set_destination(&this_ptr_conv, val_conv);
75178 }
75179
75180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1get_1first_1node_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr) {
75181         LDKOnionMessagePath this_ptr_conv;
75182         this_ptr_conv.inner = untag_ptr(this_ptr);
75183         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75185         this_ptr_conv.is_owned = false;
75186         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
75187         *ret_copy = OnionMessagePath_get_first_node_addresses(&this_ptr_conv);
75188         int64_t ret_ref = tag_ptr(ret_copy, true);
75189         return ret_ref;
75190 }
75191
75192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1set_1first_1node_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
75193         LDKOnionMessagePath this_ptr_conv;
75194         this_ptr_conv.inner = untag_ptr(this_ptr);
75195         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75197         this_ptr_conv.is_owned = false;
75198         void* val_ptr = untag_ptr(val);
75199         CHECK_ACCESS(val_ptr);
75200         LDKCOption_CVec_SocketAddressZZ val_conv = *(LDKCOption_CVec_SocketAddressZZ*)(val_ptr);
75201         val_conv = COption_CVec_SocketAddressZZ_clone((LDKCOption_CVec_SocketAddressZZ*)untag_ptr(val));
75202         OnionMessagePath_set_first_node_addresses(&this_ptr_conv, val_conv);
75203 }
75204
75205 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) {
75206         LDKCVec_PublicKeyZ intermediate_nodes_arg_constr;
75207         intermediate_nodes_arg_constr.datalen = (*env)->GetArrayLength(env, intermediate_nodes_arg);
75208         if (intermediate_nodes_arg_constr.datalen > 0)
75209                 intermediate_nodes_arg_constr.data = MALLOC(intermediate_nodes_arg_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
75210         else
75211                 intermediate_nodes_arg_constr.data = NULL;
75212         for (size_t i = 0; i < intermediate_nodes_arg_constr.datalen; i++) {
75213                 int8_tArray intermediate_nodes_arg_conv_8 = (*env)->GetObjectArrayElement(env, intermediate_nodes_arg, i);
75214                 LDKPublicKey intermediate_nodes_arg_conv_8_ref;
75215                 CHECK((*env)->GetArrayLength(env, intermediate_nodes_arg_conv_8) == 33);
75216                 (*env)->GetByteArrayRegion(env, intermediate_nodes_arg_conv_8, 0, 33, intermediate_nodes_arg_conv_8_ref.compressed_form);
75217                 intermediate_nodes_arg_constr.data[i] = intermediate_nodes_arg_conv_8_ref;
75218         }
75219         void* destination_arg_ptr = untag_ptr(destination_arg);
75220         CHECK_ACCESS(destination_arg_ptr);
75221         LDKDestination destination_arg_conv = *(LDKDestination*)(destination_arg_ptr);
75222         destination_arg_conv = Destination_clone((LDKDestination*)untag_ptr(destination_arg));
75223         void* first_node_addresses_arg_ptr = untag_ptr(first_node_addresses_arg);
75224         CHECK_ACCESS(first_node_addresses_arg_ptr);
75225         LDKCOption_CVec_SocketAddressZZ first_node_addresses_arg_conv = *(LDKCOption_CVec_SocketAddressZZ*)(first_node_addresses_arg_ptr);
75226         LDKOnionMessagePath ret_var = OnionMessagePath_new(intermediate_nodes_arg_constr, destination_arg_conv, first_node_addresses_arg_conv);
75227         int64_t ret_ref = 0;
75228         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75229         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75230         return ret_ref;
75231 }
75232
75233 static inline uint64_t OnionMessagePath_clone_ptr(LDKOnionMessagePath *NONNULL_PTR arg) {
75234         LDKOnionMessagePath ret_var = OnionMessagePath_clone(arg);
75235         int64_t ret_ref = 0;
75236         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75237         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75238         return ret_ref;
75239 }
75240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
75241         LDKOnionMessagePath arg_conv;
75242         arg_conv.inner = untag_ptr(arg);
75243         arg_conv.is_owned = ptr_is_owned(arg);
75244         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75245         arg_conv.is_owned = false;
75246         int64_t ret_conv = OnionMessagePath_clone_ptr(&arg_conv);
75247         return ret_conv;
75248 }
75249
75250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1clone(JNIEnv *env, jclass clz, int64_t orig) {
75251         LDKOnionMessagePath orig_conv;
75252         orig_conv.inner = untag_ptr(orig);
75253         orig_conv.is_owned = ptr_is_owned(orig);
75254         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75255         orig_conv.is_owned = false;
75256         LDKOnionMessagePath ret_var = OnionMessagePath_clone(&orig_conv);
75257         int64_t ret_ref = 0;
75258         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75259         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75260         return ret_ref;
75261 }
75262
75263 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1first_1node(JNIEnv *env, jclass clz, int64_t this_arg) {
75264         LDKOnionMessagePath this_arg_conv;
75265         this_arg_conv.inner = untag_ptr(this_arg);
75266         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75268         this_arg_conv.is_owned = false;
75269         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
75270         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OnionMessagePath_first_node(&this_arg_conv).compressed_form);
75271         return ret_arr;
75272 }
75273
75274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Destination_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
75275         if (!ptr_is_owned(this_ptr)) return;
75276         void* this_ptr_ptr = untag_ptr(this_ptr);
75277         CHECK_ACCESS(this_ptr_ptr);
75278         LDKDestination this_ptr_conv = *(LDKDestination*)(this_ptr_ptr);
75279         FREE(untag_ptr(this_ptr));
75280         Destination_free(this_ptr_conv);
75281 }
75282
75283 static inline uint64_t Destination_clone_ptr(LDKDestination *NONNULL_PTR arg) {
75284         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
75285         *ret_copy = Destination_clone(arg);
75286         int64_t ret_ref = tag_ptr(ret_copy, true);
75287         return ret_ref;
75288 }
75289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
75290         LDKDestination* arg_conv = (LDKDestination*)untag_ptr(arg);
75291         int64_t ret_conv = Destination_clone_ptr(arg_conv);
75292         return ret_conv;
75293 }
75294
75295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1clone(JNIEnv *env, jclass clz, int64_t orig) {
75296         LDKDestination* orig_conv = (LDKDestination*)untag_ptr(orig);
75297         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
75298         *ret_copy = Destination_clone(orig_conv);
75299         int64_t ret_ref = tag_ptr(ret_copy, true);
75300         return ret_ref;
75301 }
75302
75303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1node(JNIEnv *env, jclass clz, int8_tArray a) {
75304         LDKPublicKey a_ref;
75305         CHECK((*env)->GetArrayLength(env, a) == 33);
75306         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
75307         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
75308         *ret_copy = Destination_node(a_ref);
75309         int64_t ret_ref = tag_ptr(ret_copy, true);
75310         return ret_ref;
75311 }
75312
75313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1blinded_1path(JNIEnv *env, jclass clz, int64_t a) {
75314         LDKBlindedPath a_conv;
75315         a_conv.inner = untag_ptr(a);
75316         a_conv.is_owned = ptr_is_owned(a);
75317         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75318         a_conv = BlindedPath_clone(&a_conv);
75319         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
75320         *ret_copy = Destination_blinded_path(a_conv);
75321         int64_t ret_ref = tag_ptr(ret_copy, true);
75322         return ret_ref;
75323 }
75324
75325 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SendSuccess_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
75326         if (!ptr_is_owned(this_ptr)) return;
75327         void* this_ptr_ptr = untag_ptr(this_ptr);
75328         CHECK_ACCESS(this_ptr_ptr);
75329         LDKSendSuccess this_ptr_conv = *(LDKSendSuccess*)(this_ptr_ptr);
75330         FREE(untag_ptr(this_ptr));
75331         SendSuccess_free(this_ptr_conv);
75332 }
75333
75334 static inline uint64_t SendSuccess_clone_ptr(LDKSendSuccess *NONNULL_PTR arg) {
75335         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
75336         *ret_copy = SendSuccess_clone(arg);
75337         int64_t ret_ref = tag_ptr(ret_copy, true);
75338         return ret_ref;
75339 }
75340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendSuccess_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
75341         LDKSendSuccess* arg_conv = (LDKSendSuccess*)untag_ptr(arg);
75342         int64_t ret_conv = SendSuccess_clone_ptr(arg_conv);
75343         return ret_conv;
75344 }
75345
75346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendSuccess_1clone(JNIEnv *env, jclass clz, int64_t orig) {
75347         LDKSendSuccess* orig_conv = (LDKSendSuccess*)untag_ptr(orig);
75348         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
75349         *ret_copy = SendSuccess_clone(orig_conv);
75350         int64_t ret_ref = tag_ptr(ret_copy, true);
75351         return ret_ref;
75352 }
75353
75354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendSuccess_1buffered(JNIEnv *env, jclass clz) {
75355         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
75356         *ret_copy = SendSuccess_buffered();
75357         int64_t ret_ref = tag_ptr(ret_copy, true);
75358         return ret_ref;
75359 }
75360
75361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendSuccess_1buffered_1awaiting_1connection(JNIEnv *env, jclass clz, int8_tArray a) {
75362         LDKPublicKey a_ref;
75363         CHECK((*env)->GetArrayLength(env, a) == 33);
75364         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
75365         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
75366         *ret_copy = SendSuccess_buffered_awaiting_connection(a_ref);
75367         int64_t ret_ref = tag_ptr(ret_copy, true);
75368         return ret_ref;
75369 }
75370
75371 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SendSuccess_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
75372         LDKSendSuccess* a_conv = (LDKSendSuccess*)untag_ptr(a);
75373         LDKSendSuccess* b_conv = (LDKSendSuccess*)untag_ptr(b);
75374         jboolean ret_conv = SendSuccess_eq(a_conv, b_conv);
75375         return ret_conv;
75376 }
75377
75378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SendError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
75379         if (!ptr_is_owned(this_ptr)) return;
75380         void* this_ptr_ptr = untag_ptr(this_ptr);
75381         CHECK_ACCESS(this_ptr_ptr);
75382         LDKSendError this_ptr_conv = *(LDKSendError*)(this_ptr_ptr);
75383         FREE(untag_ptr(this_ptr));
75384         SendError_free(this_ptr_conv);
75385 }
75386
75387 static inline uint64_t SendError_clone_ptr(LDKSendError *NONNULL_PTR arg) {
75388         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
75389         *ret_copy = SendError_clone(arg);
75390         int64_t ret_ref = tag_ptr(ret_copy, true);
75391         return ret_ref;
75392 }
75393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
75394         LDKSendError* arg_conv = (LDKSendError*)untag_ptr(arg);
75395         int64_t ret_conv = SendError_clone_ptr(arg_conv);
75396         return ret_conv;
75397 }
75398
75399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
75400         LDKSendError* orig_conv = (LDKSendError*)untag_ptr(orig);
75401         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
75402         *ret_copy = SendError_clone(orig_conv);
75403         int64_t ret_ref = tag_ptr(ret_copy, true);
75404         return ret_ref;
75405 }
75406
75407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1secp256k1(JNIEnv *env, jclass clz, jclass a) {
75408         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_java(env, a);
75409         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
75410         *ret_copy = SendError_secp256k1(a_conv);
75411         int64_t ret_ref = tag_ptr(ret_copy, true);
75412         return ret_ref;
75413 }
75414
75415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1too_1big_1packet(JNIEnv *env, jclass clz) {
75416         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
75417         *ret_copy = SendError_too_big_packet();
75418         int64_t ret_ref = tag_ptr(ret_copy, true);
75419         return ret_ref;
75420 }
75421
75422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1too_1few_1blinded_1hops(JNIEnv *env, jclass clz) {
75423         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
75424         *ret_copy = SendError_too_few_blinded_hops();
75425         int64_t ret_ref = tag_ptr(ret_copy, true);
75426         return ret_ref;
75427 }
75428
75429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1invalid_1first_1hop(JNIEnv *env, jclass clz, int8_tArray a) {
75430         LDKPublicKey a_ref;
75431         CHECK((*env)->GetArrayLength(env, a) == 33);
75432         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
75433         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
75434         *ret_copy = SendError_invalid_first_hop(a_ref);
75435         int64_t ret_ref = tag_ptr(ret_copy, true);
75436         return ret_ref;
75437 }
75438
75439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1path_1not_1found(JNIEnv *env, jclass clz) {
75440         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
75441         *ret_copy = SendError_path_not_found();
75442         int64_t ret_ref = tag_ptr(ret_copy, true);
75443         return ret_ref;
75444 }
75445
75446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1invalid_1message(JNIEnv *env, jclass clz) {
75447         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
75448         *ret_copy = SendError_invalid_message();
75449         int64_t ret_ref = tag_ptr(ret_copy, true);
75450         return ret_ref;
75451 }
75452
75453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1buffer_1full(JNIEnv *env, jclass clz) {
75454         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
75455         *ret_copy = SendError_buffer_full();
75456         int64_t ret_ref = tag_ptr(ret_copy, true);
75457         return ret_ref;
75458 }
75459
75460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1get_1node_1id_1failed(JNIEnv *env, jclass clz) {
75461         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
75462         *ret_copy = SendError_get_node_id_failed();
75463         int64_t ret_ref = tag_ptr(ret_copy, true);
75464         return ret_ref;
75465 }
75466
75467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1blinded_1path_1advance_1failed(JNIEnv *env, jclass clz) {
75468         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
75469         *ret_copy = SendError_blinded_path_advance_failed();
75470         int64_t ret_ref = tag_ptr(ret_copy, true);
75471         return ret_ref;
75472 }
75473
75474 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SendError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
75475         LDKSendError* a_conv = (LDKSendError*)untag_ptr(a);
75476         LDKSendError* b_conv = (LDKSendError*)untag_ptr(b);
75477         jboolean ret_conv = SendError_eq(a_conv, b_conv);
75478         return ret_conv;
75479 }
75480
75481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
75482         if (!ptr_is_owned(this_ptr)) return;
75483         void* this_ptr_ptr = untag_ptr(this_ptr);
75484         CHECK_ACCESS(this_ptr_ptr);
75485         LDKCustomOnionMessageHandler this_ptr_conv = *(LDKCustomOnionMessageHandler*)(this_ptr_ptr);
75486         FREE(untag_ptr(this_ptr));
75487         CustomOnionMessageHandler_free(this_ptr_conv);
75488 }
75489
75490 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeeledOnion_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
75491         if (!ptr_is_owned(this_ptr)) return;
75492         void* this_ptr_ptr = untag_ptr(this_ptr);
75493         CHECK_ACCESS(this_ptr_ptr);
75494         LDKPeeledOnion this_ptr_conv = *(LDKPeeledOnion*)(this_ptr_ptr);
75495         FREE(untag_ptr(this_ptr));
75496         PeeledOnion_free(this_ptr_conv);
75497 }
75498
75499 static inline uint64_t PeeledOnion_clone_ptr(LDKPeeledOnion *NONNULL_PTR arg) {
75500         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
75501         *ret_copy = PeeledOnion_clone(arg);
75502         int64_t ret_ref = tag_ptr(ret_copy, true);
75503         return ret_ref;
75504 }
75505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeeledOnion_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
75506         LDKPeeledOnion* arg_conv = (LDKPeeledOnion*)untag_ptr(arg);
75507         int64_t ret_conv = PeeledOnion_clone_ptr(arg_conv);
75508         return ret_conv;
75509 }
75510
75511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeeledOnion_1clone(JNIEnv *env, jclass clz, int64_t orig) {
75512         LDKPeeledOnion* orig_conv = (LDKPeeledOnion*)untag_ptr(orig);
75513         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
75514         *ret_copy = PeeledOnion_clone(orig_conv);
75515         int64_t ret_ref = tag_ptr(ret_copy, true);
75516         return ret_ref;
75517 }
75518
75519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeeledOnion_1forward(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
75520         LDKPublicKey a_ref;
75521         CHECK((*env)->GetArrayLength(env, a) == 33);
75522         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
75523         LDKOnionMessage b_conv;
75524         b_conv.inner = untag_ptr(b);
75525         b_conv.is_owned = ptr_is_owned(b);
75526         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75527         b_conv = OnionMessage_clone(&b_conv);
75528         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
75529         *ret_copy = PeeledOnion_forward(a_ref, b_conv);
75530         int64_t ret_ref = tag_ptr(ret_copy, true);
75531         return ret_ref;
75532 }
75533
75534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeeledOnion_1receive(JNIEnv *env, jclass clz, int64_t a, int8_tArray b, int64_t c) {
75535         void* a_ptr = untag_ptr(a);
75536         CHECK_ACCESS(a_ptr);
75537         LDKParsedOnionMessageContents a_conv = *(LDKParsedOnionMessageContents*)(a_ptr);
75538         a_conv = ParsedOnionMessageContents_clone((LDKParsedOnionMessageContents*)untag_ptr(a));
75539         LDKThirtyTwoBytes b_ref;
75540         CHECK((*env)->GetArrayLength(env, b) == 32);
75541         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
75542         LDKBlindedPath c_conv;
75543         c_conv.inner = untag_ptr(c);
75544         c_conv.is_owned = ptr_is_owned(c);
75545         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
75546         c_conv = BlindedPath_clone(&c_conv);
75547         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
75548         *ret_copy = PeeledOnion_receive(a_conv, b_ref, c_conv);
75549         int64_t ret_ref = tag_ptr(ret_copy, true);
75550         return ret_ref;
75551 }
75552
75553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1onion_1message(JNIEnv *env, jclass clz, int64_t entropy_source, int64_t node_signer, int64_t path, int64_t contents, int64_t reply_path) {
75554         void* entropy_source_ptr = untag_ptr(entropy_source);
75555         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
75556         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
75557         void* node_signer_ptr = untag_ptr(node_signer);
75558         if (ptr_is_owned(node_signer)) { CHECK_ACCESS(node_signer_ptr); }
75559         LDKNodeSigner* node_signer_conv = (LDKNodeSigner*)node_signer_ptr;
75560         LDKOnionMessagePath path_conv;
75561         path_conv.inner = untag_ptr(path);
75562         path_conv.is_owned = ptr_is_owned(path);
75563         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
75564         path_conv = OnionMessagePath_clone(&path_conv);
75565         void* contents_ptr = untag_ptr(contents);
75566         CHECK_ACCESS(contents_ptr);
75567         LDKOnionMessageContents contents_conv = *(LDKOnionMessageContents*)(contents_ptr);
75568         if (contents_conv.free == LDKOnionMessageContents_JCalls_free) {
75569                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75570                 LDKOnionMessageContents_JCalls_cloned(&contents_conv);
75571         }
75572         LDKBlindedPath reply_path_conv;
75573         reply_path_conv.inner = untag_ptr(reply_path);
75574         reply_path_conv.is_owned = ptr_is_owned(reply_path);
75575         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
75576         reply_path_conv = BlindedPath_clone(&reply_path_conv);
75577         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
75578         *ret_conv = create_onion_message(entropy_source_conv, node_signer_conv, path_conv, contents_conv, reply_path_conv);
75579         return tag_ptr(ret_conv, true);
75580 }
75581
75582 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) {
75583         LDKOnionMessage msg_conv;
75584         msg_conv.inner = untag_ptr(msg);
75585         msg_conv.is_owned = ptr_is_owned(msg);
75586         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
75587         msg_conv.is_owned = false;
75588         void* node_signer_ptr = untag_ptr(node_signer);
75589         CHECK_ACCESS(node_signer_ptr);
75590         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
75591         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
75592                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75593                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
75594         }
75595         void* logger_ptr = untag_ptr(logger);
75596         CHECK_ACCESS(logger_ptr);
75597         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
75598         if (logger_conv.free == LDKLogger_JCalls_free) {
75599                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75600                 LDKLogger_JCalls_cloned(&logger_conv);
75601         }
75602         void* custom_handler_ptr = untag_ptr(custom_handler);
75603         CHECK_ACCESS(custom_handler_ptr);
75604         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
75605         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
75606                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75607                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
75608         }
75609         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
75610         *ret_conv = peel_onion_message(&msg_conv, node_signer_conv, logger_conv, custom_handler_conv);
75611         return tag_ptr(ret_conv, true);
75612 }
75613
75614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1new(JNIEnv *env, jclass clz, int64_t entropy_source, int64_t node_signer, int64_t logger, int64_t message_router, int64_t offers_handler, int64_t custom_handler) {
75615         void* entropy_source_ptr = untag_ptr(entropy_source);
75616         CHECK_ACCESS(entropy_source_ptr);
75617         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
75618         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
75619                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75620                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
75621         }
75622         void* node_signer_ptr = untag_ptr(node_signer);
75623         CHECK_ACCESS(node_signer_ptr);
75624         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
75625         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
75626                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75627                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
75628         }
75629         void* logger_ptr = untag_ptr(logger);
75630         CHECK_ACCESS(logger_ptr);
75631         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
75632         if (logger_conv.free == LDKLogger_JCalls_free) {
75633                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75634                 LDKLogger_JCalls_cloned(&logger_conv);
75635         }
75636         void* message_router_ptr = untag_ptr(message_router);
75637         CHECK_ACCESS(message_router_ptr);
75638         LDKMessageRouter message_router_conv = *(LDKMessageRouter*)(message_router_ptr);
75639         if (message_router_conv.free == LDKMessageRouter_JCalls_free) {
75640                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75641                 LDKMessageRouter_JCalls_cloned(&message_router_conv);
75642         }
75643         void* offers_handler_ptr = untag_ptr(offers_handler);
75644         CHECK_ACCESS(offers_handler_ptr);
75645         LDKOffersMessageHandler offers_handler_conv = *(LDKOffersMessageHandler*)(offers_handler_ptr);
75646         if (offers_handler_conv.free == LDKOffersMessageHandler_JCalls_free) {
75647                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75648                 LDKOffersMessageHandler_JCalls_cloned(&offers_handler_conv);
75649         }
75650         void* custom_handler_ptr = untag_ptr(custom_handler);
75651         CHECK_ACCESS(custom_handler_ptr);
75652         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
75653         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
75654                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75655                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
75656         }
75657         LDKOnionMessenger ret_var = OnionMessenger_new(entropy_source_conv, node_signer_conv, logger_conv, message_router_conv, offers_handler_conv, custom_handler_conv);
75658         int64_t ret_ref = 0;
75659         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75660         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75661         return ret_ref;
75662 }
75663
75664 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) {
75665         LDKOnionMessenger this_arg_conv;
75666         this_arg_conv.inner = untag_ptr(this_arg);
75667         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75669         this_arg_conv.is_owned = false;
75670         void* contents_ptr = untag_ptr(contents);
75671         CHECK_ACCESS(contents_ptr);
75672         LDKOnionMessageContents contents_conv = *(LDKOnionMessageContents*)(contents_ptr);
75673         if (contents_conv.free == LDKOnionMessageContents_JCalls_free) {
75674                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75675                 LDKOnionMessageContents_JCalls_cloned(&contents_conv);
75676         }
75677         void* destination_ptr = untag_ptr(destination);
75678         CHECK_ACCESS(destination_ptr);
75679         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
75680         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
75681         LDKBlindedPath reply_path_conv;
75682         reply_path_conv.inner = untag_ptr(reply_path);
75683         reply_path_conv.is_owned = ptr_is_owned(reply_path);
75684         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
75685         reply_path_conv = BlindedPath_clone(&reply_path_conv);
75686         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
75687         *ret_conv = OnionMessenger_send_onion_message(&this_arg_conv, contents_conv, destination_conv, reply_path_conv);
75688         return tag_ptr(ret_conv, true);
75689 }
75690
75691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1as_1OnionMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
75692         LDKOnionMessenger this_arg_conv;
75693         this_arg_conv.inner = untag_ptr(this_arg);
75694         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75696         this_arg_conv.is_owned = false;
75697         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
75698         *ret_ret = OnionMessenger_as_OnionMessageHandler(&this_arg_conv);
75699         return tag_ptr(ret_ret, true);
75700 }
75701
75702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OffersMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
75703         if (!ptr_is_owned(this_ptr)) return;
75704         void* this_ptr_ptr = untag_ptr(this_ptr);
75705         CHECK_ACCESS(this_ptr_ptr);
75706         LDKOffersMessageHandler this_ptr_conv = *(LDKOffersMessageHandler*)(this_ptr_ptr);
75707         FREE(untag_ptr(this_ptr));
75708         OffersMessageHandler_free(this_ptr_conv);
75709 }
75710
75711 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OffersMessage_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
75712         if (!ptr_is_owned(this_ptr)) return;
75713         void* this_ptr_ptr = untag_ptr(this_ptr);
75714         CHECK_ACCESS(this_ptr_ptr);
75715         LDKOffersMessage this_ptr_conv = *(LDKOffersMessage*)(this_ptr_ptr);
75716         FREE(untag_ptr(this_ptr));
75717         OffersMessage_free(this_ptr_conv);
75718 }
75719
75720 static inline uint64_t OffersMessage_clone_ptr(LDKOffersMessage *NONNULL_PTR arg) {
75721         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
75722         *ret_copy = OffersMessage_clone(arg);
75723         int64_t ret_ref = tag_ptr(ret_copy, true);
75724         return ret_ref;
75725 }
75726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
75727         LDKOffersMessage* arg_conv = (LDKOffersMessage*)untag_ptr(arg);
75728         int64_t ret_conv = OffersMessage_clone_ptr(arg_conv);
75729         return ret_conv;
75730 }
75731
75732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
75733         LDKOffersMessage* orig_conv = (LDKOffersMessage*)untag_ptr(orig);
75734         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
75735         *ret_copy = OffersMessage_clone(orig_conv);
75736         int64_t ret_ref = tag_ptr(ret_copy, true);
75737         return ret_ref;
75738 }
75739
75740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1invoice_1request(JNIEnv *env, jclass clz, int64_t a) {
75741         LDKInvoiceRequest a_conv;
75742         a_conv.inner = untag_ptr(a);
75743         a_conv.is_owned = ptr_is_owned(a);
75744         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75745         a_conv = InvoiceRequest_clone(&a_conv);
75746         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
75747         *ret_copy = OffersMessage_invoice_request(a_conv);
75748         int64_t ret_ref = tag_ptr(ret_copy, true);
75749         return ret_ref;
75750 }
75751
75752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1invoice(JNIEnv *env, jclass clz, int64_t a) {
75753         LDKBolt12Invoice a_conv;
75754         a_conv.inner = untag_ptr(a);
75755         a_conv.is_owned = ptr_is_owned(a);
75756         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75757         a_conv = Bolt12Invoice_clone(&a_conv);
75758         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
75759         *ret_copy = OffersMessage_invoice(a_conv);
75760         int64_t ret_ref = tag_ptr(ret_copy, true);
75761         return ret_ref;
75762 }
75763
75764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1invoice_1error(JNIEnv *env, jclass clz, int64_t a) {
75765         LDKInvoiceError a_conv;
75766         a_conv.inner = untag_ptr(a);
75767         a_conv.is_owned = ptr_is_owned(a);
75768         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75769         a_conv = InvoiceError_clone(&a_conv);
75770         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
75771         *ret_copy = OffersMessage_invoice_error(a_conv);
75772         int64_t ret_ref = tag_ptr(ret_copy, true);
75773         return ret_ref;
75774 }
75775
75776 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OffersMessage_1is_1known_1type(JNIEnv *env, jclass clz, int64_t tlv_type) {
75777         jboolean ret_conv = OffersMessage_is_known_type(tlv_type);
75778         return ret_conv;
75779 }
75780
75781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1as_1OnionMessageContents(JNIEnv *env, jclass clz, int64_t this_arg) {
75782         LDKOffersMessage* this_arg_conv = (LDKOffersMessage*)untag_ptr(this_arg);
75783         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
75784         *ret_ret = OffersMessage_as_OnionMessageContents(this_arg_conv);
75785         return tag_ptr(ret_ret, true);
75786 }
75787
75788 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OffersMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
75789         LDKOffersMessage* obj_conv = (LDKOffersMessage*)untag_ptr(obj);
75790         LDKCVec_u8Z ret_var = OffersMessage_write(obj_conv);
75791         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
75792         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
75793         CVec_u8Z_free(ret_var);
75794         return ret_arr;
75795 }
75796
75797 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) {
75798         LDKu8slice ser_ref;
75799         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
75800         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
75801         void* arg_b_ptr = untag_ptr(arg_b);
75802         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
75803         LDKLogger* arg_b_conv = (LDKLogger*)arg_b_ptr;
75804         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
75805         *ret_conv = OffersMessage_read(ser_ref, arg_a, arg_b_conv);
75806         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
75807         return tag_ptr(ret_conv, true);
75808 }
75809
75810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Packet_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
75811         LDKPacket this_obj_conv;
75812         this_obj_conv.inner = untag_ptr(this_obj);
75813         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75815         Packet_free(this_obj_conv);
75816 }
75817
75818 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_Packet_1get_1version(JNIEnv *env, jclass clz, int64_t this_ptr) {
75819         LDKPacket this_ptr_conv;
75820         this_ptr_conv.inner = untag_ptr(this_ptr);
75821         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75823         this_ptr_conv.is_owned = false;
75824         int8_t ret_conv = Packet_get_version(&this_ptr_conv);
75825         return ret_conv;
75826 }
75827
75828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Packet_1set_1version(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
75829         LDKPacket this_ptr_conv;
75830         this_ptr_conv.inner = untag_ptr(this_ptr);
75831         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75833         this_ptr_conv.is_owned = false;
75834         Packet_set_version(&this_ptr_conv, val);
75835 }
75836
75837 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Packet_1get_1public_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
75838         LDKPacket this_ptr_conv;
75839         this_ptr_conv.inner = untag_ptr(this_ptr);
75840         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75842         this_ptr_conv.is_owned = false;
75843         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
75844         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Packet_get_public_key(&this_ptr_conv).compressed_form);
75845         return ret_arr;
75846 }
75847
75848 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Packet_1set_1public_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
75849         LDKPacket this_ptr_conv;
75850         this_ptr_conv.inner = untag_ptr(this_ptr);
75851         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75853         this_ptr_conv.is_owned = false;
75854         LDKPublicKey val_ref;
75855         CHECK((*env)->GetArrayLength(env, val) == 33);
75856         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
75857         Packet_set_public_key(&this_ptr_conv, val_ref);
75858 }
75859
75860 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Packet_1get_1hop_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
75861         LDKPacket this_ptr_conv;
75862         this_ptr_conv.inner = untag_ptr(this_ptr);
75863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75865         this_ptr_conv.is_owned = false;
75866         LDKCVec_u8Z ret_var = Packet_get_hop_data(&this_ptr_conv);
75867         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
75868         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
75869         CVec_u8Z_free(ret_var);
75870         return ret_arr;
75871 }
75872
75873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Packet_1set_1hop_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
75874         LDKPacket this_ptr_conv;
75875         this_ptr_conv.inner = untag_ptr(this_ptr);
75876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75878         this_ptr_conv.is_owned = false;
75879         LDKCVec_u8Z val_ref;
75880         val_ref.datalen = (*env)->GetArrayLength(env, val);
75881         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
75882         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
75883         Packet_set_hop_data(&this_ptr_conv, val_ref);
75884 }
75885
75886 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Packet_1get_1hmac(JNIEnv *env, jclass clz, int64_t this_ptr) {
75887         LDKPacket this_ptr_conv;
75888         this_ptr_conv.inner = untag_ptr(this_ptr);
75889         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75891         this_ptr_conv.is_owned = false;
75892         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
75893         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Packet_get_hmac(&this_ptr_conv));
75894         return ret_arr;
75895 }
75896
75897 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Packet_1set_1hmac(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
75898         LDKPacket this_ptr_conv;
75899         this_ptr_conv.inner = untag_ptr(this_ptr);
75900         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75902         this_ptr_conv.is_owned = false;
75903         LDKThirtyTwoBytes val_ref;
75904         CHECK((*env)->GetArrayLength(env, val) == 32);
75905         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
75906         Packet_set_hmac(&this_ptr_conv, val_ref);
75907 }
75908
75909 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) {
75910         LDKPublicKey public_key_arg_ref;
75911         CHECK((*env)->GetArrayLength(env, public_key_arg) == 33);
75912         (*env)->GetByteArrayRegion(env, public_key_arg, 0, 33, public_key_arg_ref.compressed_form);
75913         LDKCVec_u8Z hop_data_arg_ref;
75914         hop_data_arg_ref.datalen = (*env)->GetArrayLength(env, hop_data_arg);
75915         hop_data_arg_ref.data = MALLOC(hop_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
75916         (*env)->GetByteArrayRegion(env, hop_data_arg, 0, hop_data_arg_ref.datalen, hop_data_arg_ref.data);
75917         LDKThirtyTwoBytes hmac_arg_ref;
75918         CHECK((*env)->GetArrayLength(env, hmac_arg) == 32);
75919         (*env)->GetByteArrayRegion(env, hmac_arg, 0, 32, hmac_arg_ref.data);
75920         LDKPacket ret_var = Packet_new(version_arg, public_key_arg_ref, hop_data_arg_ref, hmac_arg_ref);
75921         int64_t ret_ref = 0;
75922         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75923         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75924         return ret_ref;
75925 }
75926
75927 static inline uint64_t Packet_clone_ptr(LDKPacket *NONNULL_PTR arg) {
75928         LDKPacket ret_var = Packet_clone(arg);
75929         int64_t ret_ref = 0;
75930         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75931         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75932         return ret_ref;
75933 }
75934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Packet_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
75935         LDKPacket arg_conv;
75936         arg_conv.inner = untag_ptr(arg);
75937         arg_conv.is_owned = ptr_is_owned(arg);
75938         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75939         arg_conv.is_owned = false;
75940         int64_t ret_conv = Packet_clone_ptr(&arg_conv);
75941         return ret_conv;
75942 }
75943
75944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Packet_1clone(JNIEnv *env, jclass clz, int64_t orig) {
75945         LDKPacket orig_conv;
75946         orig_conv.inner = untag_ptr(orig);
75947         orig_conv.is_owned = ptr_is_owned(orig);
75948         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75949         orig_conv.is_owned = false;
75950         LDKPacket ret_var = Packet_clone(&orig_conv);
75951         int64_t ret_ref = 0;
75952         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75953         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75954         return ret_ref;
75955 }
75956
75957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Packet_1hash(JNIEnv *env, jclass clz, int64_t o) {
75958         LDKPacket o_conv;
75959         o_conv.inner = untag_ptr(o);
75960         o_conv.is_owned = ptr_is_owned(o);
75961         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75962         o_conv.is_owned = false;
75963         int64_t ret_conv = Packet_hash(&o_conv);
75964         return ret_conv;
75965 }
75966
75967 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Packet_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
75968         LDKPacket a_conv;
75969         a_conv.inner = untag_ptr(a);
75970         a_conv.is_owned = ptr_is_owned(a);
75971         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75972         a_conv.is_owned = false;
75973         LDKPacket b_conv;
75974         b_conv.inner = untag_ptr(b);
75975         b_conv.is_owned = ptr_is_owned(b);
75976         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75977         b_conv.is_owned = false;
75978         jboolean ret_conv = Packet_eq(&a_conv, &b_conv);
75979         return ret_conv;
75980 }
75981
75982 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Packet_1write(JNIEnv *env, jclass clz, int64_t obj) {
75983         LDKPacket obj_conv;
75984         obj_conv.inner = untag_ptr(obj);
75985         obj_conv.is_owned = ptr_is_owned(obj);
75986         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
75987         obj_conv.is_owned = false;
75988         LDKCVec_u8Z ret_var = Packet_write(&obj_conv);
75989         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
75990         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
75991         CVec_u8Z_free(ret_var);
75992         return ret_arr;
75993 }
75994
75995 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
75996         if (!ptr_is_owned(this_ptr)) return;
75997         void* this_ptr_ptr = untag_ptr(this_ptr);
75998         CHECK_ACCESS(this_ptr_ptr);
75999         LDKParsedOnionMessageContents this_ptr_conv = *(LDKParsedOnionMessageContents*)(this_ptr_ptr);
76000         FREE(untag_ptr(this_ptr));
76001         ParsedOnionMessageContents_free(this_ptr_conv);
76002 }
76003
76004 static inline uint64_t ParsedOnionMessageContents_clone_ptr(LDKParsedOnionMessageContents *NONNULL_PTR arg) {
76005         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
76006         *ret_copy = ParsedOnionMessageContents_clone(arg);
76007         int64_t ret_ref = tag_ptr(ret_copy, true);
76008         return ret_ref;
76009 }
76010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
76011         LDKParsedOnionMessageContents* arg_conv = (LDKParsedOnionMessageContents*)untag_ptr(arg);
76012         int64_t ret_conv = ParsedOnionMessageContents_clone_ptr(arg_conv);
76013         return ret_conv;
76014 }
76015
76016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1clone(JNIEnv *env, jclass clz, int64_t orig) {
76017         LDKParsedOnionMessageContents* orig_conv = (LDKParsedOnionMessageContents*)untag_ptr(orig);
76018         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
76019         *ret_copy = ParsedOnionMessageContents_clone(orig_conv);
76020         int64_t ret_ref = tag_ptr(ret_copy, true);
76021         return ret_ref;
76022 }
76023
76024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1offers(JNIEnv *env, jclass clz, int64_t a) {
76025         void* a_ptr = untag_ptr(a);
76026         CHECK_ACCESS(a_ptr);
76027         LDKOffersMessage a_conv = *(LDKOffersMessage*)(a_ptr);
76028         a_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(a));
76029         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
76030         *ret_copy = ParsedOnionMessageContents_offers(a_conv);
76031         int64_t ret_ref = tag_ptr(ret_copy, true);
76032         return ret_ref;
76033 }
76034
76035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1custom(JNIEnv *env, jclass clz, int64_t a) {
76036         void* a_ptr = untag_ptr(a);
76037         CHECK_ACCESS(a_ptr);
76038         LDKOnionMessageContents a_conv = *(LDKOnionMessageContents*)(a_ptr);
76039         if (a_conv.free == LDKOnionMessageContents_JCalls_free) {
76040                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76041                 LDKOnionMessageContents_JCalls_cloned(&a_conv);
76042         }
76043         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
76044         *ret_copy = ParsedOnionMessageContents_custom(a_conv);
76045         int64_t ret_ref = tag_ptr(ret_copy, true);
76046         return ret_ref;
76047 }
76048
76049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1as_1OnionMessageContents(JNIEnv *env, jclass clz, int64_t this_arg) {
76050         LDKParsedOnionMessageContents* this_arg_conv = (LDKParsedOnionMessageContents*)untag_ptr(this_arg);
76051         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
76052         *ret_ret = ParsedOnionMessageContents_as_OnionMessageContents(this_arg_conv);
76053         return tag_ptr(ret_ret, true);
76054 }
76055
76056 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1write(JNIEnv *env, jclass clz, int64_t obj) {
76057         LDKParsedOnionMessageContents* obj_conv = (LDKParsedOnionMessageContents*)untag_ptr(obj);
76058         LDKCVec_u8Z ret_var = ParsedOnionMessageContents_write(obj_conv);
76059         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
76060         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
76061         CVec_u8Z_free(ret_var);
76062         return ret_arr;
76063 }
76064
76065 static inline uint64_t OnionMessageContents_clone_ptr(LDKOnionMessageContents *NONNULL_PTR arg) {
76066         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
76067         *ret_ret = OnionMessageContents_clone(arg);
76068         return tag_ptr(ret_ret, true);
76069 }
76070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
76071         void* arg_ptr = untag_ptr(arg);
76072         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
76073         LDKOnionMessageContents* arg_conv = (LDKOnionMessageContents*)arg_ptr;
76074         int64_t ret_conv = OnionMessageContents_clone_ptr(arg_conv);
76075         return ret_conv;
76076 }
76077
76078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1clone(JNIEnv *env, jclass clz, int64_t orig) {
76079         void* orig_ptr = untag_ptr(orig);
76080         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
76081         LDKOnionMessageContents* orig_conv = (LDKOnionMessageContents*)orig_ptr;
76082         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
76083         *ret_ret = OnionMessageContents_clone(orig_conv);
76084         return tag_ptr(ret_ret, true);
76085 }
76086
76087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
76088         if (!ptr_is_owned(this_ptr)) return;
76089         void* this_ptr_ptr = untag_ptr(this_ptr);
76090         CHECK_ACCESS(this_ptr_ptr);
76091         LDKOnionMessageContents this_ptr_conv = *(LDKOnionMessageContents*)(this_ptr_ptr);
76092         FREE(untag_ptr(this_ptr));
76093         OnionMessageContents_free(this_ptr_conv);
76094 }
76095
76096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPath_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
76097         LDKBlindedPath this_obj_conv;
76098         this_obj_conv.inner = untag_ptr(this_obj);
76099         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76101         BlindedPath_free(this_obj_conv);
76102 }
76103
76104 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPath_1get_1introduction_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
76105         LDKBlindedPath this_ptr_conv;
76106         this_ptr_conv.inner = untag_ptr(this_ptr);
76107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76109         this_ptr_conv.is_owned = false;
76110         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
76111         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, BlindedPath_get_introduction_node_id(&this_ptr_conv).compressed_form);
76112         return ret_arr;
76113 }
76114
76115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPath_1set_1introduction_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
76116         LDKBlindedPath this_ptr_conv;
76117         this_ptr_conv.inner = untag_ptr(this_ptr);
76118         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76120         this_ptr_conv.is_owned = false;
76121         LDKPublicKey val_ref;
76122         CHECK((*env)->GetArrayLength(env, val) == 33);
76123         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
76124         BlindedPath_set_introduction_node_id(&this_ptr_conv, val_ref);
76125 }
76126
76127 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPath_1get_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
76128         LDKBlindedPath this_ptr_conv;
76129         this_ptr_conv.inner = untag_ptr(this_ptr);
76130         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76132         this_ptr_conv.is_owned = false;
76133         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
76134         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, BlindedPath_get_blinding_point(&this_ptr_conv).compressed_form);
76135         return ret_arr;
76136 }
76137
76138 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPath_1set_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
76139         LDKBlindedPath this_ptr_conv;
76140         this_ptr_conv.inner = untag_ptr(this_ptr);
76141         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76143         this_ptr_conv.is_owned = false;
76144         LDKPublicKey val_ref;
76145         CHECK((*env)->GetArrayLength(env, val) == 33);
76146         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
76147         BlindedPath_set_blinding_point(&this_ptr_conv, val_ref);
76148 }
76149
76150 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPath_1get_1blinded_1hops(JNIEnv *env, jclass clz, int64_t this_ptr) {
76151         LDKBlindedPath this_ptr_conv;
76152         this_ptr_conv.inner = untag_ptr(this_ptr);
76153         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76155         this_ptr_conv.is_owned = false;
76156         LDKCVec_BlindedHopZ ret_var = BlindedPath_get_blinded_hops(&this_ptr_conv);
76157         int64_tArray ret_arr = NULL;
76158         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
76159         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
76160         for (size_t m = 0; m < ret_var.datalen; m++) {
76161                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
76162                 int64_t ret_conv_12_ref = 0;
76163                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
76164                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
76165                 ret_arr_ptr[m] = ret_conv_12_ref;
76166         }
76167         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
76168         FREE(ret_var.data);
76169         return ret_arr;
76170 }
76171
76172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPath_1set_1blinded_1hops(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
76173         LDKBlindedPath this_ptr_conv;
76174         this_ptr_conv.inner = untag_ptr(this_ptr);
76175         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76177         this_ptr_conv.is_owned = false;
76178         LDKCVec_BlindedHopZ val_constr;
76179         val_constr.datalen = (*env)->GetArrayLength(env, val);
76180         if (val_constr.datalen > 0)
76181                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
76182         else
76183                 val_constr.data = NULL;
76184         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
76185         for (size_t m = 0; m < val_constr.datalen; m++) {
76186                 int64_t val_conv_12 = val_vals[m];
76187                 LDKBlindedHop val_conv_12_conv;
76188                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
76189                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
76190                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
76191                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
76192                 val_constr.data[m] = val_conv_12_conv;
76193         }
76194         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
76195         BlindedPath_set_blinded_hops(&this_ptr_conv, val_constr);
76196 }
76197
76198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1new(JNIEnv *env, jclass clz, int8_tArray introduction_node_id_arg, int8_tArray blinding_point_arg, int64_tArray blinded_hops_arg) {
76199         LDKPublicKey introduction_node_id_arg_ref;
76200         CHECK((*env)->GetArrayLength(env, introduction_node_id_arg) == 33);
76201         (*env)->GetByteArrayRegion(env, introduction_node_id_arg, 0, 33, introduction_node_id_arg_ref.compressed_form);
76202         LDKPublicKey blinding_point_arg_ref;
76203         CHECK((*env)->GetArrayLength(env, blinding_point_arg) == 33);
76204         (*env)->GetByteArrayRegion(env, blinding_point_arg, 0, 33, blinding_point_arg_ref.compressed_form);
76205         LDKCVec_BlindedHopZ blinded_hops_arg_constr;
76206         blinded_hops_arg_constr.datalen = (*env)->GetArrayLength(env, blinded_hops_arg);
76207         if (blinded_hops_arg_constr.datalen > 0)
76208                 blinded_hops_arg_constr.data = MALLOC(blinded_hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
76209         else
76210                 blinded_hops_arg_constr.data = NULL;
76211         int64_t* blinded_hops_arg_vals = (*env)->GetLongArrayElements (env, blinded_hops_arg, NULL);
76212         for (size_t m = 0; m < blinded_hops_arg_constr.datalen; m++) {
76213                 int64_t blinded_hops_arg_conv_12 = blinded_hops_arg_vals[m];
76214                 LDKBlindedHop blinded_hops_arg_conv_12_conv;
76215                 blinded_hops_arg_conv_12_conv.inner = untag_ptr(blinded_hops_arg_conv_12);
76216                 blinded_hops_arg_conv_12_conv.is_owned = ptr_is_owned(blinded_hops_arg_conv_12);
76217                 CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_hops_arg_conv_12_conv);
76218                 blinded_hops_arg_conv_12_conv = BlindedHop_clone(&blinded_hops_arg_conv_12_conv);
76219                 blinded_hops_arg_constr.data[m] = blinded_hops_arg_conv_12_conv;
76220         }
76221         (*env)->ReleaseLongArrayElements(env, blinded_hops_arg, blinded_hops_arg_vals, 0);
76222         LDKBlindedPath ret_var = BlindedPath_new(introduction_node_id_arg_ref, blinding_point_arg_ref, blinded_hops_arg_constr);
76223         int64_t ret_ref = 0;
76224         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76225         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76226         return ret_ref;
76227 }
76228
76229 static inline uint64_t BlindedPath_clone_ptr(LDKBlindedPath *NONNULL_PTR arg) {
76230         LDKBlindedPath ret_var = BlindedPath_clone(arg);
76231         int64_t ret_ref = 0;
76232         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76233         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76234         return ret_ref;
76235 }
76236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
76237         LDKBlindedPath arg_conv;
76238         arg_conv.inner = untag_ptr(arg);
76239         arg_conv.is_owned = ptr_is_owned(arg);
76240         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
76241         arg_conv.is_owned = false;
76242         int64_t ret_conv = BlindedPath_clone_ptr(&arg_conv);
76243         return ret_conv;
76244 }
76245
76246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1clone(JNIEnv *env, jclass clz, int64_t orig) {
76247         LDKBlindedPath orig_conv;
76248         orig_conv.inner = untag_ptr(orig);
76249         orig_conv.is_owned = ptr_is_owned(orig);
76250         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
76251         orig_conv.is_owned = false;
76252         LDKBlindedPath ret_var = BlindedPath_clone(&orig_conv);
76253         int64_t ret_ref = 0;
76254         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76255         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76256         return ret_ref;
76257 }
76258
76259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1hash(JNIEnv *env, jclass clz, int64_t o) {
76260         LDKBlindedPath o_conv;
76261         o_conv.inner = untag_ptr(o);
76262         o_conv.is_owned = ptr_is_owned(o);
76263         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
76264         o_conv.is_owned = false;
76265         int64_t ret_conv = BlindedPath_hash(&o_conv);
76266         return ret_conv;
76267 }
76268
76269 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedPath_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
76270         LDKBlindedPath a_conv;
76271         a_conv.inner = untag_ptr(a);
76272         a_conv.is_owned = ptr_is_owned(a);
76273         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
76274         a_conv.is_owned = false;
76275         LDKBlindedPath b_conv;
76276         b_conv.inner = untag_ptr(b);
76277         b_conv.is_owned = ptr_is_owned(b);
76278         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
76279         b_conv.is_owned = false;
76280         jboolean ret_conv = BlindedPath_eq(&a_conv, &b_conv);
76281         return ret_conv;
76282 }
76283
76284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
76285         LDKBlindedHop this_obj_conv;
76286         this_obj_conv.inner = untag_ptr(this_obj);
76287         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76289         BlindedHop_free(this_obj_conv);
76290 }
76291
76292 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedHop_1get_1blinded_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
76293         LDKBlindedHop this_ptr_conv;
76294         this_ptr_conv.inner = untag_ptr(this_ptr);
76295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76297         this_ptr_conv.is_owned = false;
76298         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
76299         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, BlindedHop_get_blinded_node_id(&this_ptr_conv).compressed_form);
76300         return ret_arr;
76301 }
76302
76303 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedHop_1set_1blinded_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
76304         LDKBlindedHop this_ptr_conv;
76305         this_ptr_conv.inner = untag_ptr(this_ptr);
76306         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76308         this_ptr_conv.is_owned = false;
76309         LDKPublicKey val_ref;
76310         CHECK((*env)->GetArrayLength(env, val) == 33);
76311         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
76312         BlindedHop_set_blinded_node_id(&this_ptr_conv, val_ref);
76313 }
76314
76315 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedHop_1get_1encrypted_1payload(JNIEnv *env, jclass clz, int64_t this_ptr) {
76316         LDKBlindedHop this_ptr_conv;
76317         this_ptr_conv.inner = untag_ptr(this_ptr);
76318         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76320         this_ptr_conv.is_owned = false;
76321         LDKCVec_u8Z ret_var = BlindedHop_get_encrypted_payload(&this_ptr_conv);
76322         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
76323         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
76324         CVec_u8Z_free(ret_var);
76325         return ret_arr;
76326 }
76327
76328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedHop_1set_1encrypted_1payload(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
76329         LDKBlindedHop this_ptr_conv;
76330         this_ptr_conv.inner = untag_ptr(this_ptr);
76331         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76333         this_ptr_conv.is_owned = false;
76334         LDKCVec_u8Z val_ref;
76335         val_ref.datalen = (*env)->GetArrayLength(env, val);
76336         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
76337         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
76338         BlindedHop_set_encrypted_payload(&this_ptr_conv, val_ref);
76339 }
76340
76341 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) {
76342         LDKPublicKey blinded_node_id_arg_ref;
76343         CHECK((*env)->GetArrayLength(env, blinded_node_id_arg) == 33);
76344         (*env)->GetByteArrayRegion(env, blinded_node_id_arg, 0, 33, blinded_node_id_arg_ref.compressed_form);
76345         LDKCVec_u8Z encrypted_payload_arg_ref;
76346         encrypted_payload_arg_ref.datalen = (*env)->GetArrayLength(env, encrypted_payload_arg);
76347         encrypted_payload_arg_ref.data = MALLOC(encrypted_payload_arg_ref.datalen, "LDKCVec_u8Z Bytes");
76348         (*env)->GetByteArrayRegion(env, encrypted_payload_arg, 0, encrypted_payload_arg_ref.datalen, encrypted_payload_arg_ref.data);
76349         LDKBlindedHop ret_var = BlindedHop_new(blinded_node_id_arg_ref, encrypted_payload_arg_ref);
76350         int64_t ret_ref = 0;
76351         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76352         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76353         return ret_ref;
76354 }
76355
76356 static inline uint64_t BlindedHop_clone_ptr(LDKBlindedHop *NONNULL_PTR arg) {
76357         LDKBlindedHop ret_var = BlindedHop_clone(arg);
76358         int64_t ret_ref = 0;
76359         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76360         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76361         return ret_ref;
76362 }
76363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
76364         LDKBlindedHop arg_conv;
76365         arg_conv.inner = untag_ptr(arg);
76366         arg_conv.is_owned = ptr_is_owned(arg);
76367         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
76368         arg_conv.is_owned = false;
76369         int64_t ret_conv = BlindedHop_clone_ptr(&arg_conv);
76370         return ret_conv;
76371 }
76372
76373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
76374         LDKBlindedHop orig_conv;
76375         orig_conv.inner = untag_ptr(orig);
76376         orig_conv.is_owned = ptr_is_owned(orig);
76377         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
76378         orig_conv.is_owned = false;
76379         LDKBlindedHop ret_var = BlindedHop_clone(&orig_conv);
76380         int64_t ret_ref = 0;
76381         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76382         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76383         return ret_ref;
76384 }
76385
76386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
76387         LDKBlindedHop o_conv;
76388         o_conv.inner = untag_ptr(o);
76389         o_conv.is_owned = ptr_is_owned(o);
76390         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
76391         o_conv.is_owned = false;
76392         int64_t ret_conv = BlindedHop_hash(&o_conv);
76393         return ret_conv;
76394 }
76395
76396 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
76397         LDKBlindedHop a_conv;
76398         a_conv.inner = untag_ptr(a);
76399         a_conv.is_owned = ptr_is_owned(a);
76400         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
76401         a_conv.is_owned = false;
76402         LDKBlindedHop b_conv;
76403         b_conv.inner = untag_ptr(b);
76404         b_conv.is_owned = ptr_is_owned(b);
76405         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
76406         b_conv.is_owned = false;
76407         jboolean ret_conv = BlindedHop_eq(&a_conv, &b_conv);
76408         return ret_conv;
76409 }
76410
76411 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) {
76412         LDKPublicKey recipient_node_id_ref;
76413         CHECK((*env)->GetArrayLength(env, recipient_node_id) == 33);
76414         (*env)->GetByteArrayRegion(env, recipient_node_id, 0, 33, recipient_node_id_ref.compressed_form);
76415         void* entropy_source_ptr = untag_ptr(entropy_source);
76416         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
76417         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
76418         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
76419         *ret_conv = BlindedPath_one_hop_for_message(recipient_node_id_ref, entropy_source_conv);
76420         return tag_ptr(ret_conv, true);
76421 }
76422
76423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1new_1for_1message(JNIEnv *env, jclass clz, jobjectArray node_pks, int64_t entropy_source) {
76424         LDKCVec_PublicKeyZ node_pks_constr;
76425         node_pks_constr.datalen = (*env)->GetArrayLength(env, node_pks);
76426         if (node_pks_constr.datalen > 0)
76427                 node_pks_constr.data = MALLOC(node_pks_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
76428         else
76429                 node_pks_constr.data = NULL;
76430         for (size_t i = 0; i < node_pks_constr.datalen; i++) {
76431                 int8_tArray node_pks_conv_8 = (*env)->GetObjectArrayElement(env, node_pks, i);
76432                 LDKPublicKey node_pks_conv_8_ref;
76433                 CHECK((*env)->GetArrayLength(env, node_pks_conv_8) == 33);
76434                 (*env)->GetByteArrayRegion(env, node_pks_conv_8, 0, 33, node_pks_conv_8_ref.compressed_form);
76435                 node_pks_constr.data[i] = node_pks_conv_8_ref;
76436         }
76437         void* entropy_source_ptr = untag_ptr(entropy_source);
76438         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
76439         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
76440         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
76441         *ret_conv = BlindedPath_new_for_message(node_pks_constr, entropy_source_conv);
76442         return tag_ptr(ret_conv, true);
76443 }
76444
76445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1one_1hop_1for_1payment(JNIEnv *env, jclass clz, int8_tArray payee_node_id, int64_t payee_tlvs, int64_t entropy_source) {
76446         LDKPublicKey payee_node_id_ref;
76447         CHECK((*env)->GetArrayLength(env, payee_node_id) == 33);
76448         (*env)->GetByteArrayRegion(env, payee_node_id, 0, 33, payee_node_id_ref.compressed_form);
76449         LDKReceiveTlvs payee_tlvs_conv;
76450         payee_tlvs_conv.inner = untag_ptr(payee_tlvs);
76451         payee_tlvs_conv.is_owned = ptr_is_owned(payee_tlvs);
76452         CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_tlvs_conv);
76453         payee_tlvs_conv = ReceiveTlvs_clone(&payee_tlvs_conv);
76454         void* entropy_source_ptr = untag_ptr(entropy_source);
76455         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
76456         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
76457         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
76458         *ret_conv = BlindedPath_one_hop_for_payment(payee_node_id_ref, payee_tlvs_conv, entropy_source_conv);
76459         return tag_ptr(ret_conv, true);
76460 }
76461
76462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1new_1for_1payment(JNIEnv *env, jclass clz, int64_tArray intermediate_nodes, int8_tArray payee_node_id, int64_t payee_tlvs, int64_t htlc_maximum_msat, int64_t entropy_source) {
76463         LDKCVec_ForwardNodeZ intermediate_nodes_constr;
76464         intermediate_nodes_constr.datalen = (*env)->GetArrayLength(env, intermediate_nodes);
76465         if (intermediate_nodes_constr.datalen > 0)
76466                 intermediate_nodes_constr.data = MALLOC(intermediate_nodes_constr.datalen * sizeof(LDKForwardNode), "LDKCVec_ForwardNodeZ Elements");
76467         else
76468                 intermediate_nodes_constr.data = NULL;
76469         int64_t* intermediate_nodes_vals = (*env)->GetLongArrayElements (env, intermediate_nodes, NULL);
76470         for (size_t n = 0; n < intermediate_nodes_constr.datalen; n++) {
76471                 int64_t intermediate_nodes_conv_13 = intermediate_nodes_vals[n];
76472                 LDKForwardNode intermediate_nodes_conv_13_conv;
76473                 intermediate_nodes_conv_13_conv.inner = untag_ptr(intermediate_nodes_conv_13);
76474                 intermediate_nodes_conv_13_conv.is_owned = ptr_is_owned(intermediate_nodes_conv_13);
76475                 CHECK_INNER_FIELD_ACCESS_OR_NULL(intermediate_nodes_conv_13_conv);
76476                 intermediate_nodes_conv_13_conv = ForwardNode_clone(&intermediate_nodes_conv_13_conv);
76477                 intermediate_nodes_constr.data[n] = intermediate_nodes_conv_13_conv;
76478         }
76479         (*env)->ReleaseLongArrayElements(env, intermediate_nodes, intermediate_nodes_vals, 0);
76480         LDKPublicKey payee_node_id_ref;
76481         CHECK((*env)->GetArrayLength(env, payee_node_id) == 33);
76482         (*env)->GetByteArrayRegion(env, payee_node_id, 0, 33, payee_node_id_ref.compressed_form);
76483         LDKReceiveTlvs payee_tlvs_conv;
76484         payee_tlvs_conv.inner = untag_ptr(payee_tlvs);
76485         payee_tlvs_conv.is_owned = ptr_is_owned(payee_tlvs);
76486         CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_tlvs_conv);
76487         payee_tlvs_conv = ReceiveTlvs_clone(&payee_tlvs_conv);
76488         void* entropy_source_ptr = untag_ptr(entropy_source);
76489         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
76490         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
76491         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
76492         *ret_conv = BlindedPath_new_for_payment(intermediate_nodes_constr, payee_node_id_ref, payee_tlvs_conv, htlc_maximum_msat, entropy_source_conv);
76493         return tag_ptr(ret_conv, true);
76494 }
76495
76496 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPath_1write(JNIEnv *env, jclass clz, int64_t obj) {
76497         LDKBlindedPath obj_conv;
76498         obj_conv.inner = untag_ptr(obj);
76499         obj_conv.is_owned = ptr_is_owned(obj);
76500         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
76501         obj_conv.is_owned = false;
76502         LDKCVec_u8Z ret_var = BlindedPath_write(&obj_conv);
76503         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
76504         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
76505         CVec_u8Z_free(ret_var);
76506         return ret_arr;
76507 }
76508
76509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
76510         LDKu8slice ser_ref;
76511         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
76512         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
76513         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
76514         *ret_conv = BlindedPath_read(ser_ref);
76515         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
76516         return tag_ptr(ret_conv, true);
76517 }
76518
76519 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
76520         LDKBlindedHop obj_conv;
76521         obj_conv.inner = untag_ptr(obj);
76522         obj_conv.is_owned = ptr_is_owned(obj);
76523         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
76524         obj_conv.is_owned = false;
76525         LDKCVec_u8Z ret_var = BlindedHop_write(&obj_conv);
76526         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
76527         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
76528         CVec_u8Z_free(ret_var);
76529         return ret_arr;
76530 }
76531
76532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
76533         LDKu8slice ser_ref;
76534         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
76535         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
76536         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
76537         *ret_conv = BlindedHop_read(ser_ref);
76538         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
76539         return tag_ptr(ret_conv, true);
76540 }
76541
76542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardNode_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
76543         LDKForwardNode this_obj_conv;
76544         this_obj_conv.inner = untag_ptr(this_obj);
76545         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76547         ForwardNode_free(this_obj_conv);
76548 }
76549
76550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardNode_1get_1tlvs(JNIEnv *env, jclass clz, int64_t this_ptr) {
76551         LDKForwardNode this_ptr_conv;
76552         this_ptr_conv.inner = untag_ptr(this_ptr);
76553         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76555         this_ptr_conv.is_owned = false;
76556         LDKForwardTlvs ret_var = ForwardNode_get_tlvs(&this_ptr_conv);
76557         int64_t ret_ref = 0;
76558         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76559         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76560         return ret_ref;
76561 }
76562
76563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardNode_1set_1tlvs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
76564         LDKForwardNode this_ptr_conv;
76565         this_ptr_conv.inner = untag_ptr(this_ptr);
76566         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76568         this_ptr_conv.is_owned = false;
76569         LDKForwardTlvs val_conv;
76570         val_conv.inner = untag_ptr(val);
76571         val_conv.is_owned = ptr_is_owned(val);
76572         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
76573         val_conv = ForwardTlvs_clone(&val_conv);
76574         ForwardNode_set_tlvs(&this_ptr_conv, val_conv);
76575 }
76576
76577 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ForwardNode_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
76578         LDKForwardNode this_ptr_conv;
76579         this_ptr_conv.inner = untag_ptr(this_ptr);
76580         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76582         this_ptr_conv.is_owned = false;
76583         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
76584         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ForwardNode_get_node_id(&this_ptr_conv).compressed_form);
76585         return ret_arr;
76586 }
76587
76588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardNode_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
76589         LDKForwardNode this_ptr_conv;
76590         this_ptr_conv.inner = untag_ptr(this_ptr);
76591         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76593         this_ptr_conv.is_owned = false;
76594         LDKPublicKey val_ref;
76595         CHECK((*env)->GetArrayLength(env, val) == 33);
76596         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
76597         ForwardNode_set_node_id(&this_ptr_conv, val_ref);
76598 }
76599
76600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardNode_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
76601         LDKForwardNode this_ptr_conv;
76602         this_ptr_conv.inner = untag_ptr(this_ptr);
76603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76605         this_ptr_conv.is_owned = false;
76606         int64_t ret_conv = ForwardNode_get_htlc_maximum_msat(&this_ptr_conv);
76607         return ret_conv;
76608 }
76609
76610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardNode_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
76611         LDKForwardNode this_ptr_conv;
76612         this_ptr_conv.inner = untag_ptr(this_ptr);
76613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76615         this_ptr_conv.is_owned = false;
76616         ForwardNode_set_htlc_maximum_msat(&this_ptr_conv, val);
76617 }
76618
76619 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) {
76620         LDKForwardTlvs tlvs_arg_conv;
76621         tlvs_arg_conv.inner = untag_ptr(tlvs_arg);
76622         tlvs_arg_conv.is_owned = ptr_is_owned(tlvs_arg);
76623         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_arg_conv);
76624         tlvs_arg_conv = ForwardTlvs_clone(&tlvs_arg_conv);
76625         LDKPublicKey node_id_arg_ref;
76626         CHECK((*env)->GetArrayLength(env, node_id_arg) == 33);
76627         (*env)->GetByteArrayRegion(env, node_id_arg, 0, 33, node_id_arg_ref.compressed_form);
76628         LDKForwardNode ret_var = ForwardNode_new(tlvs_arg_conv, node_id_arg_ref, htlc_maximum_msat_arg);
76629         int64_t ret_ref = 0;
76630         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76631         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76632         return ret_ref;
76633 }
76634
76635 static inline uint64_t ForwardNode_clone_ptr(LDKForwardNode *NONNULL_PTR arg) {
76636         LDKForwardNode ret_var = ForwardNode_clone(arg);
76637         int64_t ret_ref = 0;
76638         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76639         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76640         return ret_ref;
76641 }
76642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardNode_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
76643         LDKForwardNode arg_conv;
76644         arg_conv.inner = untag_ptr(arg);
76645         arg_conv.is_owned = ptr_is_owned(arg);
76646         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
76647         arg_conv.is_owned = false;
76648         int64_t ret_conv = ForwardNode_clone_ptr(&arg_conv);
76649         return ret_conv;
76650 }
76651
76652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardNode_1clone(JNIEnv *env, jclass clz, int64_t orig) {
76653         LDKForwardNode orig_conv;
76654         orig_conv.inner = untag_ptr(orig);
76655         orig_conv.is_owned = ptr_is_owned(orig);
76656         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
76657         orig_conv.is_owned = false;
76658         LDKForwardNode ret_var = ForwardNode_clone(&orig_conv);
76659         int64_t ret_ref = 0;
76660         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76661         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76662         return ret_ref;
76663 }
76664
76665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
76666         LDKForwardTlvs this_obj_conv;
76667         this_obj_conv.inner = untag_ptr(this_obj);
76668         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76670         ForwardTlvs_free(this_obj_conv);
76671 }
76672
76673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
76674         LDKForwardTlvs this_ptr_conv;
76675         this_ptr_conv.inner = untag_ptr(this_ptr);
76676         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76678         this_ptr_conv.is_owned = false;
76679         int64_t ret_conv = ForwardTlvs_get_short_channel_id(&this_ptr_conv);
76680         return ret_conv;
76681 }
76682
76683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
76684         LDKForwardTlvs this_ptr_conv;
76685         this_ptr_conv.inner = untag_ptr(this_ptr);
76686         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76688         this_ptr_conv.is_owned = false;
76689         ForwardTlvs_set_short_channel_id(&this_ptr_conv, val);
76690 }
76691
76692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1get_1payment_1relay(JNIEnv *env, jclass clz, int64_t this_ptr) {
76693         LDKForwardTlvs this_ptr_conv;
76694         this_ptr_conv.inner = untag_ptr(this_ptr);
76695         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76697         this_ptr_conv.is_owned = false;
76698         LDKPaymentRelay ret_var = ForwardTlvs_get_payment_relay(&this_ptr_conv);
76699         int64_t ret_ref = 0;
76700         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76701         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76702         return ret_ref;
76703 }
76704
76705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1set_1payment_1relay(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
76706         LDKForwardTlvs this_ptr_conv;
76707         this_ptr_conv.inner = untag_ptr(this_ptr);
76708         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76710         this_ptr_conv.is_owned = false;
76711         LDKPaymentRelay val_conv;
76712         val_conv.inner = untag_ptr(val);
76713         val_conv.is_owned = ptr_is_owned(val);
76714         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
76715         val_conv = PaymentRelay_clone(&val_conv);
76716         ForwardTlvs_set_payment_relay(&this_ptr_conv, val_conv);
76717 }
76718
76719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1get_1payment_1constraints(JNIEnv *env, jclass clz, int64_t this_ptr) {
76720         LDKForwardTlvs this_ptr_conv;
76721         this_ptr_conv.inner = untag_ptr(this_ptr);
76722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76724         this_ptr_conv.is_owned = false;
76725         LDKPaymentConstraints ret_var = ForwardTlvs_get_payment_constraints(&this_ptr_conv);
76726         int64_t ret_ref = 0;
76727         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76728         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76729         return ret_ref;
76730 }
76731
76732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1set_1payment_1constraints(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
76733         LDKForwardTlvs 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         LDKPaymentConstraints val_conv;
76739         val_conv.inner = untag_ptr(val);
76740         val_conv.is_owned = ptr_is_owned(val);
76741         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
76742         val_conv = PaymentConstraints_clone(&val_conv);
76743         ForwardTlvs_set_payment_constraints(&this_ptr_conv, val_conv);
76744 }
76745
76746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
76747         LDKForwardTlvs this_ptr_conv;
76748         this_ptr_conv.inner = untag_ptr(this_ptr);
76749         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76751         this_ptr_conv.is_owned = false;
76752         LDKBlindedHopFeatures ret_var = ForwardTlvs_get_features(&this_ptr_conv);
76753         int64_t ret_ref = 0;
76754         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76755         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76756         return ret_ref;
76757 }
76758
76759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
76760         LDKForwardTlvs this_ptr_conv;
76761         this_ptr_conv.inner = untag_ptr(this_ptr);
76762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76764         this_ptr_conv.is_owned = false;
76765         LDKBlindedHopFeatures val_conv;
76766         val_conv.inner = untag_ptr(val);
76767         val_conv.is_owned = ptr_is_owned(val);
76768         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
76769         val_conv = BlindedHopFeatures_clone(&val_conv);
76770         ForwardTlvs_set_features(&this_ptr_conv, val_conv);
76771 }
76772
76773 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) {
76774         LDKPaymentRelay payment_relay_arg_conv;
76775         payment_relay_arg_conv.inner = untag_ptr(payment_relay_arg);
76776         payment_relay_arg_conv.is_owned = ptr_is_owned(payment_relay_arg);
76777         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_relay_arg_conv);
76778         payment_relay_arg_conv = PaymentRelay_clone(&payment_relay_arg_conv);
76779         LDKPaymentConstraints payment_constraints_arg_conv;
76780         payment_constraints_arg_conv.inner = untag_ptr(payment_constraints_arg);
76781         payment_constraints_arg_conv.is_owned = ptr_is_owned(payment_constraints_arg);
76782         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_constraints_arg_conv);
76783         payment_constraints_arg_conv = PaymentConstraints_clone(&payment_constraints_arg_conv);
76784         LDKBlindedHopFeatures features_arg_conv;
76785         features_arg_conv.inner = untag_ptr(features_arg);
76786         features_arg_conv.is_owned = ptr_is_owned(features_arg);
76787         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
76788         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
76789         LDKForwardTlvs ret_var = ForwardTlvs_new(short_channel_id_arg, payment_relay_arg_conv, payment_constraints_arg_conv, features_arg_conv);
76790         int64_t ret_ref = 0;
76791         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76792         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76793         return ret_ref;
76794 }
76795
76796 static inline uint64_t ForwardTlvs_clone_ptr(LDKForwardTlvs *NONNULL_PTR arg) {
76797         LDKForwardTlvs ret_var = ForwardTlvs_clone(arg);
76798         int64_t ret_ref = 0;
76799         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76800         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76801         return ret_ref;
76802 }
76803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
76804         LDKForwardTlvs arg_conv;
76805         arg_conv.inner = untag_ptr(arg);
76806         arg_conv.is_owned = ptr_is_owned(arg);
76807         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
76808         arg_conv.is_owned = false;
76809         int64_t ret_conv = ForwardTlvs_clone_ptr(&arg_conv);
76810         return ret_conv;
76811 }
76812
76813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1clone(JNIEnv *env, jclass clz, int64_t orig) {
76814         LDKForwardTlvs orig_conv;
76815         orig_conv.inner = untag_ptr(orig);
76816         orig_conv.is_owned = ptr_is_owned(orig);
76817         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
76818         orig_conv.is_owned = false;
76819         LDKForwardTlvs ret_var = ForwardTlvs_clone(&orig_conv);
76820         int64_t ret_ref = 0;
76821         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76822         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76823         return ret_ref;
76824 }
76825
76826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
76827         LDKReceiveTlvs this_obj_conv;
76828         this_obj_conv.inner = untag_ptr(this_obj);
76829         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76831         ReceiveTlvs_free(this_obj_conv);
76832 }
76833
76834 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1get_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
76835         LDKReceiveTlvs this_ptr_conv;
76836         this_ptr_conv.inner = untag_ptr(this_ptr);
76837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76839         this_ptr_conv.is_owned = false;
76840         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
76841         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReceiveTlvs_get_payment_secret(&this_ptr_conv));
76842         return ret_arr;
76843 }
76844
76845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1set_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
76846         LDKReceiveTlvs this_ptr_conv;
76847         this_ptr_conv.inner = untag_ptr(this_ptr);
76848         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76850         this_ptr_conv.is_owned = false;
76851         LDKThirtyTwoBytes val_ref;
76852         CHECK((*env)->GetArrayLength(env, val) == 32);
76853         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
76854         ReceiveTlvs_set_payment_secret(&this_ptr_conv, val_ref);
76855 }
76856
76857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1get_1payment_1constraints(JNIEnv *env, jclass clz, int64_t this_ptr) {
76858         LDKReceiveTlvs this_ptr_conv;
76859         this_ptr_conv.inner = untag_ptr(this_ptr);
76860         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76862         this_ptr_conv.is_owned = false;
76863         LDKPaymentConstraints ret_var = ReceiveTlvs_get_payment_constraints(&this_ptr_conv);
76864         int64_t ret_ref = 0;
76865         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76866         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76867         return ret_ref;
76868 }
76869
76870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1set_1payment_1constraints(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
76871         LDKReceiveTlvs this_ptr_conv;
76872         this_ptr_conv.inner = untag_ptr(this_ptr);
76873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76875         this_ptr_conv.is_owned = false;
76876         LDKPaymentConstraints val_conv;
76877         val_conv.inner = untag_ptr(val);
76878         val_conv.is_owned = ptr_is_owned(val);
76879         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
76880         val_conv = PaymentConstraints_clone(&val_conv);
76881         ReceiveTlvs_set_payment_constraints(&this_ptr_conv, val_conv);
76882 }
76883
76884 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) {
76885         LDKThirtyTwoBytes payment_secret_arg_ref;
76886         CHECK((*env)->GetArrayLength(env, payment_secret_arg) == 32);
76887         (*env)->GetByteArrayRegion(env, payment_secret_arg, 0, 32, payment_secret_arg_ref.data);
76888         LDKPaymentConstraints payment_constraints_arg_conv;
76889         payment_constraints_arg_conv.inner = untag_ptr(payment_constraints_arg);
76890         payment_constraints_arg_conv.is_owned = ptr_is_owned(payment_constraints_arg);
76891         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_constraints_arg_conv);
76892         payment_constraints_arg_conv = PaymentConstraints_clone(&payment_constraints_arg_conv);
76893         LDKReceiveTlvs ret_var = ReceiveTlvs_new(payment_secret_arg_ref, payment_constraints_arg_conv);
76894         int64_t ret_ref = 0;
76895         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76896         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76897         return ret_ref;
76898 }
76899
76900 static inline uint64_t ReceiveTlvs_clone_ptr(LDKReceiveTlvs *NONNULL_PTR arg) {
76901         LDKReceiveTlvs ret_var = ReceiveTlvs_clone(arg);
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 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
76908         LDKReceiveTlvs arg_conv;
76909         arg_conv.inner = untag_ptr(arg);
76910         arg_conv.is_owned = ptr_is_owned(arg);
76911         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
76912         arg_conv.is_owned = false;
76913         int64_t ret_conv = ReceiveTlvs_clone_ptr(&arg_conv);
76914         return ret_conv;
76915 }
76916
76917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1clone(JNIEnv *env, jclass clz, int64_t orig) {
76918         LDKReceiveTlvs orig_conv;
76919         orig_conv.inner = untag_ptr(orig);
76920         orig_conv.is_owned = ptr_is_owned(orig);
76921         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
76922         orig_conv.is_owned = false;
76923         LDKReceiveTlvs ret_var = ReceiveTlvs_clone(&orig_conv);
76924         int64_t ret_ref = 0;
76925         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76926         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76927         return ret_ref;
76928 }
76929
76930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
76931         LDKPaymentRelay this_obj_conv;
76932         this_obj_conv.inner = untag_ptr(this_obj);
76933         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76935         PaymentRelay_free(this_obj_conv);
76936 }
76937
76938 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
76939         LDKPaymentRelay this_ptr_conv;
76940         this_ptr_conv.inner = untag_ptr(this_ptr);
76941         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76943         this_ptr_conv.is_owned = false;
76944         int16_t ret_conv = PaymentRelay_get_cltv_expiry_delta(&this_ptr_conv);
76945         return ret_conv;
76946 }
76947
76948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
76949         LDKPaymentRelay this_ptr_conv;
76950         this_ptr_conv.inner = untag_ptr(this_ptr);
76951         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76953         this_ptr_conv.is_owned = false;
76954         PaymentRelay_set_cltv_expiry_delta(&this_ptr_conv, val);
76955 }
76956
76957 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
76958         LDKPaymentRelay this_ptr_conv;
76959         this_ptr_conv.inner = untag_ptr(this_ptr);
76960         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76962         this_ptr_conv.is_owned = false;
76963         int32_t ret_conv = PaymentRelay_get_fee_proportional_millionths(&this_ptr_conv);
76964         return ret_conv;
76965 }
76966
76967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
76968         LDKPaymentRelay this_ptr_conv;
76969         this_ptr_conv.inner = untag_ptr(this_ptr);
76970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76972         this_ptr_conv.is_owned = false;
76973         PaymentRelay_set_fee_proportional_millionths(&this_ptr_conv, val);
76974 }
76975
76976 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
76977         LDKPaymentRelay this_ptr_conv;
76978         this_ptr_conv.inner = untag_ptr(this_ptr);
76979         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76981         this_ptr_conv.is_owned = false;
76982         int32_t ret_conv = PaymentRelay_get_fee_base_msat(&this_ptr_conv);
76983         return ret_conv;
76984 }
76985
76986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
76987         LDKPaymentRelay this_ptr_conv;
76988         this_ptr_conv.inner = untag_ptr(this_ptr);
76989         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76991         this_ptr_conv.is_owned = false;
76992         PaymentRelay_set_fee_base_msat(&this_ptr_conv, val);
76993 }
76994
76995 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) {
76996         LDKPaymentRelay ret_var = PaymentRelay_new(cltv_expiry_delta_arg, fee_proportional_millionths_arg, fee_base_msat_arg);
76997         int64_t ret_ref = 0;
76998         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76999         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77000         return ret_ref;
77001 }
77002
77003 static inline uint64_t PaymentRelay_clone_ptr(LDKPaymentRelay *NONNULL_PTR arg) {
77004         LDKPaymentRelay ret_var = PaymentRelay_clone(arg);
77005         int64_t ret_ref = 0;
77006         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77007         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77008         return ret_ref;
77009 }
77010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
77011         LDKPaymentRelay arg_conv;
77012         arg_conv.inner = untag_ptr(arg);
77013         arg_conv.is_owned = ptr_is_owned(arg);
77014         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
77015         arg_conv.is_owned = false;
77016         int64_t ret_conv = PaymentRelay_clone_ptr(&arg_conv);
77017         return ret_conv;
77018 }
77019
77020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1clone(JNIEnv *env, jclass clz, int64_t orig) {
77021         LDKPaymentRelay orig_conv;
77022         orig_conv.inner = untag_ptr(orig);
77023         orig_conv.is_owned = ptr_is_owned(orig);
77024         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
77025         orig_conv.is_owned = false;
77026         LDKPaymentRelay ret_var = PaymentRelay_clone(&orig_conv);
77027         int64_t ret_ref = 0;
77028         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77029         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77030         return ret_ref;
77031 }
77032
77033 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
77034         LDKPaymentConstraints this_obj_conv;
77035         this_obj_conv.inner = untag_ptr(this_obj);
77036         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77038         PaymentConstraints_free(this_obj_conv);
77039 }
77040
77041 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1get_1max_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
77042         LDKPaymentConstraints this_ptr_conv;
77043         this_ptr_conv.inner = untag_ptr(this_ptr);
77044         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77046         this_ptr_conv.is_owned = false;
77047         int32_t ret_conv = PaymentConstraints_get_max_cltv_expiry(&this_ptr_conv);
77048         return ret_conv;
77049 }
77050
77051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1set_1max_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
77052         LDKPaymentConstraints this_ptr_conv;
77053         this_ptr_conv.inner = untag_ptr(this_ptr);
77054         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77056         this_ptr_conv.is_owned = false;
77057         PaymentConstraints_set_max_cltv_expiry(&this_ptr_conv, val);
77058 }
77059
77060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
77061         LDKPaymentConstraints this_ptr_conv;
77062         this_ptr_conv.inner = untag_ptr(this_ptr);
77063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77065         this_ptr_conv.is_owned = false;
77066         int64_t ret_conv = PaymentConstraints_get_htlc_minimum_msat(&this_ptr_conv);
77067         return ret_conv;
77068 }
77069
77070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
77071         LDKPaymentConstraints this_ptr_conv;
77072         this_ptr_conv.inner = untag_ptr(this_ptr);
77073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77075         this_ptr_conv.is_owned = false;
77076         PaymentConstraints_set_htlc_minimum_msat(&this_ptr_conv, val);
77077 }
77078
77079 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) {
77080         LDKPaymentConstraints ret_var = PaymentConstraints_new(max_cltv_expiry_arg, htlc_minimum_msat_arg);
77081         int64_t ret_ref = 0;
77082         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77083         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77084         return ret_ref;
77085 }
77086
77087 static inline uint64_t PaymentConstraints_clone_ptr(LDKPaymentConstraints *NONNULL_PTR arg) {
77088         LDKPaymentConstraints ret_var = PaymentConstraints_clone(arg);
77089         int64_t ret_ref = 0;
77090         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77091         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77092         return ret_ref;
77093 }
77094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
77095         LDKPaymentConstraints arg_conv;
77096         arg_conv.inner = untag_ptr(arg);
77097         arg_conv.is_owned = ptr_is_owned(arg);
77098         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
77099         arg_conv.is_owned = false;
77100         int64_t ret_conv = PaymentConstraints_clone_ptr(&arg_conv);
77101         return ret_conv;
77102 }
77103
77104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1clone(JNIEnv *env, jclass clz, int64_t orig) {
77105         LDKPaymentConstraints orig_conv;
77106         orig_conv.inner = untag_ptr(orig);
77107         orig_conv.is_owned = ptr_is_owned(orig);
77108         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
77109         orig_conv.is_owned = false;
77110         LDKPaymentConstraints ret_var = PaymentConstraints_clone(&orig_conv);
77111         int64_t ret_ref = 0;
77112         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77113         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77114         return ret_ref;
77115 }
77116
77117 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1write(JNIEnv *env, jclass clz, int64_t obj) {
77118         LDKForwardTlvs obj_conv;
77119         obj_conv.inner = untag_ptr(obj);
77120         obj_conv.is_owned = ptr_is_owned(obj);
77121         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
77122         obj_conv.is_owned = false;
77123         LDKCVec_u8Z ret_var = ForwardTlvs_write(&obj_conv);
77124         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
77125         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
77126         CVec_u8Z_free(ret_var);
77127         return ret_arr;
77128 }
77129
77130 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1write(JNIEnv *env, jclass clz, int64_t obj) {
77131         LDKReceiveTlvs obj_conv;
77132         obj_conv.inner = untag_ptr(obj);
77133         obj_conv.is_owned = ptr_is_owned(obj);
77134         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
77135         obj_conv.is_owned = false;
77136         LDKCVec_u8Z ret_var = ReceiveTlvs_write(&obj_conv);
77137         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
77138         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
77139         CVec_u8Z_free(ret_var);
77140         return ret_arr;
77141 }
77142
77143 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1write(JNIEnv *env, jclass clz, int64_t obj) {
77144         LDKPaymentRelay obj_conv;
77145         obj_conv.inner = untag_ptr(obj);
77146         obj_conv.is_owned = ptr_is_owned(obj);
77147         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
77148         obj_conv.is_owned = false;
77149         LDKCVec_u8Z ret_var = PaymentRelay_write(&obj_conv);
77150         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
77151         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
77152         CVec_u8Z_free(ret_var);
77153         return ret_arr;
77154 }
77155
77156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
77157         LDKu8slice ser_ref;
77158         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
77159         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
77160         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
77161         *ret_conv = PaymentRelay_read(ser_ref);
77162         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
77163         return tag_ptr(ret_conv, true);
77164 }
77165
77166 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1write(JNIEnv *env, jclass clz, int64_t obj) {
77167         LDKPaymentConstraints obj_conv;
77168         obj_conv.inner = untag_ptr(obj);
77169         obj_conv.is_owned = ptr_is_owned(obj);
77170         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
77171         obj_conv.is_owned = false;
77172         LDKCVec_u8Z ret_var = PaymentConstraints_write(&obj_conv);
77173         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
77174         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
77175         CVec_u8Z_free(ret_var);
77176         return ret_arr;
77177 }
77178
77179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
77180         LDKu8slice ser_ref;
77181         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
77182         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
77183         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
77184         *ret_conv = PaymentConstraints_read(ser_ref);
77185         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
77186         return tag_ptr(ret_conv, true);
77187 }
77188
77189 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
77190         if (!ptr_is_owned(this_ptr)) return;
77191         void* this_ptr_ptr = untag_ptr(this_ptr);
77192         CHECK_ACCESS(this_ptr_ptr);
77193         LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
77194         FREE(untag_ptr(this_ptr));
77195         PaymentPurpose_free(this_ptr_conv);
77196 }
77197
77198 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
77199         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
77200         *ret_copy = PaymentPurpose_clone(arg);
77201         int64_t ret_ref = tag_ptr(ret_copy, true);
77202         return ret_ref;
77203 }
77204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
77205         LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)untag_ptr(arg);
77206         int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
77207         return ret_conv;
77208 }
77209
77210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone(JNIEnv *env, jclass clz, int64_t orig) {
77211         LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)untag_ptr(orig);
77212         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
77213         *ret_copy = PaymentPurpose_clone(orig_conv);
77214         int64_t ret_ref = tag_ptr(ret_copy, true);
77215         return ret_ref;
77216 }
77217
77218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1invoice_1payment(JNIEnv *env, jclass clz, int64_t payment_preimage, int8_tArray payment_secret) {
77219         void* payment_preimage_ptr = untag_ptr(payment_preimage);
77220         CHECK_ACCESS(payment_preimage_ptr);
77221         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
77222         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
77223         LDKThirtyTwoBytes payment_secret_ref;
77224         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
77225         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
77226         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
77227         *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_conv, payment_secret_ref);
77228         int64_t ret_ref = tag_ptr(ret_copy, true);
77229         return ret_ref;
77230 }
77231
77232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1spontaneous_1payment(JNIEnv *env, jclass clz, int8_tArray a) {
77233         LDKThirtyTwoBytes a_ref;
77234         CHECK((*env)->GetArrayLength(env, a) == 32);
77235         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
77236         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
77237         *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
77238         int64_t ret_ref = tag_ptr(ret_copy, true);
77239         return ret_ref;
77240 }
77241
77242 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
77243         LDKPaymentPurpose* a_conv = (LDKPaymentPurpose*)untag_ptr(a);
77244         LDKPaymentPurpose* b_conv = (LDKPaymentPurpose*)untag_ptr(b);
77245         jboolean ret_conv = PaymentPurpose_eq(a_conv, b_conv);
77246         return ret_conv;
77247 }
77248
77249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1preimage(JNIEnv *env, jclass clz, int64_t this_arg) {
77250         LDKPaymentPurpose* this_arg_conv = (LDKPaymentPurpose*)untag_ptr(this_arg);
77251         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
77252         *ret_copy = PaymentPurpose_preimage(this_arg_conv);
77253         int64_t ret_ref = tag_ptr(ret_copy, true);
77254         return ret_ref;
77255 }
77256
77257 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1write(JNIEnv *env, jclass clz, int64_t obj) {
77258         LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj);
77259         LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
77260         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
77261         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
77262         CVec_u8Z_free(ret_var);
77263         return ret_arr;
77264 }
77265
77266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
77267         LDKu8slice ser_ref;
77268         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
77269         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
77270         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
77271         *ret_conv = PaymentPurpose_read(ser_ref);
77272         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
77273         return tag_ptr(ret_conv, true);
77274 }
77275
77276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
77277         LDKClaimedHTLC this_obj_conv;
77278         this_obj_conv.inner = untag_ptr(this_obj);
77279         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77281         ClaimedHTLC_free(this_obj_conv);
77282 }
77283
77284 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
77285         LDKClaimedHTLC this_ptr_conv;
77286         this_ptr_conv.inner = untag_ptr(this_ptr);
77287         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77289         this_ptr_conv.is_owned = false;
77290         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
77291         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClaimedHTLC_get_channel_id(&this_ptr_conv));
77292         return ret_arr;
77293 }
77294
77295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
77296         LDKClaimedHTLC this_ptr_conv;
77297         this_ptr_conv.inner = untag_ptr(this_ptr);
77298         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77300         this_ptr_conv.is_owned = false;
77301         LDKThirtyTwoBytes val_ref;
77302         CHECK((*env)->GetArrayLength(env, val) == 32);
77303         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
77304         ClaimedHTLC_set_channel_id(&this_ptr_conv, val_ref);
77305 }
77306
77307 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1get_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
77308         LDKClaimedHTLC this_ptr_conv;
77309         this_ptr_conv.inner = untag_ptr(this_ptr);
77310         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77312         this_ptr_conv.is_owned = false;
77313         int8_tArray ret_arr = (*env)->NewByteArray(env, 16);
77314         (*env)->SetByteArrayRegion(env, ret_arr, 0, 16, ClaimedHTLC_get_user_channel_id(&this_ptr_conv).le_bytes);
77315         return ret_arr;
77316 }
77317
77318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1set_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
77319         LDKClaimedHTLC this_ptr_conv;
77320         this_ptr_conv.inner = untag_ptr(this_ptr);
77321         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77323         this_ptr_conv.is_owned = false;
77324         LDKU128 val_ref;
77325         CHECK((*env)->GetArrayLength(env, val) == 16);
77326         (*env)->GetByteArrayRegion(env, val, 0, 16, val_ref.le_bytes);
77327         ClaimedHTLC_set_user_channel_id(&this_ptr_conv, val_ref);
77328 }
77329
77330 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
77331         LDKClaimedHTLC this_ptr_conv;
77332         this_ptr_conv.inner = untag_ptr(this_ptr);
77333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77335         this_ptr_conv.is_owned = false;
77336         int32_t ret_conv = ClaimedHTLC_get_cltv_expiry(&this_ptr_conv);
77337         return ret_conv;
77338 }
77339
77340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
77341         LDKClaimedHTLC this_ptr_conv;
77342         this_ptr_conv.inner = untag_ptr(this_ptr);
77343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77345         this_ptr_conv.is_owned = false;
77346         ClaimedHTLC_set_cltv_expiry(&this_ptr_conv, val);
77347 }
77348
77349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1get_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
77350         LDKClaimedHTLC this_ptr_conv;
77351         this_ptr_conv.inner = untag_ptr(this_ptr);
77352         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77354         this_ptr_conv.is_owned = false;
77355         int64_t ret_conv = ClaimedHTLC_get_value_msat(&this_ptr_conv);
77356         return ret_conv;
77357 }
77358
77359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1set_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
77360         LDKClaimedHTLC this_ptr_conv;
77361         this_ptr_conv.inner = untag_ptr(this_ptr);
77362         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77364         this_ptr_conv.is_owned = false;
77365         ClaimedHTLC_set_value_msat(&this_ptr_conv, val);
77366 }
77367
77368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1get_1counterparty_1skimmed_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
77369         LDKClaimedHTLC this_ptr_conv;
77370         this_ptr_conv.inner = untag_ptr(this_ptr);
77371         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77373         this_ptr_conv.is_owned = false;
77374         int64_t ret_conv = ClaimedHTLC_get_counterparty_skimmed_fee_msat(&this_ptr_conv);
77375         return ret_conv;
77376 }
77377
77378 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) {
77379         LDKClaimedHTLC this_ptr_conv;
77380         this_ptr_conv.inner = untag_ptr(this_ptr);
77381         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77383         this_ptr_conv.is_owned = false;
77384         ClaimedHTLC_set_counterparty_skimmed_fee_msat(&this_ptr_conv, val);
77385 }
77386
77387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray user_channel_id_arg, int32_t cltv_expiry_arg, int64_t value_msat_arg, int64_t counterparty_skimmed_fee_msat_arg) {
77388         LDKThirtyTwoBytes channel_id_arg_ref;
77389         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
77390         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
77391         LDKU128 user_channel_id_arg_ref;
77392         CHECK((*env)->GetArrayLength(env, user_channel_id_arg) == 16);
77393         (*env)->GetByteArrayRegion(env, user_channel_id_arg, 0, 16, user_channel_id_arg_ref.le_bytes);
77394         LDKClaimedHTLC ret_var = ClaimedHTLC_new(channel_id_arg_ref, user_channel_id_arg_ref, cltv_expiry_arg, value_msat_arg, counterparty_skimmed_fee_msat_arg);
77395         int64_t ret_ref = 0;
77396         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77397         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77398         return ret_ref;
77399 }
77400
77401 static inline uint64_t ClaimedHTLC_clone_ptr(LDKClaimedHTLC *NONNULL_PTR arg) {
77402         LDKClaimedHTLC ret_var = ClaimedHTLC_clone(arg);
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 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
77409         LDKClaimedHTLC arg_conv;
77410         arg_conv.inner = untag_ptr(arg);
77411         arg_conv.is_owned = ptr_is_owned(arg);
77412         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
77413         arg_conv.is_owned = false;
77414         int64_t ret_conv = ClaimedHTLC_clone_ptr(&arg_conv);
77415         return ret_conv;
77416 }
77417
77418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
77419         LDKClaimedHTLC orig_conv;
77420         orig_conv.inner = untag_ptr(orig);
77421         orig_conv.is_owned = ptr_is_owned(orig);
77422         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
77423         orig_conv.is_owned = false;
77424         LDKClaimedHTLC ret_var = ClaimedHTLC_clone(&orig_conv);
77425         int64_t ret_ref = 0;
77426         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77427         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77428         return ret_ref;
77429 }
77430
77431 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
77432         LDKClaimedHTLC a_conv;
77433         a_conv.inner = untag_ptr(a);
77434         a_conv.is_owned = ptr_is_owned(a);
77435         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
77436         a_conv.is_owned = false;
77437         LDKClaimedHTLC b_conv;
77438         b_conv.inner = untag_ptr(b);
77439         b_conv.is_owned = ptr_is_owned(b);
77440         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
77441         b_conv.is_owned = false;
77442         jboolean ret_conv = ClaimedHTLC_eq(&a_conv, &b_conv);
77443         return ret_conv;
77444 }
77445
77446 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
77447         LDKClaimedHTLC obj_conv;
77448         obj_conv.inner = untag_ptr(obj);
77449         obj_conv.is_owned = ptr_is_owned(obj);
77450         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
77451         obj_conv.is_owned = false;
77452         LDKCVec_u8Z ret_var = ClaimedHTLC_write(&obj_conv);
77453         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
77454         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
77455         CVec_u8Z_free(ret_var);
77456         return ret_arr;
77457 }
77458
77459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
77460         LDKu8slice ser_ref;
77461         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
77462         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
77463         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
77464         *ret_conv = ClaimedHTLC_read(ser_ref);
77465         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
77466         return tag_ptr(ret_conv, true);
77467 }
77468
77469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PathFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
77470         if (!ptr_is_owned(this_ptr)) return;
77471         void* this_ptr_ptr = untag_ptr(this_ptr);
77472         CHECK_ACCESS(this_ptr_ptr);
77473         LDKPathFailure this_ptr_conv = *(LDKPathFailure*)(this_ptr_ptr);
77474         FREE(untag_ptr(this_ptr));
77475         PathFailure_free(this_ptr_conv);
77476 }
77477
77478 static inline uint64_t PathFailure_clone_ptr(LDKPathFailure *NONNULL_PTR arg) {
77479         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
77480         *ret_copy = PathFailure_clone(arg);
77481         int64_t ret_ref = tag_ptr(ret_copy, true);
77482         return ret_ref;
77483 }
77484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
77485         LDKPathFailure* arg_conv = (LDKPathFailure*)untag_ptr(arg);
77486         int64_t ret_conv = PathFailure_clone_ptr(arg_conv);
77487         return ret_conv;
77488 }
77489
77490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
77491         LDKPathFailure* orig_conv = (LDKPathFailure*)untag_ptr(orig);
77492         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
77493         *ret_copy = PathFailure_clone(orig_conv);
77494         int64_t ret_ref = tag_ptr(ret_copy, true);
77495         return ret_ref;
77496 }
77497
77498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1initial_1send(JNIEnv *env, jclass clz, int64_t err) {
77499         void* err_ptr = untag_ptr(err);
77500         CHECK_ACCESS(err_ptr);
77501         LDKAPIError err_conv = *(LDKAPIError*)(err_ptr);
77502         err_conv = APIError_clone((LDKAPIError*)untag_ptr(err));
77503         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
77504         *ret_copy = PathFailure_initial_send(err_conv);
77505         int64_t ret_ref = tag_ptr(ret_copy, true);
77506         return ret_ref;
77507 }
77508
77509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1on_1path(JNIEnv *env, jclass clz, int64_t network_update) {
77510         void* network_update_ptr = untag_ptr(network_update);
77511         CHECK_ACCESS(network_update_ptr);
77512         LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
77513         network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update));
77514         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
77515         *ret_copy = PathFailure_on_path(network_update_conv);
77516         int64_t ret_ref = tag_ptr(ret_copy, true);
77517         return ret_ref;
77518 }
77519
77520 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PathFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
77521         LDKPathFailure* a_conv = (LDKPathFailure*)untag_ptr(a);
77522         LDKPathFailure* b_conv = (LDKPathFailure*)untag_ptr(b);
77523         jboolean ret_conv = PathFailure_eq(a_conv, b_conv);
77524         return ret_conv;
77525 }
77526
77527 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PathFailure_1write(JNIEnv *env, jclass clz, int64_t obj) {
77528         LDKPathFailure* obj_conv = (LDKPathFailure*)untag_ptr(obj);
77529         LDKCVec_u8Z ret_var = PathFailure_write(obj_conv);
77530         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
77531         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
77532         CVec_u8Z_free(ret_var);
77533         return ret_arr;
77534 }
77535
77536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
77537         LDKu8slice ser_ref;
77538         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
77539         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
77540         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
77541         *ret_conv = PathFailure_read(ser_ref);
77542         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
77543         return tag_ptr(ret_conv, true);
77544 }
77545
77546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosureReason_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
77547         if (!ptr_is_owned(this_ptr)) return;
77548         void* this_ptr_ptr = untag_ptr(this_ptr);
77549         CHECK_ACCESS(this_ptr_ptr);
77550         LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
77551         FREE(untag_ptr(this_ptr));
77552         ClosureReason_free(this_ptr_conv);
77553 }
77554
77555 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
77556         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
77557         *ret_copy = ClosureReason_clone(arg);
77558         int64_t ret_ref = tag_ptr(ret_copy, true);
77559         return ret_ref;
77560 }
77561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
77562         LDKClosureReason* arg_conv = (LDKClosureReason*)untag_ptr(arg);
77563         int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
77564         return ret_conv;
77565 }
77566
77567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone(JNIEnv *env, jclass clz, int64_t orig) {
77568         LDKClosureReason* orig_conv = (LDKClosureReason*)untag_ptr(orig);
77569         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
77570         *ret_copy = ClosureReason_clone(orig_conv);
77571         int64_t ret_ref = tag_ptr(ret_copy, true);
77572         return ret_ref;
77573 }
77574
77575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1force_1closed(JNIEnv *env, jclass clz, int64_t peer_msg) {
77576         LDKUntrustedString peer_msg_conv;
77577         peer_msg_conv.inner = untag_ptr(peer_msg);
77578         peer_msg_conv.is_owned = ptr_is_owned(peer_msg);
77579         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_conv);
77580         peer_msg_conv = UntrustedString_clone(&peer_msg_conv);
77581         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
77582         *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
77583         int64_t ret_ref = tag_ptr(ret_copy, true);
77584         return ret_ref;
77585 }
77586
77587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1holder_1force_1closed(JNIEnv *env, jclass clz) {
77588         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
77589         *ret_copy = ClosureReason_holder_force_closed();
77590         int64_t ret_ref = tag_ptr(ret_copy, true);
77591         return ret_ref;
77592 }
77593
77594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1cooperative_1closure(JNIEnv *env, jclass clz) {
77595         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
77596         *ret_copy = ClosureReason_cooperative_closure();
77597         int64_t ret_ref = tag_ptr(ret_copy, true);
77598         return ret_ref;
77599 }
77600
77601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz) {
77602         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
77603         *ret_copy = ClosureReason_commitment_tx_confirmed();
77604         int64_t ret_ref = tag_ptr(ret_copy, true);
77605         return ret_ref;
77606 }
77607
77608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1funding_1timed_1out(JNIEnv *env, jclass clz) {
77609         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
77610         *ret_copy = ClosureReason_funding_timed_out();
77611         int64_t ret_ref = tag_ptr(ret_copy, true);
77612         return ret_ref;
77613 }
77614
77615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1processing_1error(JNIEnv *env, jclass clz, jstring err) {
77616         LDKStr err_conv = java_to_owned_str(env, err);
77617         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
77618         *ret_copy = ClosureReason_processing_error(err_conv);
77619         int64_t ret_ref = tag_ptr(ret_copy, true);
77620         return ret_ref;
77621 }
77622
77623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1disconnected_1peer(JNIEnv *env, jclass clz) {
77624         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
77625         *ret_copy = ClosureReason_disconnected_peer();
77626         int64_t ret_ref = tag_ptr(ret_copy, true);
77627         return ret_ref;
77628 }
77629
77630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1outdated_1channel_1manager(JNIEnv *env, jclass clz) {
77631         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
77632         *ret_copy = ClosureReason_outdated_channel_manager();
77633         int64_t ret_ref = tag_ptr(ret_copy, true);
77634         return ret_ref;
77635 }
77636
77637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1coop_1closed_1unfunded_1channel(JNIEnv *env, jclass clz) {
77638         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
77639         *ret_copy = ClosureReason_counterparty_coop_closed_unfunded_channel();
77640         int64_t ret_ref = tag_ptr(ret_copy, true);
77641         return ret_ref;
77642 }
77643
77644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1funding_1batch_1closure(JNIEnv *env, jclass clz) {
77645         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
77646         *ret_copy = ClosureReason_funding_batch_closure();
77647         int64_t ret_ref = tag_ptr(ret_copy, true);
77648         return ret_ref;
77649 }
77650
77651 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosureReason_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
77652         LDKClosureReason* a_conv = (LDKClosureReason*)untag_ptr(a);
77653         LDKClosureReason* b_conv = (LDKClosureReason*)untag_ptr(b);
77654         jboolean ret_conv = ClosureReason_eq(a_conv, b_conv);
77655         return ret_conv;
77656 }
77657
77658 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosureReason_1write(JNIEnv *env, jclass clz, int64_t obj) {
77659         LDKClosureReason* obj_conv = (LDKClosureReason*)untag_ptr(obj);
77660         LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
77661         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
77662         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
77663         CVec_u8Z_free(ret_var);
77664         return ret_arr;
77665 }
77666
77667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
77668         LDKu8slice ser_ref;
77669         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
77670         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
77671         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
77672         *ret_conv = ClosureReason_read(ser_ref);
77673         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
77674         return tag_ptr(ret_conv, true);
77675 }
77676
77677 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
77678         if (!ptr_is_owned(this_ptr)) return;
77679         void* this_ptr_ptr = untag_ptr(this_ptr);
77680         CHECK_ACCESS(this_ptr_ptr);
77681         LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
77682         FREE(untag_ptr(this_ptr));
77683         HTLCDestination_free(this_ptr_conv);
77684 }
77685
77686 static inline uint64_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
77687         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
77688         *ret_copy = HTLCDestination_clone(arg);
77689         int64_t ret_ref = tag_ptr(ret_copy, true);
77690         return ret_ref;
77691 }
77692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
77693         LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)untag_ptr(arg);
77694         int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
77695         return ret_conv;
77696 }
77697
77698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1clone(JNIEnv *env, jclass clz, int64_t orig) {
77699         LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)untag_ptr(orig);
77700         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
77701         *ret_copy = HTLCDestination_clone(orig_conv);
77702         int64_t ret_ref = tag_ptr(ret_copy, true);
77703         return ret_ref;
77704 }
77705
77706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1next_1hop_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int8_tArray channel_id) {
77707         LDKPublicKey node_id_ref;
77708         CHECK((*env)->GetArrayLength(env, node_id) == 33);
77709         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
77710         LDKThirtyTwoBytes channel_id_ref;
77711         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
77712         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
77713         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
77714         *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_ref);
77715         int64_t ret_ref = tag_ptr(ret_copy, true);
77716         return ret_ref;
77717 }
77718
77719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1unknown_1next_1hop(JNIEnv *env, jclass clz, int64_t requested_forward_scid) {
77720         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
77721         *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
77722         int64_t ret_ref = tag_ptr(ret_copy, true);
77723         return ret_ref;
77724 }
77725
77726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1invalid_1forward(JNIEnv *env, jclass clz, int64_t requested_forward_scid) {
77727         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
77728         *ret_copy = HTLCDestination_invalid_forward(requested_forward_scid);
77729         int64_t ret_ref = tag_ptr(ret_copy, true);
77730         return ret_ref;
77731 }
77732
77733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1failed_1payment(JNIEnv *env, jclass clz, int8_tArray payment_hash) {
77734         LDKThirtyTwoBytes payment_hash_ref;
77735         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
77736         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
77737         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
77738         *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
77739         int64_t ret_ref = tag_ptr(ret_copy, true);
77740         return ret_ref;
77741 }
77742
77743 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
77744         LDKHTLCDestination* a_conv = (LDKHTLCDestination*)untag_ptr(a);
77745         LDKHTLCDestination* b_conv = (LDKHTLCDestination*)untag_ptr(b);
77746         jboolean ret_conv = HTLCDestination_eq(a_conv, b_conv);
77747         return ret_conv;
77748 }
77749
77750 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1write(JNIEnv *env, jclass clz, int64_t obj) {
77751         LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)untag_ptr(obj);
77752         LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
77753         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
77754         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
77755         CVec_u8Z_free(ret_var);
77756         return ret_arr;
77757 }
77758
77759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
77760         LDKu8slice ser_ref;
77761         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
77762         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
77763         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
77764         *ret_conv = HTLCDestination_read(ser_ref);
77765         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
77766         return tag_ptr(ret_conv, true);
77767 }
77768
77769 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1clone(JNIEnv *env, jclass clz, int64_t orig) {
77770         LDKPaymentFailureReason* orig_conv = (LDKPaymentFailureReason*)untag_ptr(orig);
77771         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_clone(orig_conv));
77772         return ret_conv;
77773 }
77774
77775 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1recipient_1rejected(JNIEnv *env, jclass clz) {
77776         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_recipient_rejected());
77777         return ret_conv;
77778 }
77779
77780 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1user_1abandoned(JNIEnv *env, jclass clz) {
77781         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_user_abandoned());
77782         return ret_conv;
77783 }
77784
77785 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1retries_1exhausted(JNIEnv *env, jclass clz) {
77786         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_retries_exhausted());
77787         return ret_conv;
77788 }
77789
77790 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1payment_1expired(JNIEnv *env, jclass clz) {
77791         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_payment_expired());
77792         return ret_conv;
77793 }
77794
77795 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1route_1not_1found(JNIEnv *env, jclass clz) {
77796         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_route_not_found());
77797         return ret_conv;
77798 }
77799
77800 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1unexpected_1error(JNIEnv *env, jclass clz) {
77801         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_unexpected_error());
77802         return ret_conv;
77803 }
77804
77805 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
77806         LDKPaymentFailureReason* a_conv = (LDKPaymentFailureReason*)untag_ptr(a);
77807         LDKPaymentFailureReason* b_conv = (LDKPaymentFailureReason*)untag_ptr(b);
77808         jboolean ret_conv = PaymentFailureReason_eq(a_conv, b_conv);
77809         return ret_conv;
77810 }
77811
77812 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1write(JNIEnv *env, jclass clz, int64_t obj) {
77813         LDKPaymentFailureReason* obj_conv = (LDKPaymentFailureReason*)untag_ptr(obj);
77814         LDKCVec_u8Z ret_var = PaymentFailureReason_write(obj_conv);
77815         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
77816         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
77817         CVec_u8Z_free(ret_var);
77818         return ret_arr;
77819 }
77820
77821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
77822         LDKu8slice ser_ref;
77823         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
77824         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
77825         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
77826         *ret_conv = PaymentFailureReason_read(ser_ref);
77827         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
77828         return tag_ptr(ret_conv, true);
77829 }
77830
77831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
77832         if (!ptr_is_owned(this_ptr)) return;
77833         void* this_ptr_ptr = untag_ptr(this_ptr);
77834         CHECK_ACCESS(this_ptr_ptr);
77835         LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
77836         FREE(untag_ptr(this_ptr));
77837         Event_free(this_ptr_conv);
77838 }
77839
77840 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
77841         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
77842         *ret_copy = Event_clone(arg);
77843         int64_t ret_ref = tag_ptr(ret_copy, true);
77844         return ret_ref;
77845 }
77846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
77847         LDKEvent* arg_conv = (LDKEvent*)untag_ptr(arg);
77848         int64_t ret_conv = Event_clone_ptr(arg_conv);
77849         return ret_conv;
77850 }
77851
77852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
77853         LDKEvent* orig_conv = (LDKEvent*)untag_ptr(orig);
77854         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
77855         *ret_copy = Event_clone(orig_conv);
77856         int64_t ret_ref = tag_ptr(ret_copy, true);
77857         return ret_ref;
77858 }
77859
77860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1funding_1generation_1ready(JNIEnv *env, jclass clz, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int64_t channel_value_satoshis, int8_tArray output_script, int8_tArray user_channel_id) {
77861         LDKThirtyTwoBytes temporary_channel_id_ref;
77862         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
77863         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
77864         LDKPublicKey counterparty_node_id_ref;
77865         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
77866         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
77867         LDKCVec_u8Z output_script_ref;
77868         output_script_ref.datalen = (*env)->GetArrayLength(env, output_script);
77869         output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
77870         (*env)->GetByteArrayRegion(env, output_script, 0, output_script_ref.datalen, output_script_ref.data);
77871         LDKU128 user_channel_id_ref;
77872         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
77873         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
77874         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
77875         *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id_ref);
77876         int64_t ret_ref = tag_ptr(ret_copy, true);
77877         return ret_ref;
77878 }
77879
77880 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) {
77881         LDKPublicKey receiver_node_id_ref;
77882         CHECK((*env)->GetArrayLength(env, receiver_node_id) == 33);
77883         (*env)->GetByteArrayRegion(env, receiver_node_id, 0, 33, receiver_node_id_ref.compressed_form);
77884         LDKThirtyTwoBytes payment_hash_ref;
77885         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
77886         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
77887         LDKRecipientOnionFields onion_fields_conv;
77888         onion_fields_conv.inner = untag_ptr(onion_fields);
77889         onion_fields_conv.is_owned = ptr_is_owned(onion_fields);
77890         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_conv);
77891         onion_fields_conv = RecipientOnionFields_clone(&onion_fields_conv);
77892         void* purpose_ptr = untag_ptr(purpose);
77893         CHECK_ACCESS(purpose_ptr);
77894         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
77895         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
77896         void* via_channel_id_ptr = untag_ptr(via_channel_id);
77897         CHECK_ACCESS(via_channel_id_ptr);
77898         LDKCOption_ThirtyTwoBytesZ via_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(via_channel_id_ptr);
77899         via_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(via_channel_id));
77900         void* via_user_channel_id_ptr = untag_ptr(via_user_channel_id);
77901         CHECK_ACCESS(via_user_channel_id_ptr);
77902         LDKCOption_U128Z via_user_channel_id_conv = *(LDKCOption_U128Z*)(via_user_channel_id_ptr);
77903         via_user_channel_id_conv = COption_U128Z_clone((LDKCOption_U128Z*)untag_ptr(via_user_channel_id));
77904         void* claim_deadline_ptr = untag_ptr(claim_deadline);
77905         CHECK_ACCESS(claim_deadline_ptr);
77906         LDKCOption_u32Z claim_deadline_conv = *(LDKCOption_u32Z*)(claim_deadline_ptr);
77907         claim_deadline_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(claim_deadline));
77908         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
77909         *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);
77910         int64_t ret_ref = tag_ptr(ret_copy, true);
77911         return ret_ref;
77912 }
77913
77914 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) {
77915         LDKPublicKey receiver_node_id_ref;
77916         CHECK((*env)->GetArrayLength(env, receiver_node_id) == 33);
77917         (*env)->GetByteArrayRegion(env, receiver_node_id, 0, 33, receiver_node_id_ref.compressed_form);
77918         LDKThirtyTwoBytes payment_hash_ref;
77919         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
77920         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
77921         void* purpose_ptr = untag_ptr(purpose);
77922         CHECK_ACCESS(purpose_ptr);
77923         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
77924         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
77925         LDKCVec_ClaimedHTLCZ htlcs_constr;
77926         htlcs_constr.datalen = (*env)->GetArrayLength(env, htlcs);
77927         if (htlcs_constr.datalen > 0)
77928                 htlcs_constr.data = MALLOC(htlcs_constr.datalen * sizeof(LDKClaimedHTLC), "LDKCVec_ClaimedHTLCZ Elements");
77929         else
77930                 htlcs_constr.data = NULL;
77931         int64_t* htlcs_vals = (*env)->GetLongArrayElements (env, htlcs, NULL);
77932         for (size_t n = 0; n < htlcs_constr.datalen; n++) {
77933                 int64_t htlcs_conv_13 = htlcs_vals[n];
77934                 LDKClaimedHTLC htlcs_conv_13_conv;
77935                 htlcs_conv_13_conv.inner = untag_ptr(htlcs_conv_13);
77936                 htlcs_conv_13_conv.is_owned = ptr_is_owned(htlcs_conv_13);
77937                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlcs_conv_13_conv);
77938                 htlcs_conv_13_conv = ClaimedHTLC_clone(&htlcs_conv_13_conv);
77939                 htlcs_constr.data[n] = htlcs_conv_13_conv;
77940         }
77941         (*env)->ReleaseLongArrayElements(env, htlcs, htlcs_vals, 0);
77942         void* sender_intended_total_msat_ptr = untag_ptr(sender_intended_total_msat);
77943         CHECK_ACCESS(sender_intended_total_msat_ptr);
77944         LDKCOption_u64Z sender_intended_total_msat_conv = *(LDKCOption_u64Z*)(sender_intended_total_msat_ptr);
77945         sender_intended_total_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(sender_intended_total_msat));
77946         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
77947         *ret_copy = Event_payment_claimed(receiver_node_id_ref, payment_hash_ref, amount_msat, purpose_conv, htlcs_constr, sender_intended_total_msat_conv);
77948         int64_t ret_ref = tag_ptr(ret_copy, true);
77949         return ret_ref;
77950 }
77951
77952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1connection_1needed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_tArray addresses) {
77953         LDKPublicKey node_id_ref;
77954         CHECK((*env)->GetArrayLength(env, node_id) == 33);
77955         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
77956         LDKCVec_SocketAddressZ addresses_constr;
77957         addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
77958         if (addresses_constr.datalen > 0)
77959                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
77960         else
77961                 addresses_constr.data = NULL;
77962         int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
77963         for (size_t p = 0; p < addresses_constr.datalen; p++) {
77964                 int64_t addresses_conv_15 = addresses_vals[p];
77965                 void* addresses_conv_15_ptr = untag_ptr(addresses_conv_15);
77966                 CHECK_ACCESS(addresses_conv_15_ptr);
77967                 LDKSocketAddress addresses_conv_15_conv = *(LDKSocketAddress*)(addresses_conv_15_ptr);
77968                 addresses_constr.data[p] = addresses_conv_15_conv;
77969         }
77970         (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
77971         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
77972         *ret_copy = Event_connection_needed(node_id_ref, addresses_constr);
77973         int64_t ret_ref = tag_ptr(ret_copy, true);
77974         return ret_ref;
77975 }
77976
77977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1invoice_1request_1failed(JNIEnv *env, jclass clz, int8_tArray payment_id) {
77978         LDKThirtyTwoBytes payment_id_ref;
77979         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
77980         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
77981         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
77982         *ret_copy = Event_invoice_request_failed(payment_id_ref);
77983         int64_t ret_ref = tag_ptr(ret_copy, true);
77984         return ret_ref;
77985 }
77986
77987 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) {
77988         void* payment_id_ptr = untag_ptr(payment_id);
77989         CHECK_ACCESS(payment_id_ptr);
77990         LDKCOption_ThirtyTwoBytesZ payment_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_id_ptr);
77991         payment_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_id));
77992         LDKThirtyTwoBytes payment_preimage_ref;
77993         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
77994         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
77995         LDKThirtyTwoBytes payment_hash_ref;
77996         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
77997         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
77998         void* fee_paid_msat_ptr = untag_ptr(fee_paid_msat);
77999         CHECK_ACCESS(fee_paid_msat_ptr);
78000         LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
78001         fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_paid_msat));
78002         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
78003         *ret_copy = Event_payment_sent(payment_id_conv, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
78004         int64_t ret_ref = tag_ptr(ret_copy, true);
78005         return ret_ref;
78006 }
78007
78008 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) {
78009         LDKThirtyTwoBytes payment_id_ref;
78010         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
78011         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
78012         LDKThirtyTwoBytes payment_hash_ref;
78013         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
78014         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
78015         void* reason_ptr = untag_ptr(reason);
78016         CHECK_ACCESS(reason_ptr);
78017         LDKCOption_PaymentFailureReasonZ reason_conv = *(LDKCOption_PaymentFailureReasonZ*)(reason_ptr);
78018         reason_conv = COption_PaymentFailureReasonZ_clone((LDKCOption_PaymentFailureReasonZ*)untag_ptr(reason));
78019         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
78020         *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref, reason_conv);
78021         int64_t ret_ref = tag_ptr(ret_copy, true);
78022         return ret_ref;
78023 }
78024
78025 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) {
78026         LDKThirtyTwoBytes payment_id_ref;
78027         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
78028         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
78029         void* payment_hash_ptr = untag_ptr(payment_hash);
78030         CHECK_ACCESS(payment_hash_ptr);
78031         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
78032         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
78033         LDKPath path_conv;
78034         path_conv.inner = untag_ptr(path);
78035         path_conv.is_owned = ptr_is_owned(path);
78036         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
78037         path_conv = Path_clone(&path_conv);
78038         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
78039         *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_conv, path_conv);
78040         int64_t ret_ref = tag_ptr(ret_copy, true);
78041         return ret_ref;
78042 }
78043
78044 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) {
78045         void* payment_id_ptr = untag_ptr(payment_id);
78046         CHECK_ACCESS(payment_id_ptr);
78047         LDKCOption_ThirtyTwoBytesZ payment_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_id_ptr);
78048         payment_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_id));
78049         LDKThirtyTwoBytes payment_hash_ref;
78050         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
78051         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
78052         void* failure_ptr = untag_ptr(failure);
78053         CHECK_ACCESS(failure_ptr);
78054         LDKPathFailure failure_conv = *(LDKPathFailure*)(failure_ptr);
78055         failure_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(failure));
78056         LDKPath path_conv;
78057         path_conv.inner = untag_ptr(path);
78058         path_conv.is_owned = ptr_is_owned(path);
78059         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
78060         path_conv = Path_clone(&path_conv);
78061         void* short_channel_id_ptr = untag_ptr(short_channel_id);
78062         CHECK_ACCESS(short_channel_id_ptr);
78063         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
78064         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
78065         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
78066         *ret_copy = Event_payment_path_failed(payment_id_conv, payment_hash_ref, payment_failed_permanently, failure_conv, path_conv, short_channel_id_conv);
78067         int64_t ret_ref = tag_ptr(ret_copy, true);
78068         return ret_ref;
78069 }
78070
78071 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) {
78072         LDKThirtyTwoBytes payment_id_ref;
78073         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
78074         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
78075         LDKThirtyTwoBytes payment_hash_ref;
78076         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
78077         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
78078         LDKPath path_conv;
78079         path_conv.inner = untag_ptr(path);
78080         path_conv.is_owned = ptr_is_owned(path);
78081         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
78082         path_conv = Path_clone(&path_conv);
78083         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
78084         *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_conv);
78085         int64_t ret_ref = tag_ptr(ret_copy, true);
78086         return ret_ref;
78087 }
78088
78089 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) {
78090         LDKThirtyTwoBytes payment_id_ref;
78091         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
78092         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
78093         LDKThirtyTwoBytes payment_hash_ref;
78094         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
78095         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
78096         LDKPath path_conv;
78097         path_conv.inner = untag_ptr(path);
78098         path_conv.is_owned = ptr_is_owned(path);
78099         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
78100         path_conv = Path_clone(&path_conv);
78101         void* short_channel_id_ptr = untag_ptr(short_channel_id);
78102         CHECK_ACCESS(short_channel_id_ptr);
78103         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
78104         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
78105         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
78106         *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_conv, short_channel_id_conv);
78107         int64_t ret_ref = tag_ptr(ret_copy, true);
78108         return ret_ref;
78109 }
78110
78111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1pending_1htlcs_1forwardable(JNIEnv *env, jclass clz, int64_t time_forwardable) {
78112         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
78113         *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
78114         int64_t ret_ref = tag_ptr(ret_copy, true);
78115         return ret_ref;
78116 }
78117
78118 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) {
78119         LDKThirtyTwoBytes intercept_id_ref;
78120         CHECK((*env)->GetArrayLength(env, intercept_id) == 32);
78121         (*env)->GetByteArrayRegion(env, intercept_id, 0, 32, intercept_id_ref.data);
78122         LDKThirtyTwoBytes payment_hash_ref;
78123         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
78124         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
78125         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
78126         *ret_copy = Event_htlcintercepted(intercept_id_ref, requested_next_hop_scid, payment_hash_ref, inbound_amount_msat, expected_outbound_amount_msat);
78127         int64_t ret_ref = tag_ptr(ret_copy, true);
78128         return ret_ref;
78129 }
78130
78131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1spendable_1outputs(JNIEnv *env, jclass clz, int64_tArray outputs, int64_t channel_id) {
78132         LDKCVec_SpendableOutputDescriptorZ outputs_constr;
78133         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
78134         if (outputs_constr.datalen > 0)
78135                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
78136         else
78137                 outputs_constr.data = NULL;
78138         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
78139         for (size_t b = 0; b < outputs_constr.datalen; b++) {
78140                 int64_t outputs_conv_27 = outputs_vals[b];
78141                 void* outputs_conv_27_ptr = untag_ptr(outputs_conv_27);
78142                 CHECK_ACCESS(outputs_conv_27_ptr);
78143                 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
78144                 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(outputs_conv_27));
78145                 outputs_constr.data[b] = outputs_conv_27_conv;
78146         }
78147         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
78148         void* channel_id_ptr = untag_ptr(channel_id);
78149         CHECK_ACCESS(channel_id_ptr);
78150         LDKCOption_ThirtyTwoBytesZ channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(channel_id_ptr);
78151         channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(channel_id));
78152         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
78153         *ret_copy = Event_spendable_outputs(outputs_constr, channel_id_conv);
78154         int64_t ret_ref = tag_ptr(ret_copy, true);
78155         return ret_ref;
78156 }
78157
78158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1forwarded(JNIEnv *env, jclass clz, int64_t prev_channel_id, int64_t next_channel_id, int64_t fee_earned_msat, jboolean claim_from_onchain_tx, int64_t outbound_amount_forwarded_msat) {
78159         void* prev_channel_id_ptr = untag_ptr(prev_channel_id);
78160         CHECK_ACCESS(prev_channel_id_ptr);
78161         LDKCOption_ThirtyTwoBytesZ prev_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(prev_channel_id_ptr);
78162         prev_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(prev_channel_id));
78163         void* next_channel_id_ptr = untag_ptr(next_channel_id);
78164         CHECK_ACCESS(next_channel_id_ptr);
78165         LDKCOption_ThirtyTwoBytesZ next_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(next_channel_id_ptr);
78166         next_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(next_channel_id));
78167         void* fee_earned_msat_ptr = untag_ptr(fee_earned_msat);
78168         CHECK_ACCESS(fee_earned_msat_ptr);
78169         LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
78170         fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_earned_msat));
78171         void* outbound_amount_forwarded_msat_ptr = untag_ptr(outbound_amount_forwarded_msat);
78172         CHECK_ACCESS(outbound_amount_forwarded_msat_ptr);
78173         LDKCOption_u64Z outbound_amount_forwarded_msat_conv = *(LDKCOption_u64Z*)(outbound_amount_forwarded_msat_ptr);
78174         outbound_amount_forwarded_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_amount_forwarded_msat));
78175         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
78176         *ret_copy = Event_payment_forwarded(prev_channel_id_conv, next_channel_id_conv, fee_earned_msat_conv, claim_from_onchain_tx, outbound_amount_forwarded_msat_conv);
78177         int64_t ret_ref = tag_ptr(ret_copy, true);
78178         return ret_ref;
78179 }
78180
78181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1channel_1pending(JNIEnv *env, jclass clz, int8_tArray channel_id, int8_tArray user_channel_id, int64_t former_temporary_channel_id, int8_tArray counterparty_node_id, int64_t funding_txo) {
78182         LDKThirtyTwoBytes channel_id_ref;
78183         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
78184         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
78185         LDKU128 user_channel_id_ref;
78186         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
78187         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
78188         void* former_temporary_channel_id_ptr = untag_ptr(former_temporary_channel_id);
78189         CHECK_ACCESS(former_temporary_channel_id_ptr);
78190         LDKCOption_ThirtyTwoBytesZ former_temporary_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(former_temporary_channel_id_ptr);
78191         former_temporary_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(former_temporary_channel_id));
78192         LDKPublicKey counterparty_node_id_ref;
78193         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
78194         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
78195         LDKOutPoint funding_txo_conv;
78196         funding_txo_conv.inner = untag_ptr(funding_txo);
78197         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
78198         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
78199         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
78200         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
78201         *ret_copy = Event_channel_pending(channel_id_ref, user_channel_id_ref, former_temporary_channel_id_conv, counterparty_node_id_ref, funding_txo_conv);
78202         int64_t ret_ref = tag_ptr(ret_copy, true);
78203         return ret_ref;
78204 }
78205
78206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1channel_1ready(JNIEnv *env, jclass clz, int8_tArray channel_id, int8_tArray user_channel_id, int8_tArray counterparty_node_id, int64_t channel_type) {
78207         LDKThirtyTwoBytes channel_id_ref;
78208         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
78209         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
78210         LDKU128 user_channel_id_ref;
78211         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
78212         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
78213         LDKPublicKey counterparty_node_id_ref;
78214         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
78215         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
78216         LDKChannelTypeFeatures channel_type_conv;
78217         channel_type_conv.inner = untag_ptr(channel_type);
78218         channel_type_conv.is_owned = ptr_is_owned(channel_type);
78219         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
78220         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
78221         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
78222         *ret_copy = Event_channel_ready(channel_id_ref, user_channel_id_ref, counterparty_node_id_ref, channel_type_conv);
78223         int64_t ret_ref = tag_ptr(ret_copy, true);
78224         return ret_ref;
78225 }
78226
78227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1channel_1closed(JNIEnv *env, jclass clz, int8_tArray channel_id, int8_tArray user_channel_id, int64_t reason, int8_tArray counterparty_node_id, int64_t channel_capacity_sats, int64_t channel_funding_txo) {
78228         LDKThirtyTwoBytes channel_id_ref;
78229         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
78230         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
78231         LDKU128 user_channel_id_ref;
78232         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
78233         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
78234         void* reason_ptr = untag_ptr(reason);
78235         CHECK_ACCESS(reason_ptr);
78236         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
78237         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
78238         LDKPublicKey counterparty_node_id_ref;
78239         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
78240         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
78241         void* channel_capacity_sats_ptr = untag_ptr(channel_capacity_sats);
78242         CHECK_ACCESS(channel_capacity_sats_ptr);
78243         LDKCOption_u64Z channel_capacity_sats_conv = *(LDKCOption_u64Z*)(channel_capacity_sats_ptr);
78244         channel_capacity_sats_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(channel_capacity_sats));
78245         LDKOutPoint channel_funding_txo_conv;
78246         channel_funding_txo_conv.inner = untag_ptr(channel_funding_txo);
78247         channel_funding_txo_conv.is_owned = ptr_is_owned(channel_funding_txo);
78248         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_txo_conv);
78249         channel_funding_txo_conv = OutPoint_clone(&channel_funding_txo_conv);
78250         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
78251         *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id_ref, reason_conv, counterparty_node_id_ref, channel_capacity_sats_conv, channel_funding_txo_conv);
78252         int64_t ret_ref = tag_ptr(ret_copy, true);
78253         return ret_ref;
78254 }
78255
78256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1discard_1funding(JNIEnv *env, jclass clz, int8_tArray channel_id, int8_tArray transaction) {
78257         LDKThirtyTwoBytes channel_id_ref;
78258         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
78259         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
78260         LDKTransaction transaction_ref;
78261         transaction_ref.datalen = (*env)->GetArrayLength(env, transaction);
78262         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
78263         (*env)->GetByteArrayRegion(env, transaction, 0, transaction_ref.datalen, transaction_ref.data);
78264         transaction_ref.data_is_owned = true;
78265         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
78266         *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
78267         int64_t ret_ref = tag_ptr(ret_copy, true);
78268         return ret_ref;
78269 }
78270
78271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1open_1channel_1request(JNIEnv *env, jclass clz, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int64_t funding_satoshis, int64_t push_msat, int64_t channel_type) {
78272         LDKThirtyTwoBytes temporary_channel_id_ref;
78273         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
78274         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
78275         LDKPublicKey counterparty_node_id_ref;
78276         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
78277         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
78278         LDKChannelTypeFeatures channel_type_conv;
78279         channel_type_conv.inner = untag_ptr(channel_type);
78280         channel_type_conv.is_owned = ptr_is_owned(channel_type);
78281         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
78282         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
78283         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
78284         *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
78285         int64_t ret_ref = tag_ptr(ret_copy, true);
78286         return ret_ref;
78287 }
78288
78289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1htlchandling_1failed(JNIEnv *env, jclass clz, int8_tArray prev_channel_id, int64_t failed_next_destination) {
78290         LDKThirtyTwoBytes prev_channel_id_ref;
78291         CHECK((*env)->GetArrayLength(env, prev_channel_id) == 32);
78292         (*env)->GetByteArrayRegion(env, prev_channel_id, 0, 32, prev_channel_id_ref.data);
78293         void* failed_next_destination_ptr = untag_ptr(failed_next_destination);
78294         CHECK_ACCESS(failed_next_destination_ptr);
78295         LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
78296         failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(failed_next_destination));
78297         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
78298         *ret_copy = Event_htlchandling_failed(prev_channel_id_ref, failed_next_destination_conv);
78299         int64_t ret_ref = tag_ptr(ret_copy, true);
78300         return ret_ref;
78301 }
78302
78303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1bump_1transaction(JNIEnv *env, jclass clz, int64_t a) {
78304         void* a_ptr = untag_ptr(a);
78305         CHECK_ACCESS(a_ptr);
78306         LDKBumpTransactionEvent a_conv = *(LDKBumpTransactionEvent*)(a_ptr);
78307         a_conv = BumpTransactionEvent_clone((LDKBumpTransactionEvent*)untag_ptr(a));
78308         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
78309         *ret_copy = Event_bump_transaction(a_conv);
78310         int64_t ret_ref = tag_ptr(ret_copy, true);
78311         return ret_ref;
78312 }
78313
78314 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Event_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
78315         LDKEvent* a_conv = (LDKEvent*)untag_ptr(a);
78316         LDKEvent* b_conv = (LDKEvent*)untag_ptr(b);
78317         jboolean ret_conv = Event_eq(a_conv, b_conv);
78318         return ret_conv;
78319 }
78320
78321 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
78322         LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj);
78323         LDKCVec_u8Z ret_var = Event_write(obj_conv);
78324         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
78325         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
78326         CVec_u8Z_free(ret_var);
78327         return ret_arr;
78328 }
78329
78330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
78331         LDKu8slice ser_ref;
78332         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
78333         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
78334         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
78335         *ret_conv = Event_read(ser_ref);
78336         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
78337         return tag_ptr(ret_conv, true);
78338 }
78339
78340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
78341         if (!ptr_is_owned(this_ptr)) return;
78342         void* this_ptr_ptr = untag_ptr(this_ptr);
78343         CHECK_ACCESS(this_ptr_ptr);
78344         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
78345         FREE(untag_ptr(this_ptr));
78346         MessageSendEvent_free(this_ptr_conv);
78347 }
78348
78349 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
78350         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78351         *ret_copy = MessageSendEvent_clone(arg);
78352         int64_t ret_ref = tag_ptr(ret_copy, true);
78353         return ret_ref;
78354 }
78355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
78356         LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)untag_ptr(arg);
78357         int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
78358         return ret_conv;
78359 }
78360
78361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
78362         LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)untag_ptr(orig);
78363         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78364         *ret_copy = MessageSendEvent_clone(orig_conv);
78365         int64_t ret_ref = tag_ptr(ret_copy, true);
78366         return ret_ref;
78367 }
78368
78369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1accept_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78370         LDKPublicKey node_id_ref;
78371         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78372         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78373         LDKAcceptChannel msg_conv;
78374         msg_conv.inner = untag_ptr(msg);
78375         msg_conv.is_owned = ptr_is_owned(msg);
78376         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78377         msg_conv = AcceptChannel_clone(&msg_conv);
78378         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78379         *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
78380         int64_t ret_ref = tag_ptr(ret_copy, true);
78381         return ret_ref;
78382 }
78383
78384 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) {
78385         LDKPublicKey node_id_ref;
78386         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78387         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78388         LDKAcceptChannelV2 msg_conv;
78389         msg_conv.inner = untag_ptr(msg);
78390         msg_conv.is_owned = ptr_is_owned(msg);
78391         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78392         msg_conv = AcceptChannelV2_clone(&msg_conv);
78393         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78394         *ret_copy = MessageSendEvent_send_accept_channel_v2(node_id_ref, msg_conv);
78395         int64_t ret_ref = tag_ptr(ret_copy, true);
78396         return ret_ref;
78397 }
78398
78399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1open_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78400         LDKPublicKey node_id_ref;
78401         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78402         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78403         LDKOpenChannel msg_conv;
78404         msg_conv.inner = untag_ptr(msg);
78405         msg_conv.is_owned = ptr_is_owned(msg);
78406         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78407         msg_conv = OpenChannel_clone(&msg_conv);
78408         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78409         *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
78410         int64_t ret_ref = tag_ptr(ret_copy, true);
78411         return ret_ref;
78412 }
78413
78414 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) {
78415         LDKPublicKey node_id_ref;
78416         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78417         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78418         LDKOpenChannelV2 msg_conv;
78419         msg_conv.inner = untag_ptr(msg);
78420         msg_conv.is_owned = ptr_is_owned(msg);
78421         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78422         msg_conv = OpenChannelV2_clone(&msg_conv);
78423         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78424         *ret_copy = MessageSendEvent_send_open_channel_v2(node_id_ref, msg_conv);
78425         int64_t ret_ref = tag_ptr(ret_copy, true);
78426         return ret_ref;
78427 }
78428
78429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1created(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78430         LDKPublicKey node_id_ref;
78431         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78432         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78433         LDKFundingCreated msg_conv;
78434         msg_conv.inner = untag_ptr(msg);
78435         msg_conv.is_owned = ptr_is_owned(msg);
78436         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78437         msg_conv = FundingCreated_clone(&msg_conv);
78438         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78439         *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
78440         int64_t ret_ref = tag_ptr(ret_copy, true);
78441         return ret_ref;
78442 }
78443
78444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78445         LDKPublicKey node_id_ref;
78446         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78447         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78448         LDKFundingSigned msg_conv;
78449         msg_conv.inner = untag_ptr(msg);
78450         msg_conv.is_owned = ptr_is_owned(msg);
78451         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78452         msg_conv = FundingSigned_clone(&msg_conv);
78453         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78454         *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
78455         int64_t ret_ref = tag_ptr(ret_copy, true);
78456         return ret_ref;
78457 }
78458
78459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1stfu(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78460         LDKPublicKey node_id_ref;
78461         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78462         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78463         LDKStfu msg_conv;
78464         msg_conv.inner = untag_ptr(msg);
78465         msg_conv.is_owned = ptr_is_owned(msg);
78466         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78467         msg_conv = Stfu_clone(&msg_conv);
78468         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78469         *ret_copy = MessageSendEvent_send_stfu(node_id_ref, msg_conv);
78470         int64_t ret_ref = tag_ptr(ret_copy, true);
78471         return ret_ref;
78472 }
78473
78474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1splice(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78475         LDKPublicKey node_id_ref;
78476         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78477         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78478         LDKSplice msg_conv;
78479         msg_conv.inner = untag_ptr(msg);
78480         msg_conv.is_owned = ptr_is_owned(msg);
78481         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78482         msg_conv = Splice_clone(&msg_conv);
78483         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78484         *ret_copy = MessageSendEvent_send_splice(node_id_ref, msg_conv);
78485         int64_t ret_ref = tag_ptr(ret_copy, true);
78486         return ret_ref;
78487 }
78488
78489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1splice_1ack(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78490         LDKPublicKey node_id_ref;
78491         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78492         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78493         LDKSpliceAck msg_conv;
78494         msg_conv.inner = untag_ptr(msg);
78495         msg_conv.is_owned = ptr_is_owned(msg);
78496         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78497         msg_conv = SpliceAck_clone(&msg_conv);
78498         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78499         *ret_copy = MessageSendEvent_send_splice_ack(node_id_ref, msg_conv);
78500         int64_t ret_ref = tag_ptr(ret_copy, true);
78501         return ret_ref;
78502 }
78503
78504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1splice_1locked(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78505         LDKPublicKey node_id_ref;
78506         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78507         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78508         LDKSpliceLocked msg_conv;
78509         msg_conv.inner = untag_ptr(msg);
78510         msg_conv.is_owned = ptr_is_owned(msg);
78511         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78512         msg_conv = SpliceLocked_clone(&msg_conv);
78513         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78514         *ret_copy = MessageSendEvent_send_splice_locked(node_id_ref, msg_conv);
78515         int64_t ret_ref = tag_ptr(ret_copy, true);
78516         return ret_ref;
78517 }
78518
78519 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) {
78520         LDKPublicKey node_id_ref;
78521         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78522         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78523         LDKTxAddInput msg_conv;
78524         msg_conv.inner = untag_ptr(msg);
78525         msg_conv.is_owned = ptr_is_owned(msg);
78526         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78527         msg_conv = TxAddInput_clone(&msg_conv);
78528         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78529         *ret_copy = MessageSendEvent_send_tx_add_input(node_id_ref, msg_conv);
78530         int64_t ret_ref = tag_ptr(ret_copy, true);
78531         return ret_ref;
78532 }
78533
78534 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) {
78535         LDKPublicKey node_id_ref;
78536         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78537         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78538         LDKTxAddOutput msg_conv;
78539         msg_conv.inner = untag_ptr(msg);
78540         msg_conv.is_owned = ptr_is_owned(msg);
78541         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78542         msg_conv = TxAddOutput_clone(&msg_conv);
78543         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78544         *ret_copy = MessageSendEvent_send_tx_add_output(node_id_ref, msg_conv);
78545         int64_t ret_ref = tag_ptr(ret_copy, true);
78546         return ret_ref;
78547 }
78548
78549 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) {
78550         LDKPublicKey node_id_ref;
78551         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78552         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78553         LDKTxRemoveInput msg_conv;
78554         msg_conv.inner = untag_ptr(msg);
78555         msg_conv.is_owned = ptr_is_owned(msg);
78556         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78557         msg_conv = TxRemoveInput_clone(&msg_conv);
78558         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78559         *ret_copy = MessageSendEvent_send_tx_remove_input(node_id_ref, msg_conv);
78560         int64_t ret_ref = tag_ptr(ret_copy, true);
78561         return ret_ref;
78562 }
78563
78564 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) {
78565         LDKPublicKey node_id_ref;
78566         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78567         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78568         LDKTxRemoveOutput msg_conv;
78569         msg_conv.inner = untag_ptr(msg);
78570         msg_conv.is_owned = ptr_is_owned(msg);
78571         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78572         msg_conv = TxRemoveOutput_clone(&msg_conv);
78573         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78574         *ret_copy = MessageSendEvent_send_tx_remove_output(node_id_ref, msg_conv);
78575         int64_t ret_ref = tag_ptr(ret_copy, true);
78576         return ret_ref;
78577 }
78578
78579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1complete(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78580         LDKPublicKey node_id_ref;
78581         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78582         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78583         LDKTxComplete msg_conv;
78584         msg_conv.inner = untag_ptr(msg);
78585         msg_conv.is_owned = ptr_is_owned(msg);
78586         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78587         msg_conv = TxComplete_clone(&msg_conv);
78588         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78589         *ret_copy = MessageSendEvent_send_tx_complete(node_id_ref, msg_conv);
78590         int64_t ret_ref = tag_ptr(ret_copy, true);
78591         return ret_ref;
78592 }
78593
78594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1signatures(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78595         LDKPublicKey node_id_ref;
78596         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78597         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78598         LDKTxSignatures msg_conv;
78599         msg_conv.inner = untag_ptr(msg);
78600         msg_conv.is_owned = ptr_is_owned(msg);
78601         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78602         msg_conv = TxSignatures_clone(&msg_conv);
78603         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78604         *ret_copy = MessageSendEvent_send_tx_signatures(node_id_ref, msg_conv);
78605         int64_t ret_ref = tag_ptr(ret_copy, true);
78606         return ret_ref;
78607 }
78608
78609 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) {
78610         LDKPublicKey node_id_ref;
78611         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78612         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78613         LDKTxInitRbf msg_conv;
78614         msg_conv.inner = untag_ptr(msg);
78615         msg_conv.is_owned = ptr_is_owned(msg);
78616         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78617         msg_conv = TxInitRbf_clone(&msg_conv);
78618         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78619         *ret_copy = MessageSendEvent_send_tx_init_rbf(node_id_ref, msg_conv);
78620         int64_t ret_ref = tag_ptr(ret_copy, true);
78621         return ret_ref;
78622 }
78623
78624 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) {
78625         LDKPublicKey node_id_ref;
78626         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78627         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78628         LDKTxAckRbf msg_conv;
78629         msg_conv.inner = untag_ptr(msg);
78630         msg_conv.is_owned = ptr_is_owned(msg);
78631         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78632         msg_conv = TxAckRbf_clone(&msg_conv);
78633         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78634         *ret_copy = MessageSendEvent_send_tx_ack_rbf(node_id_ref, msg_conv);
78635         int64_t ret_ref = tag_ptr(ret_copy, true);
78636         return ret_ref;
78637 }
78638
78639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1abort(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78640         LDKPublicKey node_id_ref;
78641         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78642         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78643         LDKTxAbort msg_conv;
78644         msg_conv.inner = untag_ptr(msg);
78645         msg_conv.is_owned = ptr_is_owned(msg);
78646         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78647         msg_conv = TxAbort_clone(&msg_conv);
78648         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78649         *ret_copy = MessageSendEvent_send_tx_abort(node_id_ref, msg_conv);
78650         int64_t ret_ref = tag_ptr(ret_copy, true);
78651         return ret_ref;
78652 }
78653
78654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1ready(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78655         LDKPublicKey node_id_ref;
78656         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78657         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78658         LDKChannelReady msg_conv;
78659         msg_conv.inner = untag_ptr(msg);
78660         msg_conv.is_owned = ptr_is_owned(msg);
78661         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78662         msg_conv = ChannelReady_clone(&msg_conv);
78663         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78664         *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
78665         int64_t ret_ref = tag_ptr(ret_copy, true);
78666         return ret_ref;
78667 }
78668
78669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1announcement_1signatures(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78670         LDKPublicKey node_id_ref;
78671         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78672         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78673         LDKAnnouncementSignatures msg_conv;
78674         msg_conv.inner = untag_ptr(msg);
78675         msg_conv.is_owned = ptr_is_owned(msg);
78676         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78677         msg_conv = AnnouncementSignatures_clone(&msg_conv);
78678         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78679         *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
78680         int64_t ret_ref = tag_ptr(ret_copy, true);
78681         return ret_ref;
78682 }
78683
78684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1update_1htlcs(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t updates) {
78685         LDKPublicKey node_id_ref;
78686         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78687         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78688         LDKCommitmentUpdate updates_conv;
78689         updates_conv.inner = untag_ptr(updates);
78690         updates_conv.is_owned = ptr_is_owned(updates);
78691         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
78692         updates_conv = CommitmentUpdate_clone(&updates_conv);
78693         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78694         *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
78695         int64_t ret_ref = tag_ptr(ret_copy, true);
78696         return ret_ref;
78697 }
78698
78699 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) {
78700         LDKPublicKey node_id_ref;
78701         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78702         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78703         LDKRevokeAndACK msg_conv;
78704         msg_conv.inner = untag_ptr(msg);
78705         msg_conv.is_owned = ptr_is_owned(msg);
78706         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78707         msg_conv = RevokeAndACK_clone(&msg_conv);
78708         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78709         *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
78710         int64_t ret_ref = tag_ptr(ret_copy, true);
78711         return ret_ref;
78712 }
78713
78714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1closing_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78715         LDKPublicKey node_id_ref;
78716         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78717         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78718         LDKClosingSigned msg_conv;
78719         msg_conv.inner = untag_ptr(msg);
78720         msg_conv.is_owned = ptr_is_owned(msg);
78721         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78722         msg_conv = ClosingSigned_clone(&msg_conv);
78723         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78724         *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
78725         int64_t ret_ref = tag_ptr(ret_copy, true);
78726         return ret_ref;
78727 }
78728
78729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1shutdown(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78730         LDKPublicKey node_id_ref;
78731         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78732         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78733         LDKShutdown msg_conv;
78734         msg_conv.inner = untag_ptr(msg);
78735         msg_conv.is_owned = ptr_is_owned(msg);
78736         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78737         msg_conv = Shutdown_clone(&msg_conv);
78738         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78739         *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
78740         int64_t ret_ref = tag_ptr(ret_copy, true);
78741         return ret_ref;
78742 }
78743
78744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1reestablish(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78745         LDKPublicKey node_id_ref;
78746         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78747         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78748         LDKChannelReestablish msg_conv;
78749         msg_conv.inner = untag_ptr(msg);
78750         msg_conv.is_owned = ptr_is_owned(msg);
78751         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78752         msg_conv = ChannelReestablish_clone(&msg_conv);
78753         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78754         *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
78755         int64_t ret_ref = tag_ptr(ret_copy, true);
78756         return ret_ref;
78757 }
78758
78759 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) {
78760         LDKPublicKey node_id_ref;
78761         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78762         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78763         LDKChannelAnnouncement msg_conv;
78764         msg_conv.inner = untag_ptr(msg);
78765         msg_conv.is_owned = ptr_is_owned(msg);
78766         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78767         msg_conv = ChannelAnnouncement_clone(&msg_conv);
78768         LDKChannelUpdate update_msg_conv;
78769         update_msg_conv.inner = untag_ptr(update_msg);
78770         update_msg_conv.is_owned = ptr_is_owned(update_msg);
78771         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
78772         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
78773         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78774         *ret_copy = MessageSendEvent_send_channel_announcement(node_id_ref, msg_conv, update_msg_conv);
78775         int64_t ret_ref = tag_ptr(ret_copy, true);
78776         return ret_ref;
78777 }
78778
78779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1announcement(JNIEnv *env, jclass clz, int64_t msg, int64_t update_msg) {
78780         LDKChannelAnnouncement msg_conv;
78781         msg_conv.inner = untag_ptr(msg);
78782         msg_conv.is_owned = ptr_is_owned(msg);
78783         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78784         msg_conv = ChannelAnnouncement_clone(&msg_conv);
78785         LDKChannelUpdate update_msg_conv;
78786         update_msg_conv.inner = untag_ptr(update_msg);
78787         update_msg_conv.is_owned = ptr_is_owned(update_msg);
78788         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
78789         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
78790         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78791         *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
78792         int64_t ret_ref = tag_ptr(ret_copy, true);
78793         return ret_ref;
78794 }
78795
78796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1update(JNIEnv *env, jclass clz, int64_t msg) {
78797         LDKChannelUpdate msg_conv;
78798         msg_conv.inner = untag_ptr(msg);
78799         msg_conv.is_owned = ptr_is_owned(msg);
78800         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78801         msg_conv = ChannelUpdate_clone(&msg_conv);
78802         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78803         *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
78804         int64_t ret_ref = tag_ptr(ret_copy, true);
78805         return ret_ref;
78806 }
78807
78808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
78809         LDKNodeAnnouncement msg_conv;
78810         msg_conv.inner = untag_ptr(msg);
78811         msg_conv.is_owned = ptr_is_owned(msg);
78812         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78813         msg_conv = NodeAnnouncement_clone(&msg_conv);
78814         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78815         *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
78816         int64_t ret_ref = tag_ptr(ret_copy, true);
78817         return ret_ref;
78818 }
78819
78820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1update(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78821         LDKPublicKey node_id_ref;
78822         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78823         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78824         LDKChannelUpdate msg_conv;
78825         msg_conv.inner = untag_ptr(msg);
78826         msg_conv.is_owned = ptr_is_owned(msg);
78827         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78828         msg_conv = ChannelUpdate_clone(&msg_conv);
78829         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78830         *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
78831         int64_t ret_ref = tag_ptr(ret_copy, true);
78832         return ret_ref;
78833 }
78834
78835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1handle_1error(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t action) {
78836         LDKPublicKey node_id_ref;
78837         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78838         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78839         void* action_ptr = untag_ptr(action);
78840         CHECK_ACCESS(action_ptr);
78841         LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
78842         action_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action));
78843         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78844         *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
78845         int64_t ret_ref = tag_ptr(ret_copy, true);
78846         return ret_ref;
78847 }
78848
78849 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) {
78850         LDKPublicKey node_id_ref;
78851         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78852         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78853         LDKQueryChannelRange msg_conv;
78854         msg_conv.inner = untag_ptr(msg);
78855         msg_conv.is_owned = ptr_is_owned(msg);
78856         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78857         msg_conv = QueryChannelRange_clone(&msg_conv);
78858         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78859         *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
78860         int64_t ret_ref = tag_ptr(ret_copy, true);
78861         return ret_ref;
78862 }
78863
78864 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) {
78865         LDKPublicKey node_id_ref;
78866         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78867         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78868         LDKQueryShortChannelIds msg_conv;
78869         msg_conv.inner = untag_ptr(msg);
78870         msg_conv.is_owned = ptr_is_owned(msg);
78871         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78872         msg_conv = QueryShortChannelIds_clone(&msg_conv);
78873         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78874         *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
78875         int64_t ret_ref = tag_ptr(ret_copy, true);
78876         return ret_ref;
78877 }
78878
78879 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) {
78880         LDKPublicKey node_id_ref;
78881         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78882         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78883         LDKReplyChannelRange msg_conv;
78884         msg_conv.inner = untag_ptr(msg);
78885         msg_conv.is_owned = ptr_is_owned(msg);
78886         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78887         msg_conv = ReplyChannelRange_clone(&msg_conv);
78888         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78889         *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
78890         int64_t ret_ref = tag_ptr(ret_copy, true);
78891         return ret_ref;
78892 }
78893
78894 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) {
78895         LDKPublicKey node_id_ref;
78896         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78897         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78898         LDKGossipTimestampFilter msg_conv;
78899         msg_conv.inner = untag_ptr(msg);
78900         msg_conv.is_owned = ptr_is_owned(msg);
78901         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78902         msg_conv = GossipTimestampFilter_clone(&msg_conv);
78903         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78904         *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
78905         int64_t ret_ref = tag_ptr(ret_copy, true);
78906         return ret_ref;
78907 }
78908
78909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
78910         if (!ptr_is_owned(this_ptr)) return;
78911         void* this_ptr_ptr = untag_ptr(this_ptr);
78912         CHECK_ACCESS(this_ptr_ptr);
78913         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
78914         FREE(untag_ptr(this_ptr));
78915         MessageSendEventsProvider_free(this_ptr_conv);
78916 }
78917
78918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
78919         if (!ptr_is_owned(this_ptr)) return;
78920         void* this_ptr_ptr = untag_ptr(this_ptr);
78921         CHECK_ACCESS(this_ptr_ptr);
78922         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
78923         FREE(untag_ptr(this_ptr));
78924         EventsProvider_free(this_ptr_conv);
78925 }
78926
78927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
78928         if (!ptr_is_owned(this_ptr)) return;
78929         void* this_ptr_ptr = untag_ptr(this_ptr);
78930         CHECK_ACCESS(this_ptr_ptr);
78931         LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
78932         FREE(untag_ptr(this_ptr));
78933         EventHandler_free(this_ptr_conv);
78934 }
78935
78936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
78937         LDKAnchorDescriptor this_obj_conv;
78938         this_obj_conv.inner = untag_ptr(this_obj);
78939         this_obj_conv.is_owned = ptr_is_owned(this_obj);
78940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
78941         AnchorDescriptor_free(this_obj_conv);
78942 }
78943
78944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1get_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
78945         LDKAnchorDescriptor this_ptr_conv;
78946         this_ptr_conv.inner = untag_ptr(this_ptr);
78947         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78949         this_ptr_conv.is_owned = false;
78950         LDKChannelDerivationParameters ret_var = AnchorDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
78951         int64_t ret_ref = 0;
78952         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78953         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78954         return ret_ref;
78955 }
78956
78957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1set_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
78958         LDKAnchorDescriptor this_ptr_conv;
78959         this_ptr_conv.inner = untag_ptr(this_ptr);
78960         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78962         this_ptr_conv.is_owned = false;
78963         LDKChannelDerivationParameters val_conv;
78964         val_conv.inner = untag_ptr(val);
78965         val_conv.is_owned = ptr_is_owned(val);
78966         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
78967         val_conv = ChannelDerivationParameters_clone(&val_conv);
78968         AnchorDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
78969 }
78970
78971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
78972         LDKAnchorDescriptor this_ptr_conv;
78973         this_ptr_conv.inner = untag_ptr(this_ptr);
78974         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78976         this_ptr_conv.is_owned = false;
78977         LDKOutPoint ret_var = AnchorDescriptor_get_outpoint(&this_ptr_conv);
78978         int64_t ret_ref = 0;
78979         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78980         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78981         return ret_ref;
78982 }
78983
78984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
78985         LDKAnchorDescriptor this_ptr_conv;
78986         this_ptr_conv.inner = untag_ptr(this_ptr);
78987         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78989         this_ptr_conv.is_owned = false;
78990         LDKOutPoint val_conv;
78991         val_conv.inner = untag_ptr(val);
78992         val_conv.is_owned = ptr_is_owned(val);
78993         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
78994         val_conv = OutPoint_clone(&val_conv);
78995         AnchorDescriptor_set_outpoint(&this_ptr_conv, val_conv);
78996 }
78997
78998 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) {
78999         LDKChannelDerivationParameters channel_derivation_parameters_arg_conv;
79000         channel_derivation_parameters_arg_conv.inner = untag_ptr(channel_derivation_parameters_arg);
79001         channel_derivation_parameters_arg_conv.is_owned = ptr_is_owned(channel_derivation_parameters_arg);
79002         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_derivation_parameters_arg_conv);
79003         channel_derivation_parameters_arg_conv = ChannelDerivationParameters_clone(&channel_derivation_parameters_arg_conv);
79004         LDKOutPoint outpoint_arg_conv;
79005         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
79006         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
79007         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
79008         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
79009         LDKAnchorDescriptor ret_var = AnchorDescriptor_new(channel_derivation_parameters_arg_conv, outpoint_arg_conv);
79010         int64_t ret_ref = 0;
79011         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79012         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79013         return ret_ref;
79014 }
79015
79016 static inline uint64_t AnchorDescriptor_clone_ptr(LDKAnchorDescriptor *NONNULL_PTR arg) {
79017         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(arg);
79018         int64_t ret_ref = 0;
79019         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79020         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79021         return ret_ref;
79022 }
79023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
79024         LDKAnchorDescriptor arg_conv;
79025         arg_conv.inner = untag_ptr(arg);
79026         arg_conv.is_owned = ptr_is_owned(arg);
79027         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
79028         arg_conv.is_owned = false;
79029         int64_t ret_conv = AnchorDescriptor_clone_ptr(&arg_conv);
79030         return ret_conv;
79031 }
79032
79033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
79034         LDKAnchorDescriptor orig_conv;
79035         orig_conv.inner = untag_ptr(orig);
79036         orig_conv.is_owned = ptr_is_owned(orig);
79037         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
79038         orig_conv.is_owned = false;
79039         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(&orig_conv);
79040         int64_t ret_ref = 0;
79041         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79042         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79043         return ret_ref;
79044 }
79045
79046 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
79047         LDKAnchorDescriptor a_conv;
79048         a_conv.inner = untag_ptr(a);
79049         a_conv.is_owned = ptr_is_owned(a);
79050         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
79051         a_conv.is_owned = false;
79052         LDKAnchorDescriptor b_conv;
79053         b_conv.inner = untag_ptr(b);
79054         b_conv.is_owned = ptr_is_owned(b);
79055         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
79056         b_conv.is_owned = false;
79057         jboolean ret_conv = AnchorDescriptor_eq(&a_conv, &b_conv);
79058         return ret_conv;
79059 }
79060
79061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1previous_1utxo(JNIEnv *env, jclass clz, int64_t this_arg) {
79062         LDKAnchorDescriptor this_arg_conv;
79063         this_arg_conv.inner = untag_ptr(this_arg);
79064         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79066         this_arg_conv.is_owned = false;
79067         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
79068         *ret_ref = AnchorDescriptor_previous_utxo(&this_arg_conv);
79069         return tag_ptr(ret_ref, true);
79070 }
79071
79072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1unsigned_1tx_1input(JNIEnv *env, jclass clz, int64_t this_arg) {
79073         LDKAnchorDescriptor this_arg_conv;
79074         this_arg_conv.inner = untag_ptr(this_arg);
79075         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79077         this_arg_conv.is_owned = false;
79078         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
79079         *ret_ref = AnchorDescriptor_unsigned_tx_input(&this_arg_conv);
79080         return tag_ptr(ret_ref, true);
79081 }
79082
79083 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1witness_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
79084         LDKAnchorDescriptor this_arg_conv;
79085         this_arg_conv.inner = untag_ptr(this_arg);
79086         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79088         this_arg_conv.is_owned = false;
79089         LDKCVec_u8Z ret_var = AnchorDescriptor_witness_script(&this_arg_conv);
79090         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
79091         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
79092         CVec_u8Z_free(ret_var);
79093         return ret_arr;
79094 }
79095
79096 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1tx_1input_1witness(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray signature) {
79097         LDKAnchorDescriptor this_arg_conv;
79098         this_arg_conv.inner = untag_ptr(this_arg);
79099         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79101         this_arg_conv.is_owned = false;
79102         LDKECDSASignature signature_ref;
79103         CHECK((*env)->GetArrayLength(env, signature) == 64);
79104         (*env)->GetByteArrayRegion(env, signature, 0, 64, signature_ref.compact_form);
79105         LDKWitness ret_var = AnchorDescriptor_tx_input_witness(&this_arg_conv, signature_ref);
79106         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
79107         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
79108         Witness_free(ret_var);
79109         return ret_arr;
79110 }
79111
79112 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) {
79113         LDKAnchorDescriptor this_arg_conv;
79114         this_arg_conv.inner = untag_ptr(this_arg);
79115         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79117         this_arg_conv.is_owned = false;
79118         void* signer_provider_ptr = untag_ptr(signer_provider);
79119         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
79120         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
79121         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
79122         *ret_ret = AnchorDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
79123         return tag_ptr(ret_ret, true);
79124 }
79125
79126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
79127         if (!ptr_is_owned(this_ptr)) return;
79128         void* this_ptr_ptr = untag_ptr(this_ptr);
79129         CHECK_ACCESS(this_ptr_ptr);
79130         LDKBumpTransactionEvent this_ptr_conv = *(LDKBumpTransactionEvent*)(this_ptr_ptr);
79131         FREE(untag_ptr(this_ptr));
79132         BumpTransactionEvent_free(this_ptr_conv);
79133 }
79134
79135 static inline uint64_t BumpTransactionEvent_clone_ptr(LDKBumpTransactionEvent *NONNULL_PTR arg) {
79136         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
79137         *ret_copy = BumpTransactionEvent_clone(arg);
79138         int64_t ret_ref = tag_ptr(ret_copy, true);
79139         return ret_ref;
79140 }
79141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
79142         LDKBumpTransactionEvent* arg_conv = (LDKBumpTransactionEvent*)untag_ptr(arg);
79143         int64_t ret_conv = BumpTransactionEvent_clone_ptr(arg_conv);
79144         return ret_conv;
79145 }
79146
79147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
79148         LDKBumpTransactionEvent* orig_conv = (LDKBumpTransactionEvent*)untag_ptr(orig);
79149         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
79150         *ret_copy = BumpTransactionEvent_clone(orig_conv);
79151         int64_t ret_ref = tag_ptr(ret_copy, true);
79152         return ret_ref;
79153 }
79154
79155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1channel_1close(JNIEnv *env, jclass clz, int8_tArray claim_id, int32_t package_target_feerate_sat_per_1000_weight, int8_tArray commitment_tx, int64_t commitment_tx_fee_satoshis, int64_t anchor_descriptor, int64_tArray pending_htlcs) {
79156         LDKThirtyTwoBytes claim_id_ref;
79157         CHECK((*env)->GetArrayLength(env, claim_id) == 32);
79158         (*env)->GetByteArrayRegion(env, claim_id, 0, 32, claim_id_ref.data);
79159         LDKTransaction commitment_tx_ref;
79160         commitment_tx_ref.datalen = (*env)->GetArrayLength(env, commitment_tx);
79161         commitment_tx_ref.data = MALLOC(commitment_tx_ref.datalen, "LDKTransaction Bytes");
79162         (*env)->GetByteArrayRegion(env, commitment_tx, 0, commitment_tx_ref.datalen, commitment_tx_ref.data);
79163         commitment_tx_ref.data_is_owned = true;
79164         LDKAnchorDescriptor anchor_descriptor_conv;
79165         anchor_descriptor_conv.inner = untag_ptr(anchor_descriptor);
79166         anchor_descriptor_conv.is_owned = ptr_is_owned(anchor_descriptor);
79167         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_conv);
79168         anchor_descriptor_conv = AnchorDescriptor_clone(&anchor_descriptor_conv);
79169         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_constr;
79170         pending_htlcs_constr.datalen = (*env)->GetArrayLength(env, pending_htlcs);
79171         if (pending_htlcs_constr.datalen > 0)
79172                 pending_htlcs_constr.data = MALLOC(pending_htlcs_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
79173         else
79174                 pending_htlcs_constr.data = NULL;
79175         int64_t* pending_htlcs_vals = (*env)->GetLongArrayElements (env, pending_htlcs, NULL);
79176         for (size_t y = 0; y < pending_htlcs_constr.datalen; y++) {
79177                 int64_t pending_htlcs_conv_24 = pending_htlcs_vals[y];
79178                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_conv;
79179                 pending_htlcs_conv_24_conv.inner = untag_ptr(pending_htlcs_conv_24);
79180                 pending_htlcs_conv_24_conv.is_owned = ptr_is_owned(pending_htlcs_conv_24);
79181                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_conv);
79182                 pending_htlcs_conv_24_conv = HTLCOutputInCommitment_clone(&pending_htlcs_conv_24_conv);
79183                 pending_htlcs_constr.data[y] = pending_htlcs_conv_24_conv;
79184         }
79185         (*env)->ReleaseLongArrayElements(env, pending_htlcs, pending_htlcs_vals, 0);
79186         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
79187         *ret_copy = BumpTransactionEvent_channel_close(claim_id_ref, package_target_feerate_sat_per_1000_weight, commitment_tx_ref, commitment_tx_fee_satoshis, anchor_descriptor_conv, pending_htlcs_constr);
79188         int64_t ret_ref = tag_ptr(ret_copy, true);
79189         return ret_ref;
79190 }
79191
79192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1htlcresolution(JNIEnv *env, jclass clz, int8_tArray claim_id, int32_t target_feerate_sat_per_1000_weight, int64_tArray htlc_descriptors, int32_t tx_lock_time) {
79193         LDKThirtyTwoBytes claim_id_ref;
79194         CHECK((*env)->GetArrayLength(env, claim_id) == 32);
79195         (*env)->GetByteArrayRegion(env, claim_id, 0, 32, claim_id_ref.data);
79196         LDKCVec_HTLCDescriptorZ htlc_descriptors_constr;
79197         htlc_descriptors_constr.datalen = (*env)->GetArrayLength(env, htlc_descriptors);
79198         if (htlc_descriptors_constr.datalen > 0)
79199                 htlc_descriptors_constr.data = MALLOC(htlc_descriptors_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
79200         else
79201                 htlc_descriptors_constr.data = NULL;
79202         int64_t* htlc_descriptors_vals = (*env)->GetLongArrayElements (env, htlc_descriptors, NULL);
79203         for (size_t q = 0; q < htlc_descriptors_constr.datalen; q++) {
79204                 int64_t htlc_descriptors_conv_16 = htlc_descriptors_vals[q];
79205                 LDKHTLCDescriptor htlc_descriptors_conv_16_conv;
79206                 htlc_descriptors_conv_16_conv.inner = untag_ptr(htlc_descriptors_conv_16);
79207                 htlc_descriptors_conv_16_conv.is_owned = ptr_is_owned(htlc_descriptors_conv_16);
79208                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_conv);
79209                 htlc_descriptors_conv_16_conv = HTLCDescriptor_clone(&htlc_descriptors_conv_16_conv);
79210                 htlc_descriptors_constr.data[q] = htlc_descriptors_conv_16_conv;
79211         }
79212         (*env)->ReleaseLongArrayElements(env, htlc_descriptors, htlc_descriptors_vals, 0);
79213         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
79214         *ret_copy = BumpTransactionEvent_htlcresolution(claim_id_ref, target_feerate_sat_per_1000_weight, htlc_descriptors_constr, tx_lock_time);
79215         int64_t ret_ref = tag_ptr(ret_copy, true);
79216         return ret_ref;
79217 }
79218
79219 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
79220         LDKBumpTransactionEvent* a_conv = (LDKBumpTransactionEvent*)untag_ptr(a);
79221         LDKBumpTransactionEvent* b_conv = (LDKBumpTransactionEvent*)untag_ptr(b);
79222         jboolean ret_conv = BumpTransactionEvent_eq(a_conv, b_conv);
79223         return ret_conv;
79224 }
79225
79226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Input_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
79227         LDKInput this_obj_conv;
79228         this_obj_conv.inner = untag_ptr(this_obj);
79229         this_obj_conv.is_owned = ptr_is_owned(this_obj);
79230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
79231         Input_free(this_obj_conv);
79232 }
79233
79234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
79235         LDKInput this_ptr_conv;
79236         this_ptr_conv.inner = untag_ptr(this_ptr);
79237         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79239         this_ptr_conv.is_owned = false;
79240         LDKOutPoint ret_var = Input_get_outpoint(&this_ptr_conv);
79241         int64_t ret_ref = 0;
79242         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79243         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79244         return ret_ref;
79245 }
79246
79247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Input_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
79248         LDKInput this_ptr_conv;
79249         this_ptr_conv.inner = untag_ptr(this_ptr);
79250         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79252         this_ptr_conv.is_owned = false;
79253         LDKOutPoint val_conv;
79254         val_conv.inner = untag_ptr(val);
79255         val_conv.is_owned = ptr_is_owned(val);
79256         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
79257         val_conv = OutPoint_clone(&val_conv);
79258         Input_set_outpoint(&this_ptr_conv, val_conv);
79259 }
79260
79261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1get_1previous_1utxo(JNIEnv *env, jclass clz, int64_t this_ptr) {
79262         LDKInput this_ptr_conv;
79263         this_ptr_conv.inner = untag_ptr(this_ptr);
79264         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79266         this_ptr_conv.is_owned = false;
79267         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
79268         *ret_ref = Input_get_previous_utxo(&this_ptr_conv);
79269         return tag_ptr(ret_ref, true);
79270 }
79271
79272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Input_1set_1previous_1utxo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
79273         LDKInput this_ptr_conv;
79274         this_ptr_conv.inner = untag_ptr(this_ptr);
79275         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79277         this_ptr_conv.is_owned = false;
79278         void* val_ptr = untag_ptr(val);
79279         CHECK_ACCESS(val_ptr);
79280         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
79281         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
79282         Input_set_previous_utxo(&this_ptr_conv, val_conv);
79283 }
79284
79285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1get_1satisfaction_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
79286         LDKInput this_ptr_conv;
79287         this_ptr_conv.inner = untag_ptr(this_ptr);
79288         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79290         this_ptr_conv.is_owned = false;
79291         int64_t ret_conv = Input_get_satisfaction_weight(&this_ptr_conv);
79292         return ret_conv;
79293 }
79294
79295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Input_1set_1satisfaction_1weight(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
79296         LDKInput this_ptr_conv;
79297         this_ptr_conv.inner = untag_ptr(this_ptr);
79298         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79300         this_ptr_conv.is_owned = false;
79301         Input_set_satisfaction_weight(&this_ptr_conv, val);
79302 }
79303
79304 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) {
79305         LDKOutPoint outpoint_arg_conv;
79306         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
79307         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
79308         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
79309         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
79310         void* previous_utxo_arg_ptr = untag_ptr(previous_utxo_arg);
79311         CHECK_ACCESS(previous_utxo_arg_ptr);
79312         LDKTxOut previous_utxo_arg_conv = *(LDKTxOut*)(previous_utxo_arg_ptr);
79313         previous_utxo_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(previous_utxo_arg));
79314         LDKInput ret_var = Input_new(outpoint_arg_conv, previous_utxo_arg_conv, satisfaction_weight_arg);
79315         int64_t ret_ref = 0;
79316         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79317         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79318         return ret_ref;
79319 }
79320
79321 static inline uint64_t Input_clone_ptr(LDKInput *NONNULL_PTR arg) {
79322         LDKInput ret_var = Input_clone(arg);
79323         int64_t ret_ref = 0;
79324         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79325         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79326         return ret_ref;
79327 }
79328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
79329         LDKInput arg_conv;
79330         arg_conv.inner = untag_ptr(arg);
79331         arg_conv.is_owned = ptr_is_owned(arg);
79332         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
79333         arg_conv.is_owned = false;
79334         int64_t ret_conv = Input_clone_ptr(&arg_conv);
79335         return ret_conv;
79336 }
79337
79338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1clone(JNIEnv *env, jclass clz, int64_t orig) {
79339         LDKInput orig_conv;
79340         orig_conv.inner = untag_ptr(orig);
79341         orig_conv.is_owned = ptr_is_owned(orig);
79342         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
79343         orig_conv.is_owned = false;
79344         LDKInput ret_var = Input_clone(&orig_conv);
79345         int64_t ret_ref = 0;
79346         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79347         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79348         return ret_ref;
79349 }
79350
79351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1hash(JNIEnv *env, jclass clz, int64_t o) {
79352         LDKInput o_conv;
79353         o_conv.inner = untag_ptr(o);
79354         o_conv.is_owned = ptr_is_owned(o);
79355         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
79356         o_conv.is_owned = false;
79357         int64_t ret_conv = Input_hash(&o_conv);
79358         return ret_conv;
79359 }
79360
79361 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Input_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
79362         LDKInput a_conv;
79363         a_conv.inner = untag_ptr(a);
79364         a_conv.is_owned = ptr_is_owned(a);
79365         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
79366         a_conv.is_owned = false;
79367         LDKInput b_conv;
79368         b_conv.inner = untag_ptr(b);
79369         b_conv.is_owned = ptr_is_owned(b);
79370         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
79371         b_conv.is_owned = false;
79372         jboolean ret_conv = Input_eq(&a_conv, &b_conv);
79373         return ret_conv;
79374 }
79375
79376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Utxo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
79377         LDKUtxo this_obj_conv;
79378         this_obj_conv.inner = untag_ptr(this_obj);
79379         this_obj_conv.is_owned = ptr_is_owned(this_obj);
79380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
79381         Utxo_free(this_obj_conv);
79382 }
79383
79384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
79385         LDKUtxo this_ptr_conv;
79386         this_ptr_conv.inner = untag_ptr(this_ptr);
79387         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79389         this_ptr_conv.is_owned = false;
79390         LDKOutPoint ret_var = Utxo_get_outpoint(&this_ptr_conv);
79391         int64_t ret_ref = 0;
79392         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79393         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79394         return ret_ref;
79395 }
79396
79397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Utxo_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
79398         LDKUtxo this_ptr_conv;
79399         this_ptr_conv.inner = untag_ptr(this_ptr);
79400         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79402         this_ptr_conv.is_owned = false;
79403         LDKOutPoint val_conv;
79404         val_conv.inner = untag_ptr(val);
79405         val_conv.is_owned = ptr_is_owned(val);
79406         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
79407         val_conv = OutPoint_clone(&val_conv);
79408         Utxo_set_outpoint(&this_ptr_conv, val_conv);
79409 }
79410
79411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
79412         LDKUtxo this_ptr_conv;
79413         this_ptr_conv.inner = untag_ptr(this_ptr);
79414         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79416         this_ptr_conv.is_owned = false;
79417         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
79418         *ret_ref = Utxo_get_output(&this_ptr_conv);
79419         return tag_ptr(ret_ref, true);
79420 }
79421
79422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Utxo_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
79423         LDKUtxo this_ptr_conv;
79424         this_ptr_conv.inner = untag_ptr(this_ptr);
79425         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79427         this_ptr_conv.is_owned = false;
79428         void* val_ptr = untag_ptr(val);
79429         CHECK_ACCESS(val_ptr);
79430         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
79431         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
79432         Utxo_set_output(&this_ptr_conv, val_conv);
79433 }
79434
79435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1get_1satisfaction_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
79436         LDKUtxo this_ptr_conv;
79437         this_ptr_conv.inner = untag_ptr(this_ptr);
79438         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79440         this_ptr_conv.is_owned = false;
79441         int64_t ret_conv = Utxo_get_satisfaction_weight(&this_ptr_conv);
79442         return ret_conv;
79443 }
79444
79445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Utxo_1set_1satisfaction_1weight(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
79446         LDKUtxo this_ptr_conv;
79447         this_ptr_conv.inner = untag_ptr(this_ptr);
79448         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79450         this_ptr_conv.is_owned = false;
79451         Utxo_set_satisfaction_weight(&this_ptr_conv, val);
79452 }
79453
79454 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) {
79455         LDKOutPoint outpoint_arg_conv;
79456         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
79457         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
79458         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
79459         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
79460         void* output_arg_ptr = untag_ptr(output_arg);
79461         CHECK_ACCESS(output_arg_ptr);
79462         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
79463         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
79464         LDKUtxo ret_var = Utxo_new(outpoint_arg_conv, output_arg_conv, satisfaction_weight_arg);
79465         int64_t ret_ref = 0;
79466         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79467         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79468         return ret_ref;
79469 }
79470
79471 static inline uint64_t Utxo_clone_ptr(LDKUtxo *NONNULL_PTR arg) {
79472         LDKUtxo ret_var = Utxo_clone(arg);
79473         int64_t ret_ref = 0;
79474         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79475         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79476         return ret_ref;
79477 }
79478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
79479         LDKUtxo arg_conv;
79480         arg_conv.inner = untag_ptr(arg);
79481         arg_conv.is_owned = ptr_is_owned(arg);
79482         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
79483         arg_conv.is_owned = false;
79484         int64_t ret_conv = Utxo_clone_ptr(&arg_conv);
79485         return ret_conv;
79486 }
79487
79488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
79489         LDKUtxo orig_conv;
79490         orig_conv.inner = untag_ptr(orig);
79491         orig_conv.is_owned = ptr_is_owned(orig);
79492         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
79493         orig_conv.is_owned = false;
79494         LDKUtxo ret_var = Utxo_clone(&orig_conv);
79495         int64_t ret_ref = 0;
79496         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79497         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79498         return ret_ref;
79499 }
79500
79501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1hash(JNIEnv *env, jclass clz, int64_t o) {
79502         LDKUtxo o_conv;
79503         o_conv.inner = untag_ptr(o);
79504         o_conv.is_owned = ptr_is_owned(o);
79505         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
79506         o_conv.is_owned = false;
79507         int64_t ret_conv = Utxo_hash(&o_conv);
79508         return ret_conv;
79509 }
79510
79511 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Utxo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
79512         LDKUtxo a_conv;
79513         a_conv.inner = untag_ptr(a);
79514         a_conv.is_owned = ptr_is_owned(a);
79515         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
79516         a_conv.is_owned = false;
79517         LDKUtxo b_conv;
79518         b_conv.inner = untag_ptr(b);
79519         b_conv.is_owned = ptr_is_owned(b);
79520         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
79521         b_conv.is_owned = false;
79522         jboolean ret_conv = Utxo_eq(&a_conv, &b_conv);
79523         return ret_conv;
79524 }
79525
79526 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) {
79527         LDKOutPoint outpoint_conv;
79528         outpoint_conv.inner = untag_ptr(outpoint);
79529         outpoint_conv.is_owned = ptr_is_owned(outpoint);
79530         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
79531         outpoint_conv = OutPoint_clone(&outpoint_conv);
79532         uint8_t pubkey_hash_arr[20];
79533         CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
79534         (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
79535         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
79536         LDKUtxo ret_var = Utxo_new_p2pkh(outpoint_conv, value, pubkey_hash_ref);
79537         int64_t ret_ref = 0;
79538         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79539         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79540         return ret_ref;
79541 }
79542
79543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CoinSelection_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
79544         LDKCoinSelection this_obj_conv;
79545         this_obj_conv.inner = untag_ptr(this_obj);
79546         this_obj_conv.is_owned = ptr_is_owned(this_obj);
79547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
79548         CoinSelection_free(this_obj_conv);
79549 }
79550
79551 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CoinSelection_1get_1confirmed_1utxos(JNIEnv *env, jclass clz, int64_t this_ptr) {
79552         LDKCoinSelection this_ptr_conv;
79553         this_ptr_conv.inner = untag_ptr(this_ptr);
79554         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79556         this_ptr_conv.is_owned = false;
79557         LDKCVec_UtxoZ ret_var = CoinSelection_get_confirmed_utxos(&this_ptr_conv);
79558         int64_tArray ret_arr = NULL;
79559         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
79560         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
79561         for (size_t g = 0; g < ret_var.datalen; g++) {
79562                 LDKUtxo ret_conv_6_var = ret_var.data[g];
79563                 int64_t ret_conv_6_ref = 0;
79564                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
79565                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
79566                 ret_arr_ptr[g] = ret_conv_6_ref;
79567         }
79568         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
79569         FREE(ret_var.data);
79570         return ret_arr;
79571 }
79572
79573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CoinSelection_1set_1confirmed_1utxos(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
79574         LDKCoinSelection this_ptr_conv;
79575         this_ptr_conv.inner = untag_ptr(this_ptr);
79576         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79578         this_ptr_conv.is_owned = false;
79579         LDKCVec_UtxoZ val_constr;
79580         val_constr.datalen = (*env)->GetArrayLength(env, val);
79581         if (val_constr.datalen > 0)
79582                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
79583         else
79584                 val_constr.data = NULL;
79585         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
79586         for (size_t g = 0; g < val_constr.datalen; g++) {
79587                 int64_t val_conv_6 = val_vals[g];
79588                 LDKUtxo val_conv_6_conv;
79589                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
79590                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
79591                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
79592                 val_conv_6_conv = Utxo_clone(&val_conv_6_conv);
79593                 val_constr.data[g] = val_conv_6_conv;
79594         }
79595         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
79596         CoinSelection_set_confirmed_utxos(&this_ptr_conv, val_constr);
79597 }
79598
79599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelection_1get_1change_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
79600         LDKCoinSelection this_ptr_conv;
79601         this_ptr_conv.inner = untag_ptr(this_ptr);
79602         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79604         this_ptr_conv.is_owned = false;
79605         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
79606         *ret_copy = CoinSelection_get_change_output(&this_ptr_conv);
79607         int64_t ret_ref = tag_ptr(ret_copy, true);
79608         return ret_ref;
79609 }
79610
79611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CoinSelection_1set_1change_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
79612         LDKCoinSelection this_ptr_conv;
79613         this_ptr_conv.inner = untag_ptr(this_ptr);
79614         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79616         this_ptr_conv.is_owned = false;
79617         void* val_ptr = untag_ptr(val);
79618         CHECK_ACCESS(val_ptr);
79619         LDKCOption_TxOutZ val_conv = *(LDKCOption_TxOutZ*)(val_ptr);
79620         val_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(val));
79621         CoinSelection_set_change_output(&this_ptr_conv, val_conv);
79622 }
79623
79624 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) {
79625         LDKCVec_UtxoZ confirmed_utxos_arg_constr;
79626         confirmed_utxos_arg_constr.datalen = (*env)->GetArrayLength(env, confirmed_utxos_arg);
79627         if (confirmed_utxos_arg_constr.datalen > 0)
79628                 confirmed_utxos_arg_constr.data = MALLOC(confirmed_utxos_arg_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
79629         else
79630                 confirmed_utxos_arg_constr.data = NULL;
79631         int64_t* confirmed_utxos_arg_vals = (*env)->GetLongArrayElements (env, confirmed_utxos_arg, NULL);
79632         for (size_t g = 0; g < confirmed_utxos_arg_constr.datalen; g++) {
79633                 int64_t confirmed_utxos_arg_conv_6 = confirmed_utxos_arg_vals[g];
79634                 LDKUtxo confirmed_utxos_arg_conv_6_conv;
79635                 confirmed_utxos_arg_conv_6_conv.inner = untag_ptr(confirmed_utxos_arg_conv_6);
79636                 confirmed_utxos_arg_conv_6_conv.is_owned = ptr_is_owned(confirmed_utxos_arg_conv_6);
79637                 CHECK_INNER_FIELD_ACCESS_OR_NULL(confirmed_utxos_arg_conv_6_conv);
79638                 confirmed_utxos_arg_conv_6_conv = Utxo_clone(&confirmed_utxos_arg_conv_6_conv);
79639                 confirmed_utxos_arg_constr.data[g] = confirmed_utxos_arg_conv_6_conv;
79640         }
79641         (*env)->ReleaseLongArrayElements(env, confirmed_utxos_arg, confirmed_utxos_arg_vals, 0);
79642         void* change_output_arg_ptr = untag_ptr(change_output_arg);
79643         CHECK_ACCESS(change_output_arg_ptr);
79644         LDKCOption_TxOutZ change_output_arg_conv = *(LDKCOption_TxOutZ*)(change_output_arg_ptr);
79645         change_output_arg_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(change_output_arg));
79646         LDKCoinSelection ret_var = CoinSelection_new(confirmed_utxos_arg_constr, change_output_arg_conv);
79647         int64_t ret_ref = 0;
79648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79650         return ret_ref;
79651 }
79652
79653 static inline uint64_t CoinSelection_clone_ptr(LDKCoinSelection *NONNULL_PTR arg) {
79654         LDKCoinSelection ret_var = CoinSelection_clone(arg);
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 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelection_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
79661         LDKCoinSelection arg_conv;
79662         arg_conv.inner = untag_ptr(arg);
79663         arg_conv.is_owned = ptr_is_owned(arg);
79664         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
79665         arg_conv.is_owned = false;
79666         int64_t ret_conv = CoinSelection_clone_ptr(&arg_conv);
79667         return ret_conv;
79668 }
79669
79670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelection_1clone(JNIEnv *env, jclass clz, int64_t orig) {
79671         LDKCoinSelection orig_conv;
79672         orig_conv.inner = untag_ptr(orig);
79673         orig_conv.is_owned = ptr_is_owned(orig);
79674         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
79675         orig_conv.is_owned = false;
79676         LDKCoinSelection ret_var = CoinSelection_clone(&orig_conv);
79677         int64_t ret_ref = 0;
79678         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79679         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79680         return ret_ref;
79681 }
79682
79683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CoinSelectionSource_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
79684         if (!ptr_is_owned(this_ptr)) return;
79685         void* this_ptr_ptr = untag_ptr(this_ptr);
79686         CHECK_ACCESS(this_ptr_ptr);
79687         LDKCoinSelectionSource this_ptr_conv = *(LDKCoinSelectionSource*)(this_ptr_ptr);
79688         FREE(untag_ptr(this_ptr));
79689         CoinSelectionSource_free(this_ptr_conv);
79690 }
79691
79692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WalletSource_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
79693         if (!ptr_is_owned(this_ptr)) return;
79694         void* this_ptr_ptr = untag_ptr(this_ptr);
79695         CHECK_ACCESS(this_ptr_ptr);
79696         LDKWalletSource this_ptr_conv = *(LDKWalletSource*)(this_ptr_ptr);
79697         FREE(untag_ptr(this_ptr));
79698         WalletSource_free(this_ptr_conv);
79699 }
79700
79701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Wallet_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
79702         LDKWallet this_obj_conv;
79703         this_obj_conv.inner = untag_ptr(this_obj);
79704         this_obj_conv.is_owned = ptr_is_owned(this_obj);
79705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
79706         Wallet_free(this_obj_conv);
79707 }
79708
79709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Wallet_1new(JNIEnv *env, jclass clz, int64_t source, int64_t logger) {
79710         void* source_ptr = untag_ptr(source);
79711         CHECK_ACCESS(source_ptr);
79712         LDKWalletSource source_conv = *(LDKWalletSource*)(source_ptr);
79713         if (source_conv.free == LDKWalletSource_JCalls_free) {
79714                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
79715                 LDKWalletSource_JCalls_cloned(&source_conv);
79716         }
79717         void* logger_ptr = untag_ptr(logger);
79718         CHECK_ACCESS(logger_ptr);
79719         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
79720         if (logger_conv.free == LDKLogger_JCalls_free) {
79721                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
79722                 LDKLogger_JCalls_cloned(&logger_conv);
79723         }
79724         LDKWallet ret_var = Wallet_new(source_conv, logger_conv);
79725         int64_t ret_ref = 0;
79726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79728         return ret_ref;
79729 }
79730
79731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Wallet_1as_1CoinSelectionSource(JNIEnv *env, jclass clz, int64_t this_arg) {
79732         LDKWallet this_arg_conv;
79733         this_arg_conv.inner = untag_ptr(this_arg);
79734         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79736         this_arg_conv.is_owned = false;
79737         LDKCoinSelectionSource* ret_ret = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
79738         *ret_ret = Wallet_as_CoinSelectionSource(&this_arg_conv);
79739         return tag_ptr(ret_ret, true);
79740 }
79741
79742 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BumpTransactionEventHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
79743         LDKBumpTransactionEventHandler this_obj_conv;
79744         this_obj_conv.inner = untag_ptr(this_obj);
79745         this_obj_conv.is_owned = ptr_is_owned(this_obj);
79746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
79747         BumpTransactionEventHandler_free(this_obj_conv);
79748 }
79749
79750 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) {
79751         void* broadcaster_ptr = untag_ptr(broadcaster);
79752         CHECK_ACCESS(broadcaster_ptr);
79753         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
79754         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
79755                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
79756                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
79757         }
79758         void* utxo_source_ptr = untag_ptr(utxo_source);
79759         CHECK_ACCESS(utxo_source_ptr);
79760         LDKCoinSelectionSource utxo_source_conv = *(LDKCoinSelectionSource*)(utxo_source_ptr);
79761         if (utxo_source_conv.free == LDKCoinSelectionSource_JCalls_free) {
79762                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
79763                 LDKCoinSelectionSource_JCalls_cloned(&utxo_source_conv);
79764         }
79765         void* signer_provider_ptr = untag_ptr(signer_provider);
79766         CHECK_ACCESS(signer_provider_ptr);
79767         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
79768         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
79769                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
79770                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
79771         }
79772         void* logger_ptr = untag_ptr(logger);
79773         CHECK_ACCESS(logger_ptr);
79774         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
79775         if (logger_conv.free == LDKLogger_JCalls_free) {
79776                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
79777                 LDKLogger_JCalls_cloned(&logger_conv);
79778         }
79779         LDKBumpTransactionEventHandler ret_var = BumpTransactionEventHandler_new(broadcaster_conv, utxo_source_conv, signer_provider_conv, logger_conv);
79780         int64_t ret_ref = 0;
79781         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79782         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79783         return ret_ref;
79784 }
79785
79786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BumpTransactionEventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
79787         LDKBumpTransactionEventHandler this_arg_conv;
79788         this_arg_conv.inner = untag_ptr(this_arg);
79789         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79791         this_arg_conv.is_owned = false;
79792         LDKBumpTransactionEvent* event_conv = (LDKBumpTransactionEvent*)untag_ptr(event);
79793         BumpTransactionEventHandler_handle_event(&this_arg_conv, event_conv);
79794 }
79795
79796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemStore_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
79797         LDKFilesystemStore this_obj_conv;
79798         this_obj_conv.inner = untag_ptr(this_obj);
79799         this_obj_conv.is_owned = ptr_is_owned(this_obj);
79800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
79801         FilesystemStore_free(this_obj_conv);
79802 }
79803
79804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemStore_1new(JNIEnv *env, jclass clz, jstring data_dir) {
79805         LDKStr data_dir_conv = java_to_owned_str(env, data_dir);
79806         LDKFilesystemStore ret_var = FilesystemStore_new(data_dir_conv);
79807         int64_t ret_ref = 0;
79808         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79809         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79810         return ret_ref;
79811 }
79812
79813 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_FilesystemStore_1get_1data_1dir(JNIEnv *env, jclass clz, int64_t this_arg) {
79814         LDKFilesystemStore this_arg_conv;
79815         this_arg_conv.inner = untag_ptr(this_arg);
79816         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79818         this_arg_conv.is_owned = false;
79819         LDKStr ret_str = FilesystemStore_get_data_dir(&this_arg_conv);
79820         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
79821         Str_free(ret_str);
79822         return ret_conv;
79823 }
79824
79825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemStore_1as_1KVStore(JNIEnv *env, jclass clz, int64_t this_arg) {
79826         LDKFilesystemStore this_arg_conv;
79827         this_arg_conv.inner = untag_ptr(this_arg);
79828         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79830         this_arg_conv.is_owned = false;
79831         LDKKVStore* ret_ret = MALLOC(sizeof(LDKKVStore), "LDKKVStore");
79832         *ret_ret = FilesystemStore_as_KVStore(&this_arg_conv);
79833         return tag_ptr(ret_ret, true);
79834 }
79835
79836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
79837         LDKBackgroundProcessor this_obj_conv;
79838         this_obj_conv.inner = untag_ptr(this_obj);
79839         this_obj_conv.is_owned = ptr_is_owned(this_obj);
79840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
79841         BackgroundProcessor_free(this_obj_conv);
79842 }
79843
79844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipSync_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
79845         if (!ptr_is_owned(this_ptr)) return;
79846         void* this_ptr_ptr = untag_ptr(this_ptr);
79847         CHECK_ACCESS(this_ptr_ptr);
79848         LDKGossipSync this_ptr_conv = *(LDKGossipSync*)(this_ptr_ptr);
79849         FREE(untag_ptr(this_ptr));
79850         GossipSync_free(this_ptr_conv);
79851 }
79852
79853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1p2_1p(JNIEnv *env, jclass clz, int64_t a) {
79854         LDKP2PGossipSync a_conv;
79855         a_conv.inner = untag_ptr(a);
79856         a_conv.is_owned = ptr_is_owned(a);
79857         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
79858         a_conv.is_owned = false;
79859         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
79860         *ret_copy = GossipSync_p2_p(&a_conv);
79861         int64_t ret_ref = tag_ptr(ret_copy, true);
79862         return ret_ref;
79863 }
79864
79865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1rapid(JNIEnv *env, jclass clz, int64_t a) {
79866         LDKRapidGossipSync a_conv;
79867         a_conv.inner = untag_ptr(a);
79868         a_conv.is_owned = ptr_is_owned(a);
79869         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
79870         a_conv.is_owned = false;
79871         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
79872         *ret_copy = GossipSync_rapid(&a_conv);
79873         int64_t ret_ref = tag_ptr(ret_copy, true);
79874         return ret_ref;
79875 }
79876
79877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1none(JNIEnv *env, jclass clz) {
79878         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
79879         *ret_copy = GossipSync_none();
79880         int64_t ret_ref = tag_ptr(ret_copy, true);
79881         return ret_ref;
79882 }
79883
79884 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) {
79885         void* persister_ptr = untag_ptr(persister);
79886         CHECK_ACCESS(persister_ptr);
79887         LDKPersister persister_conv = *(LDKPersister*)(persister_ptr);
79888         if (persister_conv.free == LDKPersister_JCalls_free) {
79889                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
79890                 LDKPersister_JCalls_cloned(&persister_conv);
79891         }
79892         void* event_handler_ptr = untag_ptr(event_handler);
79893         CHECK_ACCESS(event_handler_ptr);
79894         LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
79895         if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
79896                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
79897                 LDKEventHandler_JCalls_cloned(&event_handler_conv);
79898         }
79899         LDKChainMonitor chain_monitor_conv;
79900         chain_monitor_conv.inner = untag_ptr(chain_monitor);
79901         chain_monitor_conv.is_owned = ptr_is_owned(chain_monitor);
79902         CHECK_INNER_FIELD_ACCESS_OR_NULL(chain_monitor_conv);
79903         chain_monitor_conv.is_owned = false;
79904         LDKChannelManager channel_manager_conv;
79905         channel_manager_conv.inner = untag_ptr(channel_manager);
79906         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
79907         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
79908         channel_manager_conv.is_owned = false;
79909         void* gossip_sync_ptr = untag_ptr(gossip_sync);
79910         CHECK_ACCESS(gossip_sync_ptr);
79911         LDKGossipSync gossip_sync_conv = *(LDKGossipSync*)(gossip_sync_ptr);
79912         // WARNING: we may need a move here but no clone is available for LDKGossipSync
79913         LDKPeerManager peer_manager_conv;
79914         peer_manager_conv.inner = untag_ptr(peer_manager);
79915         peer_manager_conv.is_owned = ptr_is_owned(peer_manager);
79916         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_manager_conv);
79917         peer_manager_conv.is_owned = false;
79918         void* logger_ptr = untag_ptr(logger);
79919         CHECK_ACCESS(logger_ptr);
79920         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
79921         if (logger_conv.free == LDKLogger_JCalls_free) {
79922                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
79923                 LDKLogger_JCalls_cloned(&logger_conv);
79924         }
79925         void* scorer_ptr = untag_ptr(scorer);
79926         CHECK_ACCESS(scorer_ptr);
79927         LDKCOption_WriteableScoreZ scorer_conv = *(LDKCOption_WriteableScoreZ*)(scorer_ptr);
79928         // WARNING: we may need a move here but no clone is available for LDKCOption_WriteableScoreZ
79929         if (scorer_conv.tag == LDKCOption_WriteableScoreZ_Some) {
79930                 // Manually implement clone for Java trait instances
79931                 if (scorer_conv.some.free == LDKWriteableScore_JCalls_free) {
79932                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
79933                         LDKWriteableScore_JCalls_cloned(&scorer_conv.some);
79934                 }
79935         }
79936         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);
79937         int64_t ret_ref = 0;
79938         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79939         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79940         return ret_ref;
79941 }
79942
79943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1join(JNIEnv *env, jclass clz, int64_t this_arg) {
79944         LDKBackgroundProcessor this_arg_conv;
79945         this_arg_conv.inner = untag_ptr(this_arg);
79946         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79948         // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
79949         
79950         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
79951         *ret_conv = BackgroundProcessor_join(this_arg_conv);
79952         return tag_ptr(ret_conv, true);
79953 }
79954
79955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(JNIEnv *env, jclass clz, int64_t this_arg) {
79956         LDKBackgroundProcessor this_arg_conv;
79957         this_arg_conv.inner = untag_ptr(this_arg);
79958         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79960         // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
79961         
79962         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
79963         *ret_conv = BackgroundProcessor_stop(this_arg_conv);
79964         return tag_ptr(ret_conv, true);
79965 }
79966
79967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
79968         if (!ptr_is_owned(this_ptr)) return;
79969         void* this_ptr_ptr = untag_ptr(this_ptr);
79970         CHECK_ACCESS(this_ptr_ptr);
79971         LDKBolt11ParseError this_ptr_conv = *(LDKBolt11ParseError*)(this_ptr_ptr);
79972         FREE(untag_ptr(this_ptr));
79973         Bolt11ParseError_free(this_ptr_conv);
79974 }
79975
79976 static inline uint64_t Bolt11ParseError_clone_ptr(LDKBolt11ParseError *NONNULL_PTR arg) {
79977         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
79978         *ret_copy = Bolt11ParseError_clone(arg);
79979         int64_t ret_ref = tag_ptr(ret_copy, true);
79980         return ret_ref;
79981 }
79982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
79983         LDKBolt11ParseError* arg_conv = (LDKBolt11ParseError*)untag_ptr(arg);
79984         int64_t ret_conv = Bolt11ParseError_clone_ptr(arg_conv);
79985         return ret_conv;
79986 }
79987
79988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
79989         LDKBolt11ParseError* orig_conv = (LDKBolt11ParseError*)untag_ptr(orig);
79990         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
79991         *ret_copy = Bolt11ParseError_clone(orig_conv);
79992         int64_t ret_ref = tag_ptr(ret_copy, true);
79993         return ret_ref;
79994 }
79995
79996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1bech32_1error(JNIEnv *env, jclass clz, int64_t a) {
79997         void* a_ptr = untag_ptr(a);
79998         CHECK_ACCESS(a_ptr);
79999         LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
80000         a_conv = Bech32Error_clone((LDKBech32Error*)untag_ptr(a));
80001         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
80002         *ret_copy = Bolt11ParseError_bech32_error(a_conv);
80003         int64_t ret_ref = tag_ptr(ret_copy, true);
80004         return ret_ref;
80005 }
80006
80007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1parse_1amount_1error(JNIEnv *env, jclass clz, int32_t a) {
80008         
80009         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
80010         *ret_copy = Bolt11ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
80011         int64_t ret_ref = tag_ptr(ret_copy, true);
80012         return ret_ref;
80013 }
80014
80015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1malformed_1signature(JNIEnv *env, jclass clz, jclass a) {
80016         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_java(env, a);
80017         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
80018         *ret_copy = Bolt11ParseError_malformed_signature(a_conv);
80019         int64_t ret_ref = tag_ptr(ret_copy, true);
80020         return ret_ref;
80021 }
80022
80023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1bad_1prefix(JNIEnv *env, jclass clz) {
80024         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
80025         *ret_copy = Bolt11ParseError_bad_prefix();
80026         int64_t ret_ref = tag_ptr(ret_copy, true);
80027         return ret_ref;
80028 }
80029
80030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1unknown_1currency(JNIEnv *env, jclass clz) {
80031         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
80032         *ret_copy = Bolt11ParseError_unknown_currency();
80033         int64_t ret_ref = tag_ptr(ret_copy, true);
80034         return ret_ref;
80035 }
80036
80037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1unknown_1si_1prefix(JNIEnv *env, jclass clz) {
80038         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
80039         *ret_copy = Bolt11ParseError_unknown_si_prefix();
80040         int64_t ret_ref = tag_ptr(ret_copy, true);
80041         return ret_ref;
80042 }
80043
80044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1malformed_1hrp(JNIEnv *env, jclass clz) {
80045         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
80046         *ret_copy = Bolt11ParseError_malformed_hrp();
80047         int64_t ret_ref = tag_ptr(ret_copy, true);
80048         return ret_ref;
80049 }
80050
80051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1too_1short_1data_1part(JNIEnv *env, jclass clz) {
80052         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
80053         *ret_copy = Bolt11ParseError_too_short_data_part();
80054         int64_t ret_ref = tag_ptr(ret_copy, true);
80055         return ret_ref;
80056 }
80057
80058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1unexpected_1end_1of_1tagged_1fields(JNIEnv *env, jclass clz) {
80059         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
80060         *ret_copy = Bolt11ParseError_unexpected_end_of_tagged_fields();
80061         int64_t ret_ref = tag_ptr(ret_copy, true);
80062         return ret_ref;
80063 }
80064
80065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1description_1decode_1error(JNIEnv *env, jclass clz, int32_t a) {
80066         
80067         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
80068         *ret_copy = Bolt11ParseError_description_decode_error((LDKError){ ._dummy = 0 });
80069         int64_t ret_ref = tag_ptr(ret_copy, true);
80070         return ret_ref;
80071 }
80072
80073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1padding_1error(JNIEnv *env, jclass clz) {
80074         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
80075         *ret_copy = Bolt11ParseError_padding_error();
80076         int64_t ret_ref = tag_ptr(ret_copy, true);
80077         return ret_ref;
80078 }
80079
80080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1integer_1overflow_1error(JNIEnv *env, jclass clz) {
80081         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
80082         *ret_copy = Bolt11ParseError_integer_overflow_error();
80083         int64_t ret_ref = tag_ptr(ret_copy, true);
80084         return ret_ref;
80085 }
80086
80087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1seg_1wit_1program_1length(JNIEnv *env, jclass clz) {
80088         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
80089         *ret_copy = Bolt11ParseError_invalid_seg_wit_program_length();
80090         int64_t ret_ref = tag_ptr(ret_copy, true);
80091         return ret_ref;
80092 }
80093
80094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1pub_1key_1hash_1length(JNIEnv *env, jclass clz) {
80095         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
80096         *ret_copy = Bolt11ParseError_invalid_pub_key_hash_length();
80097         int64_t ret_ref = tag_ptr(ret_copy, true);
80098         return ret_ref;
80099 }
80100
80101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1script_1hash_1length(JNIEnv *env, jclass clz) {
80102         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
80103         *ret_copy = Bolt11ParseError_invalid_script_hash_length();
80104         int64_t ret_ref = tag_ptr(ret_copy, true);
80105         return ret_ref;
80106 }
80107
80108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
80109         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
80110         *ret_copy = Bolt11ParseError_invalid_recovery_id();
80111         int64_t ret_ref = tag_ptr(ret_copy, true);
80112         return ret_ref;
80113 }
80114
80115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1slice_1length(JNIEnv *env, jclass clz, jstring a) {
80116         LDKStr a_conv = java_to_owned_str(env, a);
80117         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
80118         *ret_copy = Bolt11ParseError_invalid_slice_length(a_conv);
80119         int64_t ret_ref = tag_ptr(ret_copy, true);
80120         return ret_ref;
80121 }
80122
80123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1skip(JNIEnv *env, jclass clz) {
80124         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
80125         *ret_copy = Bolt11ParseError_skip();
80126         int64_t ret_ref = tag_ptr(ret_copy, true);
80127         return ret_ref;
80128 }
80129
80130 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
80131         LDKBolt11ParseError* a_conv = (LDKBolt11ParseError*)untag_ptr(a);
80132         LDKBolt11ParseError* b_conv = (LDKBolt11ParseError*)untag_ptr(b);
80133         jboolean ret_conv = Bolt11ParseError_eq(a_conv, b_conv);
80134         return ret_conv;
80135 }
80136
80137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
80138         if (!ptr_is_owned(this_ptr)) return;
80139         void* this_ptr_ptr = untag_ptr(this_ptr);
80140         CHECK_ACCESS(this_ptr_ptr);
80141         LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
80142         FREE(untag_ptr(this_ptr));
80143         ParseOrSemanticError_free(this_ptr_conv);
80144 }
80145
80146 static inline uint64_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
80147         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
80148         *ret_copy = ParseOrSemanticError_clone(arg);
80149         int64_t ret_ref = tag_ptr(ret_copy, true);
80150         return ret_ref;
80151 }
80152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
80153         LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)untag_ptr(arg);
80154         int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
80155         return ret_conv;
80156 }
80157
80158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
80159         LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)untag_ptr(orig);
80160         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
80161         *ret_copy = ParseOrSemanticError_clone(orig_conv);
80162         int64_t ret_ref = tag_ptr(ret_copy, true);
80163         return ret_ref;
80164 }
80165
80166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1parse_1error(JNIEnv *env, jclass clz, int64_t a) {
80167         void* a_ptr = untag_ptr(a);
80168         CHECK_ACCESS(a_ptr);
80169         LDKBolt11ParseError a_conv = *(LDKBolt11ParseError*)(a_ptr);
80170         a_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(a));
80171         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
80172         *ret_copy = ParseOrSemanticError_parse_error(a_conv);
80173         int64_t ret_ref = tag_ptr(ret_copy, true);
80174         return ret_ref;
80175 }
80176
80177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1semantic_1error(JNIEnv *env, jclass clz, jclass a) {
80178         LDKBolt11SemanticError a_conv = LDKBolt11SemanticError_from_java(env, a);
80179         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
80180         *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
80181         int64_t ret_ref = tag_ptr(ret_copy, true);
80182         return ret_ref;
80183 }
80184
80185 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
80186         LDKParseOrSemanticError* a_conv = (LDKParseOrSemanticError*)untag_ptr(a);
80187         LDKParseOrSemanticError* b_conv = (LDKParseOrSemanticError*)untag_ptr(b);
80188         jboolean ret_conv = ParseOrSemanticError_eq(a_conv, b_conv);
80189         return ret_conv;
80190 }
80191
80192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
80193         LDKBolt11Invoice this_obj_conv;
80194         this_obj_conv.inner = untag_ptr(this_obj);
80195         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80197         Bolt11Invoice_free(this_obj_conv);
80198 }
80199
80200 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
80201         LDKBolt11Invoice a_conv;
80202         a_conv.inner = untag_ptr(a);
80203         a_conv.is_owned = ptr_is_owned(a);
80204         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
80205         a_conv.is_owned = false;
80206         LDKBolt11Invoice b_conv;
80207         b_conv.inner = untag_ptr(b);
80208         b_conv.is_owned = ptr_is_owned(b);
80209         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
80210         b_conv.is_owned = false;
80211         jboolean ret_conv = Bolt11Invoice_eq(&a_conv, &b_conv);
80212         return ret_conv;
80213 }
80214
80215 static inline uint64_t Bolt11Invoice_clone_ptr(LDKBolt11Invoice *NONNULL_PTR arg) {
80216         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(arg);
80217         int64_t ret_ref = 0;
80218         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80219         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80220         return ret_ref;
80221 }
80222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
80223         LDKBolt11Invoice arg_conv;
80224         arg_conv.inner = untag_ptr(arg);
80225         arg_conv.is_owned = ptr_is_owned(arg);
80226         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
80227         arg_conv.is_owned = false;
80228         int64_t ret_conv = Bolt11Invoice_clone_ptr(&arg_conv);
80229         return ret_conv;
80230 }
80231
80232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
80233         LDKBolt11Invoice orig_conv;
80234         orig_conv.inner = untag_ptr(orig);
80235         orig_conv.is_owned = ptr_is_owned(orig);
80236         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
80237         orig_conv.is_owned = false;
80238         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(&orig_conv);
80239         int64_t ret_ref = 0;
80240         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80241         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80242         return ret_ref;
80243 }
80244
80245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1hash(JNIEnv *env, jclass clz, int64_t o) {
80246         LDKBolt11Invoice o_conv;
80247         o_conv.inner = untag_ptr(o);
80248         o_conv.is_owned = ptr_is_owned(o);
80249         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
80250         o_conv.is_owned = false;
80251         int64_t ret_conv = Bolt11Invoice_hash(&o_conv);
80252         return ret_conv;
80253 }
80254
80255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
80256         LDKSignedRawBolt11Invoice this_obj_conv;
80257         this_obj_conv.inner = untag_ptr(this_obj);
80258         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80260         SignedRawBolt11Invoice_free(this_obj_conv);
80261 }
80262
80263 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
80264         LDKSignedRawBolt11Invoice a_conv;
80265         a_conv.inner = untag_ptr(a);
80266         a_conv.is_owned = ptr_is_owned(a);
80267         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
80268         a_conv.is_owned = false;
80269         LDKSignedRawBolt11Invoice b_conv;
80270         b_conv.inner = untag_ptr(b);
80271         b_conv.is_owned = ptr_is_owned(b);
80272         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
80273         b_conv.is_owned = false;
80274         jboolean ret_conv = SignedRawBolt11Invoice_eq(&a_conv, &b_conv);
80275         return ret_conv;
80276 }
80277
80278 static inline uint64_t SignedRawBolt11Invoice_clone_ptr(LDKSignedRawBolt11Invoice *NONNULL_PTR arg) {
80279         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(arg);
80280         int64_t ret_ref = 0;
80281         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80282         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80283         return ret_ref;
80284 }
80285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
80286         LDKSignedRawBolt11Invoice arg_conv;
80287         arg_conv.inner = untag_ptr(arg);
80288         arg_conv.is_owned = ptr_is_owned(arg);
80289         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
80290         arg_conv.is_owned = false;
80291         int64_t ret_conv = SignedRawBolt11Invoice_clone_ptr(&arg_conv);
80292         return ret_conv;
80293 }
80294
80295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
80296         LDKSignedRawBolt11Invoice orig_conv;
80297         orig_conv.inner = untag_ptr(orig);
80298         orig_conv.is_owned = ptr_is_owned(orig);
80299         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
80300         orig_conv.is_owned = false;
80301         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(&orig_conv);
80302         int64_t ret_ref = 0;
80303         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80304         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80305         return ret_ref;
80306 }
80307
80308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1hash(JNIEnv *env, jclass clz, int64_t o) {
80309         LDKSignedRawBolt11Invoice o_conv;
80310         o_conv.inner = untag_ptr(o);
80311         o_conv.is_owned = ptr_is_owned(o);
80312         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
80313         o_conv.is_owned = false;
80314         int64_t ret_conv = SignedRawBolt11Invoice_hash(&o_conv);
80315         return ret_conv;
80316 }
80317
80318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
80319         LDKRawBolt11Invoice this_obj_conv;
80320         this_obj_conv.inner = untag_ptr(this_obj);
80321         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80323         RawBolt11Invoice_free(this_obj_conv);
80324 }
80325
80326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
80327         LDKRawBolt11Invoice this_ptr_conv;
80328         this_ptr_conv.inner = untag_ptr(this_ptr);
80329         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80331         this_ptr_conv.is_owned = false;
80332         LDKRawDataPart ret_var = RawBolt11Invoice_get_data(&this_ptr_conv);
80333         int64_t ret_ref = 0;
80334         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80335         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80336         return ret_ref;
80337 }
80338
80339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
80340         LDKRawBolt11Invoice this_ptr_conv;
80341         this_ptr_conv.inner = untag_ptr(this_ptr);
80342         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80344         this_ptr_conv.is_owned = false;
80345         LDKRawDataPart val_conv;
80346         val_conv.inner = untag_ptr(val);
80347         val_conv.is_owned = ptr_is_owned(val);
80348         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
80349         val_conv = RawDataPart_clone(&val_conv);
80350         RawBolt11Invoice_set_data(&this_ptr_conv, val_conv);
80351 }
80352
80353 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
80354         LDKRawBolt11Invoice a_conv;
80355         a_conv.inner = untag_ptr(a);
80356         a_conv.is_owned = ptr_is_owned(a);
80357         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
80358         a_conv.is_owned = false;
80359         LDKRawBolt11Invoice b_conv;
80360         b_conv.inner = untag_ptr(b);
80361         b_conv.is_owned = ptr_is_owned(b);
80362         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
80363         b_conv.is_owned = false;
80364         jboolean ret_conv = RawBolt11Invoice_eq(&a_conv, &b_conv);
80365         return ret_conv;
80366 }
80367
80368 static inline uint64_t RawBolt11Invoice_clone_ptr(LDKRawBolt11Invoice *NONNULL_PTR arg) {
80369         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(arg);
80370         int64_t ret_ref = 0;
80371         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80372         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80373         return ret_ref;
80374 }
80375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
80376         LDKRawBolt11Invoice arg_conv;
80377         arg_conv.inner = untag_ptr(arg);
80378         arg_conv.is_owned = ptr_is_owned(arg);
80379         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
80380         arg_conv.is_owned = false;
80381         int64_t ret_conv = RawBolt11Invoice_clone_ptr(&arg_conv);
80382         return ret_conv;
80383 }
80384
80385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
80386         LDKRawBolt11Invoice orig_conv;
80387         orig_conv.inner = untag_ptr(orig);
80388         orig_conv.is_owned = ptr_is_owned(orig);
80389         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
80390         orig_conv.is_owned = false;
80391         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(&orig_conv);
80392         int64_t ret_ref = 0;
80393         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80394         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80395         return ret_ref;
80396 }
80397
80398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1hash(JNIEnv *env, jclass clz, int64_t o) {
80399         LDKRawBolt11Invoice o_conv;
80400         o_conv.inner = untag_ptr(o);
80401         o_conv.is_owned = ptr_is_owned(o);
80402         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
80403         o_conv.is_owned = false;
80404         int64_t ret_conv = RawBolt11Invoice_hash(&o_conv);
80405         return ret_conv;
80406 }
80407
80408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
80409         LDKRawDataPart this_obj_conv;
80410         this_obj_conv.inner = untag_ptr(this_obj);
80411         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80413         RawDataPart_free(this_obj_conv);
80414 }
80415
80416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
80417         LDKRawDataPart this_ptr_conv;
80418         this_ptr_conv.inner = untag_ptr(this_ptr);
80419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80421         this_ptr_conv.is_owned = false;
80422         LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
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 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
80430         LDKRawDataPart this_ptr_conv;
80431         this_ptr_conv.inner = untag_ptr(this_ptr);
80432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80434         this_ptr_conv.is_owned = false;
80435         LDKPositiveTimestamp val_conv;
80436         val_conv.inner = untag_ptr(val);
80437         val_conv.is_owned = ptr_is_owned(val);
80438         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
80439         val_conv = PositiveTimestamp_clone(&val_conv);
80440         RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
80441 }
80442
80443 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawDataPart_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
80444         LDKRawDataPart a_conv;
80445         a_conv.inner = untag_ptr(a);
80446         a_conv.is_owned = ptr_is_owned(a);
80447         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
80448         a_conv.is_owned = false;
80449         LDKRawDataPart b_conv;
80450         b_conv.inner = untag_ptr(b);
80451         b_conv.is_owned = ptr_is_owned(b);
80452         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
80453         b_conv.is_owned = false;
80454         jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
80455         return ret_conv;
80456 }
80457
80458 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
80459         LDKRawDataPart ret_var = RawDataPart_clone(arg);
80460         int64_t ret_ref = 0;
80461         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80462         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80463         return ret_ref;
80464 }
80465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
80466         LDKRawDataPart arg_conv;
80467         arg_conv.inner = untag_ptr(arg);
80468         arg_conv.is_owned = ptr_is_owned(arg);
80469         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
80470         arg_conv.is_owned = false;
80471         int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
80472         return ret_conv;
80473 }
80474
80475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone(JNIEnv *env, jclass clz, int64_t orig) {
80476         LDKRawDataPart orig_conv;
80477         orig_conv.inner = untag_ptr(orig);
80478         orig_conv.is_owned = ptr_is_owned(orig);
80479         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
80480         orig_conv.is_owned = false;
80481         LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
80482         int64_t ret_ref = 0;
80483         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80484         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80485         return ret_ref;
80486 }
80487
80488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1hash(JNIEnv *env, jclass clz, int64_t o) {
80489         LDKRawDataPart o_conv;
80490         o_conv.inner = untag_ptr(o);
80491         o_conv.is_owned = ptr_is_owned(o);
80492         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
80493         o_conv.is_owned = false;
80494         int64_t ret_conv = RawDataPart_hash(&o_conv);
80495         return ret_conv;
80496 }
80497
80498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
80499         LDKPositiveTimestamp this_obj_conv;
80500         this_obj_conv.inner = untag_ptr(this_obj);
80501         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80503         PositiveTimestamp_free(this_obj_conv);
80504 }
80505
80506 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
80507         LDKPositiveTimestamp a_conv;
80508         a_conv.inner = untag_ptr(a);
80509         a_conv.is_owned = ptr_is_owned(a);
80510         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
80511         a_conv.is_owned = false;
80512         LDKPositiveTimestamp b_conv;
80513         b_conv.inner = untag_ptr(b);
80514         b_conv.is_owned = ptr_is_owned(b);
80515         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
80516         b_conv.is_owned = false;
80517         jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
80518         return ret_conv;
80519 }
80520
80521 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
80522         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
80523         int64_t ret_ref = 0;
80524         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80525         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80526         return ret_ref;
80527 }
80528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
80529         LDKPositiveTimestamp arg_conv;
80530         arg_conv.inner = untag_ptr(arg);
80531         arg_conv.is_owned = ptr_is_owned(arg);
80532         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
80533         arg_conv.is_owned = false;
80534         int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
80535         return ret_conv;
80536 }
80537
80538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone(JNIEnv *env, jclass clz, int64_t orig) {
80539         LDKPositiveTimestamp orig_conv;
80540         orig_conv.inner = untag_ptr(orig);
80541         orig_conv.is_owned = ptr_is_owned(orig);
80542         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
80543         orig_conv.is_owned = false;
80544         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
80545         int64_t ret_ref = 0;
80546         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80547         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80548         return ret_ref;
80549 }
80550
80551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1hash(JNIEnv *env, jclass clz, int64_t o) {
80552         LDKPositiveTimestamp o_conv;
80553         o_conv.inner = untag_ptr(o);
80554         o_conv.is_owned = ptr_is_owned(o);
80555         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
80556         o_conv.is_owned = false;
80557         int64_t ret_conv = PositiveTimestamp_hash(&o_conv);
80558         return ret_conv;
80559 }
80560
80561 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1clone(JNIEnv *env, jclass clz, int64_t orig) {
80562         LDKSiPrefix* orig_conv = (LDKSiPrefix*)untag_ptr(orig);
80563         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_clone(orig_conv));
80564         return ret_conv;
80565 }
80566
80567 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1milli(JNIEnv *env, jclass clz) {
80568         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_milli());
80569         return ret_conv;
80570 }
80571
80572 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1micro(JNIEnv *env, jclass clz) {
80573         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_micro());
80574         return ret_conv;
80575 }
80576
80577 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1nano(JNIEnv *env, jclass clz) {
80578         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_nano());
80579         return ret_conv;
80580 }
80581
80582 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1pico(JNIEnv *env, jclass clz) {
80583         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_pico());
80584         return ret_conv;
80585 }
80586
80587 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SiPrefix_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
80588         LDKSiPrefix* a_conv = (LDKSiPrefix*)untag_ptr(a);
80589         LDKSiPrefix* b_conv = (LDKSiPrefix*)untag_ptr(b);
80590         jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
80591         return ret_conv;
80592 }
80593
80594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1hash(JNIEnv *env, jclass clz, int64_t o) {
80595         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
80596         int64_t ret_conv = SiPrefix_hash(o_conv);
80597         return ret_conv;
80598 }
80599
80600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1multiplier(JNIEnv *env, jclass clz, int64_t this_arg) {
80601         LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)untag_ptr(this_arg);
80602         int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
80603         return ret_conv;
80604 }
80605
80606 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1clone(JNIEnv *env, jclass clz, int64_t orig) {
80607         LDKCurrency* orig_conv = (LDKCurrency*)untag_ptr(orig);
80608         jclass ret_conv = LDKCurrency_to_java(env, Currency_clone(orig_conv));
80609         return ret_conv;
80610 }
80611
80612 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin(JNIEnv *env, jclass clz) {
80613         jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin());
80614         return ret_conv;
80615 }
80616
80617 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin_1testnet(JNIEnv *env, jclass clz) {
80618         jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin_testnet());
80619         return ret_conv;
80620 }
80621
80622 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1regtest(JNIEnv *env, jclass clz) {
80623         jclass ret_conv = LDKCurrency_to_java(env, Currency_regtest());
80624         return ret_conv;
80625 }
80626
80627 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1simnet(JNIEnv *env, jclass clz) {
80628         jclass ret_conv = LDKCurrency_to_java(env, Currency_simnet());
80629         return ret_conv;
80630 }
80631
80632 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1signet(JNIEnv *env, jclass clz) {
80633         jclass ret_conv = LDKCurrency_to_java(env, Currency_signet());
80634         return ret_conv;
80635 }
80636
80637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Currency_1hash(JNIEnv *env, jclass clz, int64_t o) {
80638         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
80639         int64_t ret_conv = Currency_hash(o_conv);
80640         return ret_conv;
80641 }
80642
80643 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Currency_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
80644         LDKCurrency* a_conv = (LDKCurrency*)untag_ptr(a);
80645         LDKCurrency* b_conv = (LDKCurrency*)untag_ptr(b);
80646         jboolean ret_conv = Currency_eq(a_conv, b_conv);
80647         return ret_conv;
80648 }
80649
80650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sha256_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
80651         LDKSha256 this_obj_conv;
80652         this_obj_conv.inner = untag_ptr(this_obj);
80653         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80655         Sha256_free(this_obj_conv);
80656 }
80657
80658 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
80659         LDKSha256 ret_var = Sha256_clone(arg);
80660         int64_t ret_ref = 0;
80661         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80662         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80663         return ret_ref;
80664 }
80665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
80666         LDKSha256 arg_conv;
80667         arg_conv.inner = untag_ptr(arg);
80668         arg_conv.is_owned = ptr_is_owned(arg);
80669         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
80670         arg_conv.is_owned = false;
80671         int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
80672         return ret_conv;
80673 }
80674
80675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone(JNIEnv *env, jclass clz, int64_t orig) {
80676         LDKSha256 orig_conv;
80677         orig_conv.inner = untag_ptr(orig);
80678         orig_conv.is_owned = ptr_is_owned(orig);
80679         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
80680         orig_conv.is_owned = false;
80681         LDKSha256 ret_var = Sha256_clone(&orig_conv);
80682         int64_t ret_ref = 0;
80683         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80684         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80685         return ret_ref;
80686 }
80687
80688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1hash(JNIEnv *env, jclass clz, int64_t o) {
80689         LDKSha256 o_conv;
80690         o_conv.inner = untag_ptr(o);
80691         o_conv.is_owned = ptr_is_owned(o);
80692         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
80693         o_conv.is_owned = false;
80694         int64_t ret_conv = Sha256_hash(&o_conv);
80695         return ret_conv;
80696 }
80697
80698 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sha256_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
80699         LDKSha256 a_conv;
80700         a_conv.inner = untag_ptr(a);
80701         a_conv.is_owned = ptr_is_owned(a);
80702         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
80703         a_conv.is_owned = false;
80704         LDKSha256 b_conv;
80705         b_conv.inner = untag_ptr(b);
80706         b_conv.is_owned = ptr_is_owned(b);
80707         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
80708         b_conv.is_owned = false;
80709         jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
80710         return ret_conv;
80711 }
80712
80713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1from_1bytes(JNIEnv *env, jclass clz, int8_tArray bytes) {
80714         uint8_t bytes_arr[32];
80715         CHECK((*env)->GetArrayLength(env, bytes) == 32);
80716         (*env)->GetByteArrayRegion(env, bytes, 0, 32, bytes_arr);
80717         uint8_t (*bytes_ref)[32] = &bytes_arr;
80718         LDKSha256 ret_var = Sha256_from_bytes(bytes_ref);
80719         int64_t ret_ref = 0;
80720         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80721         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80722         return ret_ref;
80723 }
80724
80725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
80726         LDKDescription this_obj_conv;
80727         this_obj_conv.inner = untag_ptr(this_obj);
80728         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80730         Description_free(this_obj_conv);
80731 }
80732
80733 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
80734         LDKDescription ret_var = Description_clone(arg);
80735         int64_t ret_ref = 0;
80736         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80737         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80738         return ret_ref;
80739 }
80740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
80741         LDKDescription arg_conv;
80742         arg_conv.inner = untag_ptr(arg);
80743         arg_conv.is_owned = ptr_is_owned(arg);
80744         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
80745         arg_conv.is_owned = false;
80746         int64_t ret_conv = Description_clone_ptr(&arg_conv);
80747         return ret_conv;
80748 }
80749
80750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone(JNIEnv *env, jclass clz, int64_t orig) {
80751         LDKDescription orig_conv;
80752         orig_conv.inner = untag_ptr(orig);
80753         orig_conv.is_owned = ptr_is_owned(orig);
80754         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
80755         orig_conv.is_owned = false;
80756         LDKDescription ret_var = Description_clone(&orig_conv);
80757         int64_t ret_ref = 0;
80758         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80759         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80760         return ret_ref;
80761 }
80762
80763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1hash(JNIEnv *env, jclass clz, int64_t o) {
80764         LDKDescription o_conv;
80765         o_conv.inner = untag_ptr(o);
80766         o_conv.is_owned = ptr_is_owned(o);
80767         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
80768         o_conv.is_owned = false;
80769         int64_t ret_conv = Description_hash(&o_conv);
80770         return ret_conv;
80771 }
80772
80773 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Description_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
80774         LDKDescription a_conv;
80775         a_conv.inner = untag_ptr(a);
80776         a_conv.is_owned = ptr_is_owned(a);
80777         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
80778         a_conv.is_owned = false;
80779         LDKDescription b_conv;
80780         b_conv.inner = untag_ptr(b);
80781         b_conv.is_owned = ptr_is_owned(b);
80782         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
80783         b_conv.is_owned = false;
80784         jboolean ret_conv = Description_eq(&a_conv, &b_conv);
80785         return ret_conv;
80786 }
80787
80788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
80789         LDKPayeePubKey this_obj_conv;
80790         this_obj_conv.inner = untag_ptr(this_obj);
80791         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80793         PayeePubKey_free(this_obj_conv);
80794 }
80795
80796 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
80797         LDKPayeePubKey this_ptr_conv;
80798         this_ptr_conv.inner = untag_ptr(this_ptr);
80799         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80801         this_ptr_conv.is_owned = false;
80802         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
80803         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PayeePubKey_get_a(&this_ptr_conv).compressed_form);
80804         return ret_arr;
80805 }
80806
80807 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
80808         LDKPayeePubKey this_ptr_conv;
80809         this_ptr_conv.inner = untag_ptr(this_ptr);
80810         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80812         this_ptr_conv.is_owned = false;
80813         LDKPublicKey val_ref;
80814         CHECK((*env)->GetArrayLength(env, val) == 33);
80815         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
80816         PayeePubKey_set_a(&this_ptr_conv, val_ref);
80817 }
80818
80819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
80820         LDKPublicKey a_arg_ref;
80821         CHECK((*env)->GetArrayLength(env, a_arg) == 33);
80822         (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
80823         LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
80824         int64_t ret_ref = 0;
80825         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80826         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80827         return ret_ref;
80828 }
80829
80830 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
80831         LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
80832         int64_t ret_ref = 0;
80833         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80834         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80835         return ret_ref;
80836 }
80837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
80838         LDKPayeePubKey arg_conv;
80839         arg_conv.inner = untag_ptr(arg);
80840         arg_conv.is_owned = ptr_is_owned(arg);
80841         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
80842         arg_conv.is_owned = false;
80843         int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
80844         return ret_conv;
80845 }
80846
80847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
80848         LDKPayeePubKey orig_conv;
80849         orig_conv.inner = untag_ptr(orig);
80850         orig_conv.is_owned = ptr_is_owned(orig);
80851         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
80852         orig_conv.is_owned = false;
80853         LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
80854         int64_t ret_ref = 0;
80855         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80856         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80857         return ret_ref;
80858 }
80859
80860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1hash(JNIEnv *env, jclass clz, int64_t o) {
80861         LDKPayeePubKey o_conv;
80862         o_conv.inner = untag_ptr(o);
80863         o_conv.is_owned = ptr_is_owned(o);
80864         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
80865         o_conv.is_owned = false;
80866         int64_t ret_conv = PayeePubKey_hash(&o_conv);
80867         return ret_conv;
80868 }
80869
80870 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
80871         LDKPayeePubKey a_conv;
80872         a_conv.inner = untag_ptr(a);
80873         a_conv.is_owned = ptr_is_owned(a);
80874         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
80875         a_conv.is_owned = false;
80876         LDKPayeePubKey b_conv;
80877         b_conv.inner = untag_ptr(b);
80878         b_conv.is_owned = ptr_is_owned(b);
80879         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
80880         b_conv.is_owned = false;
80881         jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
80882         return ret_conv;
80883 }
80884
80885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
80886         LDKExpiryTime this_obj_conv;
80887         this_obj_conv.inner = untag_ptr(this_obj);
80888         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80890         ExpiryTime_free(this_obj_conv);
80891 }
80892
80893 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
80894         LDKExpiryTime ret_var = ExpiryTime_clone(arg);
80895         int64_t ret_ref = 0;
80896         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80897         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80898         return ret_ref;
80899 }
80900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
80901         LDKExpiryTime arg_conv;
80902         arg_conv.inner = untag_ptr(arg);
80903         arg_conv.is_owned = ptr_is_owned(arg);
80904         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
80905         arg_conv.is_owned = false;
80906         int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
80907         return ret_conv;
80908 }
80909
80910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone(JNIEnv *env, jclass clz, int64_t orig) {
80911         LDKExpiryTime orig_conv;
80912         orig_conv.inner = untag_ptr(orig);
80913         orig_conv.is_owned = ptr_is_owned(orig);
80914         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
80915         orig_conv.is_owned = false;
80916         LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
80917         int64_t ret_ref = 0;
80918         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80919         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80920         return ret_ref;
80921 }
80922
80923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1hash(JNIEnv *env, jclass clz, int64_t o) {
80924         LDKExpiryTime o_conv;
80925         o_conv.inner = untag_ptr(o);
80926         o_conv.is_owned = ptr_is_owned(o);
80927         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
80928         o_conv.is_owned = false;
80929         int64_t ret_conv = ExpiryTime_hash(&o_conv);
80930         return ret_conv;
80931 }
80932
80933 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
80934         LDKExpiryTime a_conv;
80935         a_conv.inner = untag_ptr(a);
80936         a_conv.is_owned = ptr_is_owned(a);
80937         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
80938         a_conv.is_owned = false;
80939         LDKExpiryTime b_conv;
80940         b_conv.inner = untag_ptr(b);
80941         b_conv.is_owned = ptr_is_owned(b);
80942         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
80943         b_conv.is_owned = false;
80944         jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
80945         return ret_conv;
80946 }
80947
80948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
80949         LDKMinFinalCltvExpiryDelta this_obj_conv;
80950         this_obj_conv.inner = untag_ptr(this_obj);
80951         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80953         MinFinalCltvExpiryDelta_free(this_obj_conv);
80954 }
80955
80956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
80957         LDKMinFinalCltvExpiryDelta this_ptr_conv;
80958         this_ptr_conv.inner = untag_ptr(this_ptr);
80959         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80961         this_ptr_conv.is_owned = false;
80962         int64_t ret_conv = MinFinalCltvExpiryDelta_get_a(&this_ptr_conv);
80963         return ret_conv;
80964 }
80965
80966 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
80967         LDKMinFinalCltvExpiryDelta this_ptr_conv;
80968         this_ptr_conv.inner = untag_ptr(this_ptr);
80969         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80971         this_ptr_conv.is_owned = false;
80972         MinFinalCltvExpiryDelta_set_a(&this_ptr_conv, val);
80973 }
80974
80975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
80976         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_new(a_arg);
80977         int64_t ret_ref = 0;
80978         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80979         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80980         return ret_ref;
80981 }
80982
80983 static inline uint64_t MinFinalCltvExpiryDelta_clone_ptr(LDKMinFinalCltvExpiryDelta *NONNULL_PTR arg) {
80984         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(arg);
80985         int64_t ret_ref = 0;
80986         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80987         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80988         return ret_ref;
80989 }
80990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
80991         LDKMinFinalCltvExpiryDelta arg_conv;
80992         arg_conv.inner = untag_ptr(arg);
80993         arg_conv.is_owned = ptr_is_owned(arg);
80994         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
80995         arg_conv.is_owned = false;
80996         int64_t ret_conv = MinFinalCltvExpiryDelta_clone_ptr(&arg_conv);
80997         return ret_conv;
80998 }
80999
81000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1clone(JNIEnv *env, jclass clz, int64_t orig) {
81001         LDKMinFinalCltvExpiryDelta orig_conv;
81002         orig_conv.inner = untag_ptr(orig);
81003         orig_conv.is_owned = ptr_is_owned(orig);
81004         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
81005         orig_conv.is_owned = false;
81006         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(&orig_conv);
81007         int64_t ret_ref = 0;
81008         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81009         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81010         return ret_ref;
81011 }
81012
81013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1hash(JNIEnv *env, jclass clz, int64_t o) {
81014         LDKMinFinalCltvExpiryDelta o_conv;
81015         o_conv.inner = untag_ptr(o);
81016         o_conv.is_owned = ptr_is_owned(o);
81017         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
81018         o_conv.is_owned = false;
81019         int64_t ret_conv = MinFinalCltvExpiryDelta_hash(&o_conv);
81020         return ret_conv;
81021 }
81022
81023 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
81024         LDKMinFinalCltvExpiryDelta a_conv;
81025         a_conv.inner = untag_ptr(a);
81026         a_conv.is_owned = ptr_is_owned(a);
81027         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
81028         a_conv.is_owned = false;
81029         LDKMinFinalCltvExpiryDelta b_conv;
81030         b_conv.inner = untag_ptr(b);
81031         b_conv.is_owned = ptr_is_owned(b);
81032         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
81033         b_conv.is_owned = false;
81034         jboolean ret_conv = MinFinalCltvExpiryDelta_eq(&a_conv, &b_conv);
81035         return ret_conv;
81036 }
81037
81038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Fallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
81039         if (!ptr_is_owned(this_ptr)) return;
81040         void* this_ptr_ptr = untag_ptr(this_ptr);
81041         CHECK_ACCESS(this_ptr_ptr);
81042         LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
81043         FREE(untag_ptr(this_ptr));
81044         Fallback_free(this_ptr_conv);
81045 }
81046
81047 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
81048         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
81049         *ret_copy = Fallback_clone(arg);
81050         int64_t ret_ref = tag_ptr(ret_copy, true);
81051         return ret_ref;
81052 }
81053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
81054         LDKFallback* arg_conv = (LDKFallback*)untag_ptr(arg);
81055         int64_t ret_conv = Fallback_clone_ptr(arg_conv);
81056         return ret_conv;
81057 }
81058
81059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone(JNIEnv *env, jclass clz, int64_t orig) {
81060         LDKFallback* orig_conv = (LDKFallback*)untag_ptr(orig);
81061         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
81062         *ret_copy = Fallback_clone(orig_conv);
81063         int64_t ret_ref = tag_ptr(ret_copy, true);
81064         return ret_ref;
81065 }
81066
81067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1seg_1wit_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
81068         
81069         LDKCVec_u8Z program_ref;
81070         program_ref.datalen = (*env)->GetArrayLength(env, program);
81071         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
81072         (*env)->GetByteArrayRegion(env, program, 0, program_ref.datalen, program_ref.data);
81073         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
81074         *ret_copy = Fallback_seg_wit_program((LDKWitnessVersion){ ._0 = version }, program_ref);
81075         int64_t ret_ref = tag_ptr(ret_copy, true);
81076         return ret_ref;
81077 }
81078
81079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1pub_1key_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
81080         LDKTwentyBytes a_ref;
81081         CHECK((*env)->GetArrayLength(env, a) == 20);
81082         (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
81083         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
81084         *ret_copy = Fallback_pub_key_hash(a_ref);
81085         int64_t ret_ref = tag_ptr(ret_copy, true);
81086         return ret_ref;
81087 }
81088
81089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1script_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
81090         LDKTwentyBytes a_ref;
81091         CHECK((*env)->GetArrayLength(env, a) == 20);
81092         (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
81093         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
81094         *ret_copy = Fallback_script_hash(a_ref);
81095         int64_t ret_ref = tag_ptr(ret_copy, true);
81096         return ret_ref;
81097 }
81098
81099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1hash(JNIEnv *env, jclass clz, int64_t o) {
81100         LDKFallback* o_conv = (LDKFallback*)untag_ptr(o);
81101         int64_t ret_conv = Fallback_hash(o_conv);
81102         return ret_conv;
81103 }
81104
81105 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Fallback_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
81106         LDKFallback* a_conv = (LDKFallback*)untag_ptr(a);
81107         LDKFallback* b_conv = (LDKFallback*)untag_ptr(b);
81108         jboolean ret_conv = Fallback_eq(a_conv, b_conv);
81109         return ret_conv;
81110 }
81111
81112 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
81113         LDKBolt11InvoiceSignature this_obj_conv;
81114         this_obj_conv.inner = untag_ptr(this_obj);
81115         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81117         Bolt11InvoiceSignature_free(this_obj_conv);
81118 }
81119
81120 static inline uint64_t Bolt11InvoiceSignature_clone_ptr(LDKBolt11InvoiceSignature *NONNULL_PTR arg) {
81121         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(arg);
81122         int64_t ret_ref = 0;
81123         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81124         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81125         return ret_ref;
81126 }
81127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
81128         LDKBolt11InvoiceSignature arg_conv;
81129         arg_conv.inner = untag_ptr(arg);
81130         arg_conv.is_owned = ptr_is_owned(arg);
81131         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
81132         arg_conv.is_owned = false;
81133         int64_t ret_conv = Bolt11InvoiceSignature_clone_ptr(&arg_conv);
81134         return ret_conv;
81135 }
81136
81137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1clone(JNIEnv *env, jclass clz, int64_t orig) {
81138         LDKBolt11InvoiceSignature orig_conv;
81139         orig_conv.inner = untag_ptr(orig);
81140         orig_conv.is_owned = ptr_is_owned(orig);
81141         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
81142         orig_conv.is_owned = false;
81143         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(&orig_conv);
81144         int64_t ret_ref = 0;
81145         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81146         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81147         return ret_ref;
81148 }
81149
81150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1hash(JNIEnv *env, jclass clz, int64_t o) {
81151         LDKBolt11InvoiceSignature o_conv;
81152         o_conv.inner = untag_ptr(o);
81153         o_conv.is_owned = ptr_is_owned(o);
81154         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
81155         o_conv.is_owned = false;
81156         int64_t ret_conv = Bolt11InvoiceSignature_hash(&o_conv);
81157         return ret_conv;
81158 }
81159
81160 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
81161         LDKBolt11InvoiceSignature a_conv;
81162         a_conv.inner = untag_ptr(a);
81163         a_conv.is_owned = ptr_is_owned(a);
81164         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
81165         a_conv.is_owned = false;
81166         LDKBolt11InvoiceSignature b_conv;
81167         b_conv.inner = untag_ptr(b);
81168         b_conv.is_owned = ptr_is_owned(b);
81169         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
81170         b_conv.is_owned = false;
81171         jboolean ret_conv = Bolt11InvoiceSignature_eq(&a_conv, &b_conv);
81172         return ret_conv;
81173 }
81174
81175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
81176         LDKPrivateRoute this_obj_conv;
81177         this_obj_conv.inner = untag_ptr(this_obj);
81178         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81180         PrivateRoute_free(this_obj_conv);
81181 }
81182
81183 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
81184         LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
81185         int64_t ret_ref = 0;
81186         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81187         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81188         return ret_ref;
81189 }
81190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
81191         LDKPrivateRoute arg_conv;
81192         arg_conv.inner = untag_ptr(arg);
81193         arg_conv.is_owned = ptr_is_owned(arg);
81194         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
81195         arg_conv.is_owned = false;
81196         int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
81197         return ret_conv;
81198 }
81199
81200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone(JNIEnv *env, jclass clz, int64_t orig) {
81201         LDKPrivateRoute orig_conv;
81202         orig_conv.inner = untag_ptr(orig);
81203         orig_conv.is_owned = ptr_is_owned(orig);
81204         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
81205         orig_conv.is_owned = false;
81206         LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
81207         int64_t ret_ref = 0;
81208         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81209         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81210         return ret_ref;
81211 }
81212
81213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1hash(JNIEnv *env, jclass clz, int64_t o) {
81214         LDKPrivateRoute o_conv;
81215         o_conv.inner = untag_ptr(o);
81216         o_conv.is_owned = ptr_is_owned(o);
81217         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
81218         o_conv.is_owned = false;
81219         int64_t ret_conv = PrivateRoute_hash(&o_conv);
81220         return ret_conv;
81221 }
81222
81223 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
81224         LDKPrivateRoute a_conv;
81225         a_conv.inner = untag_ptr(a);
81226         a_conv.is_owned = ptr_is_owned(a);
81227         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
81228         a_conv.is_owned = false;
81229         LDKPrivateRoute b_conv;
81230         b_conv.inner = untag_ptr(b);
81231         b_conv.is_owned = ptr_is_owned(b);
81232         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
81233         b_conv.is_owned = false;
81234         jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
81235         return ret_conv;
81236 }
81237
81238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1into_1parts(JNIEnv *env, jclass clz, int64_t this_arg) {
81239         LDKSignedRawBolt11Invoice this_arg_conv;
81240         this_arg_conv.inner = untag_ptr(this_arg);
81241         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81243         this_arg_conv = SignedRawBolt11Invoice_clone(&this_arg_conv);
81244         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
81245         *ret_conv = SignedRawBolt11Invoice_into_parts(this_arg_conv);
81246         return tag_ptr(ret_conv, true);
81247 }
81248
81249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1raw_1invoice(JNIEnv *env, jclass clz, int64_t this_arg) {
81250         LDKSignedRawBolt11Invoice this_arg_conv;
81251         this_arg_conv.inner = untag_ptr(this_arg);
81252         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81254         this_arg_conv.is_owned = false;
81255         LDKRawBolt11Invoice ret_var = SignedRawBolt11Invoice_raw_invoice(&this_arg_conv);
81256         int64_t ret_ref = 0;
81257         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81258         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81259         return ret_ref;
81260 }
81261
81262 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
81263         LDKSignedRawBolt11Invoice this_arg_conv;
81264         this_arg_conv.inner = untag_ptr(this_arg);
81265         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81267         this_arg_conv.is_owned = false;
81268         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
81269         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SignedRawBolt11Invoice_signable_hash(&this_arg_conv));
81270         return ret_arr;
81271 }
81272
81273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
81274         LDKSignedRawBolt11Invoice this_arg_conv;
81275         this_arg_conv.inner = untag_ptr(this_arg);
81276         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81278         this_arg_conv.is_owned = false;
81279         LDKBolt11InvoiceSignature ret_var = SignedRawBolt11Invoice_signature(&this_arg_conv);
81280         int64_t ret_ref = 0;
81281         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81282         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81283         return ret_ref;
81284 }
81285
81286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
81287         LDKSignedRawBolt11Invoice this_arg_conv;
81288         this_arg_conv.inner = untag_ptr(this_arg);
81289         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81291         this_arg_conv.is_owned = false;
81292         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
81293         *ret_conv = SignedRawBolt11Invoice_recover_payee_pub_key(&this_arg_conv);
81294         return tag_ptr(ret_conv, true);
81295 }
81296
81297 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
81298         LDKSignedRawBolt11Invoice this_arg_conv;
81299         this_arg_conv.inner = untag_ptr(this_arg);
81300         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81302         this_arg_conv.is_owned = false;
81303         jboolean ret_conv = SignedRawBolt11Invoice_check_signature(&this_arg_conv);
81304         return ret_conv;
81305 }
81306
81307 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
81308         LDKRawBolt11Invoice this_arg_conv;
81309         this_arg_conv.inner = untag_ptr(this_arg);
81310         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81312         this_arg_conv.is_owned = false;
81313         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
81314         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawBolt11Invoice_signable_hash(&this_arg_conv).data);
81315         return ret_arr;
81316 }
81317
81318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
81319         LDKRawBolt11Invoice this_arg_conv;
81320         this_arg_conv.inner = untag_ptr(this_arg);
81321         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81323         this_arg_conv.is_owned = false;
81324         LDKSha256 ret_var = RawBolt11Invoice_payment_hash(&this_arg_conv);
81325         int64_t ret_ref = 0;
81326         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81327         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81328         return ret_ref;
81329 }
81330
81331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
81332         LDKRawBolt11Invoice this_arg_conv;
81333         this_arg_conv.inner = untag_ptr(this_arg);
81334         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81336         this_arg_conv.is_owned = false;
81337         LDKDescription ret_var = RawBolt11Invoice_description(&this_arg_conv);
81338         int64_t ret_ref = 0;
81339         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81340         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81341         return ret_ref;
81342 }
81343
81344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
81345         LDKRawBolt11Invoice this_arg_conv;
81346         this_arg_conv.inner = untag_ptr(this_arg);
81347         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81349         this_arg_conv.is_owned = false;
81350         LDKPayeePubKey ret_var = RawBolt11Invoice_payee_pub_key(&this_arg_conv);
81351         int64_t ret_ref = 0;
81352         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81353         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81354         return ret_ref;
81355 }
81356
81357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1description_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
81358         LDKRawBolt11Invoice this_arg_conv;
81359         this_arg_conv.inner = untag_ptr(this_arg);
81360         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81362         this_arg_conv.is_owned = false;
81363         LDKSha256 ret_var = RawBolt11Invoice_description_hash(&this_arg_conv);
81364         int64_t ret_ref = 0;
81365         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81366         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81367         return ret_ref;
81368 }
81369
81370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
81371         LDKRawBolt11Invoice this_arg_conv;
81372         this_arg_conv.inner = untag_ptr(this_arg);
81373         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81375         this_arg_conv.is_owned = false;
81376         LDKExpiryTime ret_var = RawBolt11Invoice_expiry_time(&this_arg_conv);
81377         int64_t ret_ref = 0;
81378         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81379         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81380         return ret_ref;
81381 }
81382
81383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1min_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_arg) {
81384         LDKRawBolt11Invoice this_arg_conv;
81385         this_arg_conv.inner = untag_ptr(this_arg);
81386         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81388         this_arg_conv.is_owned = false;
81389         LDKMinFinalCltvExpiryDelta ret_var = RawBolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
81390         int64_t ret_ref = 0;
81391         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81392         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81393         return ret_ref;
81394 }
81395
81396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
81397         LDKRawBolt11Invoice this_arg_conv;
81398         this_arg_conv.inner = untag_ptr(this_arg);
81399         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81401         this_arg_conv.is_owned = false;
81402         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
81403         *ret_copy = RawBolt11Invoice_payment_secret(&this_arg_conv);
81404         int64_t ret_ref = tag_ptr(ret_copy, true);
81405         return ret_ref;
81406 }
81407
81408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
81409         LDKRawBolt11Invoice this_arg_conv;
81410         this_arg_conv.inner = untag_ptr(this_arg);
81411         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81413         this_arg_conv.is_owned = false;
81414         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
81415         *ret_copy = RawBolt11Invoice_payment_metadata(&this_arg_conv);
81416         int64_t ret_ref = tag_ptr(ret_copy, true);
81417         return ret_ref;
81418 }
81419
81420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
81421         LDKRawBolt11Invoice this_arg_conv;
81422         this_arg_conv.inner = untag_ptr(this_arg);
81423         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81425         this_arg_conv.is_owned = false;
81426         LDKBolt11InvoiceFeatures ret_var = RawBolt11Invoice_features(&this_arg_conv);
81427         int64_t ret_ref = 0;
81428         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81429         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81430         return ret_ref;
81431 }
81432
81433 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
81434         LDKRawBolt11Invoice this_arg_conv;
81435         this_arg_conv.inner = untag_ptr(this_arg);
81436         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81438         this_arg_conv.is_owned = false;
81439         LDKCVec_PrivateRouteZ ret_var = RawBolt11Invoice_private_routes(&this_arg_conv);
81440         int64_tArray ret_arr = NULL;
81441         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
81442         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
81443         for (size_t o = 0; o < ret_var.datalen; o++) {
81444                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
81445                 int64_t ret_conv_14_ref = 0;
81446                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
81447                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
81448                 ret_arr_ptr[o] = ret_conv_14_ref;
81449         }
81450         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
81451         FREE(ret_var.data);
81452         return ret_arr;
81453 }
81454
81455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
81456         LDKRawBolt11Invoice this_arg_conv;
81457         this_arg_conv.inner = untag_ptr(this_arg);
81458         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81460         this_arg_conv.is_owned = false;
81461         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
81462         *ret_copy = RawBolt11Invoice_amount_pico_btc(&this_arg_conv);
81463         int64_t ret_ref = tag_ptr(ret_copy, true);
81464         return ret_ref;
81465 }
81466
81467 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
81468         LDKRawBolt11Invoice this_arg_conv;
81469         this_arg_conv.inner = untag_ptr(this_arg);
81470         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81472         this_arg_conv.is_owned = false;
81473         jclass ret_conv = LDKCurrency_to_java(env, RawBolt11Invoice_currency(&this_arg_conv));
81474         return ret_conv;
81475 }
81476
81477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t unix_seconds) {
81478         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
81479         *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
81480         return tag_ptr(ret_conv, true);
81481 }
81482
81483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1system_1time(JNIEnv *env, jclass clz, int64_t time) {
81484         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
81485         *ret_conv = PositiveTimestamp_from_system_time(time);
81486         return tag_ptr(ret_conv, true);
81487 }
81488
81489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t duration) {
81490         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
81491         *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
81492         return tag_ptr(ret_conv, true);
81493 }
81494
81495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
81496         LDKPositiveTimestamp this_arg_conv;
81497         this_arg_conv.inner = untag_ptr(this_arg);
81498         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81500         this_arg_conv.is_owned = false;
81501         int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
81502         return ret_conv;
81503 }
81504
81505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
81506         LDKPositiveTimestamp this_arg_conv;
81507         this_arg_conv.inner = untag_ptr(this_arg);
81508         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81510         this_arg_conv.is_owned = false;
81511         int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
81512         return ret_conv;
81513 }
81514
81515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
81516         LDKPositiveTimestamp this_arg_conv;
81517         this_arg_conv.inner = untag_ptr(this_arg);
81518         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81520         this_arg_conv.is_owned = false;
81521         int64_t ret_conv = PositiveTimestamp_as_time(&this_arg_conv);
81522         return ret_conv;
81523 }
81524
81525 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
81526         LDKBolt11Invoice this_arg_conv;
81527         this_arg_conv.inner = untag_ptr(this_arg);
81528         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81530         this_arg_conv.is_owned = false;
81531         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
81532         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Bolt11Invoice_signable_hash(&this_arg_conv).data);
81533         return ret_arr;
81534 }
81535
81536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1into_1signed_1raw(JNIEnv *env, jclass clz, int64_t this_arg) {
81537         LDKBolt11Invoice this_arg_conv;
81538         this_arg_conv.inner = untag_ptr(this_arg);
81539         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81541         this_arg_conv = Bolt11Invoice_clone(&this_arg_conv);
81542         LDKSignedRawBolt11Invoice ret_var = Bolt11Invoice_into_signed_raw(this_arg_conv);
81543         int64_t ret_ref = 0;
81544         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81545         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81546         return ret_ref;
81547 }
81548
81549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
81550         LDKBolt11Invoice this_arg_conv;
81551         this_arg_conv.inner = untag_ptr(this_arg);
81552         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81554         this_arg_conv.is_owned = false;
81555         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
81556         *ret_conv = Bolt11Invoice_check_signature(&this_arg_conv);
81557         return tag_ptr(ret_conv, true);
81558 }
81559
81560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1from_1signed(JNIEnv *env, jclass clz, int64_t signed_invoice) {
81561         LDKSignedRawBolt11Invoice signed_invoice_conv;
81562         signed_invoice_conv.inner = untag_ptr(signed_invoice);
81563         signed_invoice_conv.is_owned = ptr_is_owned(signed_invoice);
81564         CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
81565         signed_invoice_conv = SignedRawBolt11Invoice_clone(&signed_invoice_conv);
81566         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
81567         *ret_conv = Bolt11Invoice_from_signed(signed_invoice_conv);
81568         return tag_ptr(ret_conv, true);
81569 }
81570
81571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
81572         LDKBolt11Invoice this_arg_conv;
81573         this_arg_conv.inner = untag_ptr(this_arg);
81574         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81576         this_arg_conv.is_owned = false;
81577         int64_t ret_conv = Bolt11Invoice_timestamp(&this_arg_conv);
81578         return ret_conv;
81579 }
81580
81581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
81582         LDKBolt11Invoice this_arg_conv;
81583         this_arg_conv.inner = untag_ptr(this_arg);
81584         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81586         this_arg_conv.is_owned = false;
81587         int64_t ret_conv = Bolt11Invoice_duration_since_epoch(&this_arg_conv);
81588         return ret_conv;
81589 }
81590
81591 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
81592         LDKBolt11Invoice this_arg_conv;
81593         this_arg_conv.inner = untag_ptr(this_arg);
81594         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81596         this_arg_conv.is_owned = false;
81597         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
81598         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Bolt11Invoice_payment_hash(&this_arg_conv));
81599         return ret_arr;
81600 }
81601
81602 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
81603         LDKBolt11Invoice this_arg_conv;
81604         this_arg_conv.inner = untag_ptr(this_arg);
81605         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81607         this_arg_conv.is_owned = false;
81608         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
81609         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Bolt11Invoice_payee_pub_key(&this_arg_conv).compressed_form);
81610         return ret_arr;
81611 }
81612
81613 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
81614         LDKBolt11Invoice this_arg_conv;
81615         this_arg_conv.inner = untag_ptr(this_arg);
81616         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81618         this_arg_conv.is_owned = false;
81619         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
81620         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Bolt11Invoice_payment_secret(&this_arg_conv));
81621         return ret_arr;
81622 }
81623
81624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
81625         LDKBolt11Invoice this_arg_conv;
81626         this_arg_conv.inner = untag_ptr(this_arg);
81627         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81629         this_arg_conv.is_owned = false;
81630         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
81631         *ret_copy = Bolt11Invoice_payment_metadata(&this_arg_conv);
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_Bolt11Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
81637         LDKBolt11Invoice this_arg_conv;
81638         this_arg_conv.inner = untag_ptr(this_arg);
81639         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81641         this_arg_conv.is_owned = false;
81642         LDKBolt11InvoiceFeatures ret_var = Bolt11Invoice_features(&this_arg_conv);
81643         int64_t ret_ref = 0;
81644         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81645         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81646         return ret_ref;
81647 }
81648
81649 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
81650         LDKBolt11Invoice this_arg_conv;
81651         this_arg_conv.inner = untag_ptr(this_arg);
81652         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81654         this_arg_conv.is_owned = false;
81655         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
81656         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Bolt11Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form);
81657         return ret_arr;
81658 }
81659
81660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1expires_1at(JNIEnv *env, jclass clz, int64_t this_arg) {
81661         LDKBolt11Invoice this_arg_conv;
81662         this_arg_conv.inner = untag_ptr(this_arg);
81663         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81665         this_arg_conv.is_owned = false;
81666         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
81667         *ret_copy = Bolt11Invoice_expires_at(&this_arg_conv);
81668         int64_t ret_ref = tag_ptr(ret_copy, true);
81669         return ret_ref;
81670 }
81671
81672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
81673         LDKBolt11Invoice this_arg_conv;
81674         this_arg_conv.inner = untag_ptr(this_arg);
81675         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81677         this_arg_conv.is_owned = false;
81678         int64_t ret_conv = Bolt11Invoice_expiry_time(&this_arg_conv);
81679         return ret_conv;
81680 }
81681
81682 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
81683         LDKBolt11Invoice this_arg_conv;
81684         this_arg_conv.inner = untag_ptr(this_arg);
81685         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81687         this_arg_conv.is_owned = false;
81688         jboolean ret_conv = Bolt11Invoice_is_expired(&this_arg_conv);
81689         return ret_conv;
81690 }
81691
81692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1duration_1until_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
81693         LDKBolt11Invoice this_arg_conv;
81694         this_arg_conv.inner = untag_ptr(this_arg);
81695         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81697         this_arg_conv.is_owned = false;
81698         int64_t ret_conv = Bolt11Invoice_duration_until_expiry(&this_arg_conv);
81699         return ret_conv;
81700 }
81701
81702 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) {
81703         LDKBolt11Invoice this_arg_conv;
81704         this_arg_conv.inner = untag_ptr(this_arg);
81705         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81707         this_arg_conv.is_owned = false;
81708         int64_t ret_conv = Bolt11Invoice_expiration_remaining_from_epoch(&this_arg_conv, time);
81709         return ret_conv;
81710 }
81711
81712 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1would_1expire(JNIEnv *env, jclass clz, int64_t this_arg, int64_t at_time) {
81713         LDKBolt11Invoice this_arg_conv;
81714         this_arg_conv.inner = untag_ptr(this_arg);
81715         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81717         this_arg_conv.is_owned = false;
81718         jboolean ret_conv = Bolt11Invoice_would_expire(&this_arg_conv, at_time);
81719         return ret_conv;
81720 }
81721
81722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1min_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_arg) {
81723         LDKBolt11Invoice this_arg_conv;
81724         this_arg_conv.inner = untag_ptr(this_arg);
81725         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81727         this_arg_conv.is_owned = false;
81728         int64_t ret_conv = Bolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
81729         return ret_conv;
81730 }
81731
81732 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1fallback_1addresses(JNIEnv *env, jclass clz, int64_t this_arg) {
81733         LDKBolt11Invoice this_arg_conv;
81734         this_arg_conv.inner = untag_ptr(this_arg);
81735         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81737         this_arg_conv.is_owned = false;
81738         LDKCVec_StrZ ret_var = Bolt11Invoice_fallback_addresses(&this_arg_conv);
81739         jobjectArray ret_arr = NULL;
81740         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, String_clz, NULL);
81741         ;
81742         jstring *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
81743         for (size_t i = 0; i < ret_var.datalen; i++) {
81744                 LDKStr ret_conv_8_str = ret_var.data[i];
81745                 jstring ret_conv_8_conv = str_ref_to_java(env, ret_conv_8_str.chars, ret_conv_8_str.len);
81746                 Str_free(ret_conv_8_str);
81747                 ret_arr_ptr[i] = ret_conv_8_conv;
81748         }
81749         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
81750         FREE(ret_var.data);
81751         return ret_arr;
81752 }
81753
81754 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
81755         LDKBolt11Invoice this_arg_conv;
81756         this_arg_conv.inner = untag_ptr(this_arg);
81757         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81759         this_arg_conv.is_owned = false;
81760         LDKCVec_PrivateRouteZ ret_var = Bolt11Invoice_private_routes(&this_arg_conv);
81761         int64_tArray ret_arr = NULL;
81762         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
81763         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
81764         for (size_t o = 0; o < ret_var.datalen; o++) {
81765                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
81766                 int64_t ret_conv_14_ref = 0;
81767                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
81768                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
81769                 ret_arr_ptr[o] = ret_conv_14_ref;
81770         }
81771         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
81772         FREE(ret_var.data);
81773         return ret_arr;
81774 }
81775
81776 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
81777         LDKBolt11Invoice this_arg_conv;
81778         this_arg_conv.inner = untag_ptr(this_arg);
81779         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81781         this_arg_conv.is_owned = false;
81782         LDKCVec_RouteHintZ ret_var = Bolt11Invoice_route_hints(&this_arg_conv);
81783         int64_tArray ret_arr = NULL;
81784         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
81785         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
81786         for (size_t l = 0; l < ret_var.datalen; l++) {
81787                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
81788                 int64_t ret_conv_11_ref = 0;
81789                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
81790                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
81791                 ret_arr_ptr[l] = ret_conv_11_ref;
81792         }
81793         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
81794         FREE(ret_var.data);
81795         return ret_arr;
81796 }
81797
81798 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
81799         LDKBolt11Invoice this_arg_conv;
81800         this_arg_conv.inner = untag_ptr(this_arg);
81801         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81803         this_arg_conv.is_owned = false;
81804         jclass ret_conv = LDKCurrency_to_java(env, Bolt11Invoice_currency(&this_arg_conv));
81805         return ret_conv;
81806 }
81807
81808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1amount_1milli_1satoshis(JNIEnv *env, jclass clz, int64_t this_arg) {
81809         LDKBolt11Invoice this_arg_conv;
81810         this_arg_conv.inner = untag_ptr(this_arg);
81811         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81813         this_arg_conv.is_owned = false;
81814         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
81815         *ret_copy = Bolt11Invoice_amount_milli_satoshis(&this_arg_conv);
81816         int64_t ret_ref = tag_ptr(ret_copy, true);
81817         return ret_ref;
81818 }
81819
81820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1new(JNIEnv *env, jclass clz, jstring description) {
81821         LDKStr description_conv = java_to_owned_str(env, description);
81822         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
81823         *ret_conv = Description_new(description_conv);
81824         return tag_ptr(ret_conv, true);
81825 }
81826
81827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
81828         LDKDescription this_arg_conv;
81829         this_arg_conv.inner = untag_ptr(this_arg);
81830         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81832         this_arg_conv = Description_clone(&this_arg_conv);
81833         LDKUntrustedString ret_var = Description_into_inner(this_arg_conv);
81834         int64_t ret_ref = 0;
81835         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81836         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81837         return ret_ref;
81838 }
81839
81840 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Description_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
81841         LDKDescription o_conv;
81842         o_conv.inner = untag_ptr(o);
81843         o_conv.is_owned = ptr_is_owned(o);
81844         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
81845         o_conv.is_owned = false;
81846         LDKStr ret_str = Description_to_str(&o_conv);
81847         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
81848         Str_free(ret_str);
81849         return ret_conv;
81850 }
81851
81852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1seconds(JNIEnv *env, jclass clz, int64_t seconds) {
81853         LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
81854         int64_t ret_ref = 0;
81855         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81856         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81857         return ret_ref;
81858 }
81859
81860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1duration(JNIEnv *env, jclass clz, int64_t duration) {
81861         LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
81862         int64_t ret_ref = 0;
81863         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81864         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81865         return ret_ref;
81866 }
81867
81868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1seconds(JNIEnv *env, jclass clz, int64_t this_arg) {
81869         LDKExpiryTime this_arg_conv;
81870         this_arg_conv.inner = untag_ptr(this_arg);
81871         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81873         this_arg_conv.is_owned = false;
81874         int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
81875         return ret_conv;
81876 }
81877
81878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1duration(JNIEnv *env, jclass clz, int64_t this_arg) {
81879         LDKExpiryTime this_arg_conv;
81880         this_arg_conv.inner = untag_ptr(this_arg);
81881         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81883         this_arg_conv.is_owned = false;
81884         int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
81885         return ret_conv;
81886 }
81887
81888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1new(JNIEnv *env, jclass clz, int64_t hops) {
81889         LDKRouteHint hops_conv;
81890         hops_conv.inner = untag_ptr(hops);
81891         hops_conv.is_owned = ptr_is_owned(hops);
81892         CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
81893         hops_conv = RouteHint_clone(&hops_conv);
81894         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
81895         *ret_conv = PrivateRoute_new(hops_conv);
81896         return tag_ptr(ret_conv, true);
81897 }
81898
81899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
81900         LDKPrivateRoute this_arg_conv;
81901         this_arg_conv.inner = untag_ptr(this_arg);
81902         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81904         this_arg_conv = PrivateRoute_clone(&this_arg_conv);
81905         LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
81906         int64_t ret_ref = 0;
81907         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81908         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81909         return ret_ref;
81910 }
81911
81912 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
81913         LDKCreationError* orig_conv = (LDKCreationError*)untag_ptr(orig);
81914         jclass ret_conv = LDKCreationError_to_java(env, CreationError_clone(orig_conv));
81915         return ret_conv;
81916 }
81917
81918 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1description_1too_1long(JNIEnv *env, jclass clz) {
81919         jclass ret_conv = LDKCreationError_to_java(env, CreationError_description_too_long());
81920         return ret_conv;
81921 }
81922
81923 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1route_1too_1long(JNIEnv *env, jclass clz) {
81924         jclass ret_conv = LDKCreationError_to_java(env, CreationError_route_too_long());
81925         return ret_conv;
81926 }
81927
81928 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1timestamp_1out_1of_1bounds(JNIEnv *env, jclass clz) {
81929         jclass ret_conv = LDKCreationError_to_java(env, CreationError_timestamp_out_of_bounds());
81930         return ret_conv;
81931 }
81932
81933 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1invalid_1amount(JNIEnv *env, jclass clz) {
81934         jclass ret_conv = LDKCreationError_to_java(env, CreationError_invalid_amount());
81935         return ret_conv;
81936 }
81937
81938 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1missing_1route_1hints(JNIEnv *env, jclass clz) {
81939         jclass ret_conv = LDKCreationError_to_java(env, CreationError_missing_route_hints());
81940         return ret_conv;
81941 }
81942
81943 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1min_1final_1cltv_1expiry_1delta_1too_1short(JNIEnv *env, jclass clz) {
81944         jclass ret_conv = LDKCreationError_to_java(env, CreationError_min_final_cltv_expiry_delta_too_short());
81945         return ret_conv;
81946 }
81947
81948 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
81949         LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a);
81950         LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b);
81951         jboolean ret_conv = CreationError_eq(a_conv, b_conv);
81952         return ret_conv;
81953 }
81954
81955 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
81956         LDKCreationError* o_conv = (LDKCreationError*)untag_ptr(o);
81957         LDKStr ret_str = CreationError_to_str(o_conv);
81958         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
81959         Str_free(ret_str);
81960         return ret_conv;
81961 }
81962
81963 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
81964         LDKBolt11SemanticError* orig_conv = (LDKBolt11SemanticError*)untag_ptr(orig);
81965         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_clone(orig_conv));
81966         return ret_conv;
81967 }
81968
81969 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1no_1payment_1hash(JNIEnv *env, jclass clz) {
81970         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_no_payment_hash());
81971         return ret_conv;
81972 }
81973
81974 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1multiple_1payment_1hashes(JNIEnv *env, jclass clz) {
81975         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_multiple_payment_hashes());
81976         return ret_conv;
81977 }
81978
81979 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1no_1description(JNIEnv *env, jclass clz) {
81980         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_no_description());
81981         return ret_conv;
81982 }
81983
81984 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1multiple_1descriptions(JNIEnv *env, jclass clz) {
81985         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_multiple_descriptions());
81986         return ret_conv;
81987 }
81988
81989 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1no_1payment_1secret(JNIEnv *env, jclass clz) {
81990         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_no_payment_secret());
81991         return ret_conv;
81992 }
81993
81994 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1multiple_1payment_1secrets(JNIEnv *env, jclass clz) {
81995         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_multiple_payment_secrets());
81996         return ret_conv;
81997 }
81998
81999 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1invalid_1features(JNIEnv *env, jclass clz) {
82000         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_invalid_features());
82001         return ret_conv;
82002 }
82003
82004 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
82005         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_invalid_recovery_id());
82006         return ret_conv;
82007 }
82008
82009 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1invalid_1signature(JNIEnv *env, jclass clz) {
82010         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_invalid_signature());
82011         return ret_conv;
82012 }
82013
82014 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1imprecise_1amount(JNIEnv *env, jclass clz) {
82015         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_imprecise_amount());
82016         return ret_conv;
82017 }
82018
82019 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
82020         LDKBolt11SemanticError* a_conv = (LDKBolt11SemanticError*)untag_ptr(a);
82021         LDKBolt11SemanticError* b_conv = (LDKBolt11SemanticError*)untag_ptr(b);
82022         jboolean ret_conv = Bolt11SemanticError_eq(a_conv, b_conv);
82023         return ret_conv;
82024 }
82025
82026 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
82027         LDKBolt11SemanticError* o_conv = (LDKBolt11SemanticError*)untag_ptr(o);
82028         LDKStr ret_str = Bolt11SemanticError_to_str(o_conv);
82029         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
82030         Str_free(ret_str);
82031         return ret_conv;
82032 }
82033
82034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
82035         if (!ptr_is_owned(this_ptr)) return;
82036         void* this_ptr_ptr = untag_ptr(this_ptr);
82037         CHECK_ACCESS(this_ptr_ptr);
82038         LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
82039         FREE(untag_ptr(this_ptr));
82040         SignOrCreationError_free(this_ptr_conv);
82041 }
82042
82043 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
82044         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
82045         *ret_copy = SignOrCreationError_clone(arg);
82046         int64_t ret_ref = tag_ptr(ret_copy, true);
82047         return ret_ref;
82048 }
82049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
82050         LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)untag_ptr(arg);
82051         int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
82052         return ret_conv;
82053 }
82054
82055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
82056         LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)untag_ptr(orig);
82057         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
82058         *ret_copy = SignOrCreationError_clone(orig_conv);
82059         int64_t ret_ref = tag_ptr(ret_copy, true);
82060         return ret_ref;
82061 }
82062
82063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1sign_1error(JNIEnv *env, jclass clz) {
82064         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
82065         *ret_copy = SignOrCreationError_sign_error();
82066         int64_t ret_ref = tag_ptr(ret_copy, true);
82067         return ret_ref;
82068 }
82069
82070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1creation_1error(JNIEnv *env, jclass clz, jclass a) {
82071         LDKCreationError a_conv = LDKCreationError_from_java(env, a);
82072         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
82073         *ret_copy = SignOrCreationError_creation_error(a_conv);
82074         int64_t ret_ref = tag_ptr(ret_copy, true);
82075         return ret_ref;
82076 }
82077
82078 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
82079         LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)untag_ptr(a);
82080         LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)untag_ptr(b);
82081         jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
82082         return ret_conv;
82083 }
82084
82085 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
82086         LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)untag_ptr(o);
82087         LDKStr ret_str = SignOrCreationError_to_str(o_conv);
82088         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
82089         Str_free(ret_str);
82090         return ret_conv;
82091 }
82092
82093 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) {
82094         LDKBolt11Invoice invoice_conv;
82095         invoice_conv.inner = untag_ptr(invoice);
82096         invoice_conv.is_owned = ptr_is_owned(invoice);
82097         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
82098         invoice_conv.is_owned = false;
82099         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
82100         *ret_conv = payment_parameters_from_zero_amount_invoice(&invoice_conv, amount_msat);
82101         return tag_ptr(ret_conv, true);
82102 }
82103
82104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_payment_1parameters_1from_1invoice(JNIEnv *env, jclass clz, int64_t invoice) {
82105         LDKBolt11Invoice invoice_conv;
82106         invoice_conv.inner = untag_ptr(invoice);
82107         invoice_conv.is_owned = ptr_is_owned(invoice);
82108         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
82109         invoice_conv.is_owned = false;
82110         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
82111         *ret_conv = payment_parameters_from_invoice(&invoice_conv);
82112         return tag_ptr(ret_conv, true);
82113 }
82114
82115 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) {
82116         void* amt_msat_ptr = untag_ptr(amt_msat);
82117         CHECK_ACCESS(amt_msat_ptr);
82118         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
82119         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
82120         void* payment_hash_ptr = untag_ptr(payment_hash);
82121         CHECK_ACCESS(payment_hash_ptr);
82122         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
82123         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
82124         LDKStr description_conv = java_to_owned_str(env, description);
82125         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
82126         phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints);
82127         if (phantom_route_hints_constr.datalen > 0)
82128                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
82129         else
82130                 phantom_route_hints_constr.data = NULL;
82131         int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL);
82132         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
82133                 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
82134                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
82135                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
82136                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
82137                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
82138                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
82139                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
82140         }
82141         (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0);
82142         void* entropy_source_ptr = untag_ptr(entropy_source);
82143         CHECK_ACCESS(entropy_source_ptr);
82144         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
82145         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
82146                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82147                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
82148         }
82149         void* node_signer_ptr = untag_ptr(node_signer);
82150         CHECK_ACCESS(node_signer_ptr);
82151         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
82152         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
82153                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82154                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
82155         }
82156         void* logger_ptr = untag_ptr(logger);
82157         CHECK_ACCESS(logger_ptr);
82158         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
82159         if (logger_conv.free == LDKLogger_JCalls_free) {
82160                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82161                 LDKLogger_JCalls_cloned(&logger_conv);
82162         }
82163         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
82164         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
82165         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
82166         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
82167         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
82168         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
82169         *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);
82170         return tag_ptr(ret_conv, true);
82171 }
82172
82173 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) {
82174         void* amt_msat_ptr = untag_ptr(amt_msat);
82175         CHECK_ACCESS(amt_msat_ptr);
82176         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
82177         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
82178         void* payment_hash_ptr = untag_ptr(payment_hash);
82179         CHECK_ACCESS(payment_hash_ptr);
82180         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
82181         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
82182         LDKSha256 description_hash_conv;
82183         description_hash_conv.inner = untag_ptr(description_hash);
82184         description_hash_conv.is_owned = ptr_is_owned(description_hash);
82185         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
82186         description_hash_conv = Sha256_clone(&description_hash_conv);
82187         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
82188         phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints);
82189         if (phantom_route_hints_constr.datalen > 0)
82190                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
82191         else
82192                 phantom_route_hints_constr.data = NULL;
82193         int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL);
82194         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
82195                 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
82196                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
82197                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
82198                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
82199                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
82200                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
82201                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
82202         }
82203         (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0);
82204         void* entropy_source_ptr = untag_ptr(entropy_source);
82205         CHECK_ACCESS(entropy_source_ptr);
82206         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
82207         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
82208                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82209                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
82210         }
82211         void* node_signer_ptr = untag_ptr(node_signer);
82212         CHECK_ACCESS(node_signer_ptr);
82213         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
82214         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
82215                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82216                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
82217         }
82218         void* logger_ptr = untag_ptr(logger);
82219         CHECK_ACCESS(logger_ptr);
82220         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
82221         if (logger_conv.free == LDKLogger_JCalls_free) {
82222                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82223                 LDKLogger_JCalls_cloned(&logger_conv);
82224         }
82225         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
82226         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
82227         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
82228         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
82229         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
82230         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
82231         *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);
82232         return tag_ptr(ret_conv, true);
82233 }
82234
82235 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) {
82236         LDKChannelManager channelmanager_conv;
82237         channelmanager_conv.inner = untag_ptr(channelmanager);
82238         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
82239         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
82240         channelmanager_conv.is_owned = false;
82241         void* node_signer_ptr = untag_ptr(node_signer);
82242         CHECK_ACCESS(node_signer_ptr);
82243         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
82244         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
82245                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82246                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
82247         }
82248         void* logger_ptr = untag_ptr(logger);
82249         CHECK_ACCESS(logger_ptr);
82250         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
82251         if (logger_conv.free == LDKLogger_JCalls_free) {
82252                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82253                 LDKLogger_JCalls_cloned(&logger_conv);
82254         }
82255         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
82256         void* amt_msat_ptr = untag_ptr(amt_msat);
82257         CHECK_ACCESS(amt_msat_ptr);
82258         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
82259         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
82260         LDKStr description_conv = java_to_owned_str(env, description);
82261         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
82262         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
82263         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
82264         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
82265         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
82266         *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);
82267         return tag_ptr(ret_conv, true);
82268 }
82269
82270 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) {
82271         LDKChannelManager channelmanager_conv;
82272         channelmanager_conv.inner = untag_ptr(channelmanager);
82273         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
82274         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
82275         channelmanager_conv.is_owned = false;
82276         void* node_signer_ptr = untag_ptr(node_signer);
82277         CHECK_ACCESS(node_signer_ptr);
82278         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
82279         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
82280                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82281                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
82282         }
82283         void* logger_ptr = untag_ptr(logger);
82284         CHECK_ACCESS(logger_ptr);
82285         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
82286         if (logger_conv.free == LDKLogger_JCalls_free) {
82287                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82288                 LDKLogger_JCalls_cloned(&logger_conv);
82289         }
82290         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
82291         void* amt_msat_ptr = untag_ptr(amt_msat);
82292         CHECK_ACCESS(amt_msat_ptr);
82293         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
82294         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
82295         LDKSha256 description_hash_conv;
82296         description_hash_conv.inner = untag_ptr(description_hash);
82297         description_hash_conv.is_owned = ptr_is_owned(description_hash);
82298         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
82299         description_hash_conv = Sha256_clone(&description_hash_conv);
82300         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
82301         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
82302         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
82303         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
82304         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
82305         *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);
82306         return tag_ptr(ret_conv, true);
82307 }
82308
82309 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) {
82310         LDKChannelManager channelmanager_conv;
82311         channelmanager_conv.inner = untag_ptr(channelmanager);
82312         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
82313         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
82314         channelmanager_conv.is_owned = false;
82315         void* node_signer_ptr = untag_ptr(node_signer);
82316         CHECK_ACCESS(node_signer_ptr);
82317         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
82318         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
82319                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82320                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
82321         }
82322         void* logger_ptr = untag_ptr(logger);
82323         CHECK_ACCESS(logger_ptr);
82324         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
82325         if (logger_conv.free == LDKLogger_JCalls_free) {
82326                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82327                 LDKLogger_JCalls_cloned(&logger_conv);
82328         }
82329         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
82330         void* amt_msat_ptr = untag_ptr(amt_msat);
82331         CHECK_ACCESS(amt_msat_ptr);
82332         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
82333         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
82334         LDKSha256 description_hash_conv;
82335         description_hash_conv.inner = untag_ptr(description_hash);
82336         description_hash_conv.is_owned = ptr_is_owned(description_hash);
82337         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
82338         description_hash_conv = Sha256_clone(&description_hash_conv);
82339         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
82340         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
82341         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
82342         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
82343         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
82344         *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);
82345         return tag_ptr(ret_conv, true);
82346 }
82347
82348 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) {
82349         LDKChannelManager channelmanager_conv;
82350         channelmanager_conv.inner = untag_ptr(channelmanager);
82351         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
82352         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
82353         channelmanager_conv.is_owned = false;
82354         void* node_signer_ptr = untag_ptr(node_signer);
82355         CHECK_ACCESS(node_signer_ptr);
82356         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
82357         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
82358                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82359                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
82360         }
82361         void* logger_ptr = untag_ptr(logger);
82362         CHECK_ACCESS(logger_ptr);
82363         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
82364         if (logger_conv.free == LDKLogger_JCalls_free) {
82365                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82366                 LDKLogger_JCalls_cloned(&logger_conv);
82367         }
82368         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
82369         void* amt_msat_ptr = untag_ptr(amt_msat);
82370         CHECK_ACCESS(amt_msat_ptr);
82371         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
82372         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
82373         LDKStr description_conv = java_to_owned_str(env, description);
82374         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
82375         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
82376         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
82377         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
82378         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
82379         *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);
82380         return tag_ptr(ret_conv, true);
82381 }
82382
82383 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) {
82384         LDKChannelManager channelmanager_conv;
82385         channelmanager_conv.inner = untag_ptr(channelmanager);
82386         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
82387         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
82388         channelmanager_conv.is_owned = false;
82389         void* node_signer_ptr = untag_ptr(node_signer);
82390         CHECK_ACCESS(node_signer_ptr);
82391         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
82392         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
82393                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82394                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
82395         }
82396         void* logger_ptr = untag_ptr(logger);
82397         CHECK_ACCESS(logger_ptr);
82398         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
82399         if (logger_conv.free == LDKLogger_JCalls_free) {
82400                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82401                 LDKLogger_JCalls_cloned(&logger_conv);
82402         }
82403         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
82404         void* amt_msat_ptr = untag_ptr(amt_msat);
82405         CHECK_ACCESS(amt_msat_ptr);
82406         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
82407         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
82408         LDKStr description_conv = java_to_owned_str(env, description);
82409         LDKThirtyTwoBytes payment_hash_ref;
82410         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
82411         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
82412         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
82413         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
82414         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
82415         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
82416         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
82417         *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);
82418         return tag_ptr(ret_conv, true);
82419 }
82420
82421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1from_1str(JNIEnv *env, jclass clz, jstring s) {
82422         LDKStr s_conv = java_to_owned_str(env, s);
82423         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
82424         *ret_conv = SiPrefix_from_str(s_conv);
82425         return tag_ptr(ret_conv, true);
82426 }
82427
82428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
82429         LDKStr s_conv = java_to_owned_str(env, s);
82430         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
82431         *ret_conv = Bolt11Invoice_from_str(s_conv);
82432         return tag_ptr(ret_conv, true);
82433 }
82434
82435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
82436         LDKStr s_conv = java_to_owned_str(env, s);
82437         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
82438         *ret_conv = SignedRawBolt11Invoice_from_str(s_conv);
82439         return tag_ptr(ret_conv, true);
82440 }
82441
82442 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
82443         LDKBolt11ParseError* o_conv = (LDKBolt11ParseError*)untag_ptr(o);
82444         LDKStr ret_str = Bolt11ParseError_to_str(o_conv);
82445         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
82446         Str_free(ret_str);
82447         return ret_conv;
82448 }
82449
82450 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
82451         LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)untag_ptr(o);
82452         LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
82453         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
82454         Str_free(ret_str);
82455         return ret_conv;
82456 }
82457
82458 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
82459         LDKBolt11Invoice o_conv;
82460         o_conv.inner = untag_ptr(o);
82461         o_conv.is_owned = ptr_is_owned(o);
82462         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
82463         o_conv.is_owned = false;
82464         LDKStr ret_str = Bolt11Invoice_to_str(&o_conv);
82465         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
82466         Str_free(ret_str);
82467         return ret_conv;
82468 }
82469
82470 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
82471         LDKSignedRawBolt11Invoice o_conv;
82472         o_conv.inner = untag_ptr(o);
82473         o_conv.is_owned = ptr_is_owned(o);
82474         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
82475         o_conv.is_owned = false;
82476         LDKStr ret_str = SignedRawBolt11Invoice_to_str(&o_conv);
82477         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
82478         Str_free(ret_str);
82479         return ret_conv;
82480 }
82481
82482 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Currency_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
82483         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
82484         LDKStr ret_str = Currency_to_str(o_conv);
82485         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
82486         Str_free(ret_str);
82487         return ret_conv;
82488 }
82489
82490 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SiPrefix_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
82491         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
82492         LDKStr ret_str = SiPrefix_to_str(o_conv);
82493         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
82494         Str_free(ret_str);
82495         return ret_conv;
82496 }
82497
82498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
82499         if (!ptr_is_owned(this_ptr)) return;
82500         void* this_ptr_ptr = untag_ptr(this_ptr);
82501         CHECK_ACCESS(this_ptr_ptr);
82502         LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
82503         FREE(untag_ptr(this_ptr));
82504         GraphSyncError_free(this_ptr_conv);
82505 }
82506
82507 static inline uint64_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
82508         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
82509         *ret_copy = GraphSyncError_clone(arg);
82510         int64_t ret_ref = tag_ptr(ret_copy, true);
82511         return ret_ref;
82512 }
82513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
82514         LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)untag_ptr(arg);
82515         int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
82516         return ret_conv;
82517 }
82518
82519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
82520         LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)untag_ptr(orig);
82521         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
82522         *ret_copy = GraphSyncError_clone(orig_conv);
82523         int64_t ret_ref = tag_ptr(ret_copy, true);
82524         return ret_ref;
82525 }
82526
82527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1decode_1error(JNIEnv *env, jclass clz, int64_t a) {
82528         void* a_ptr = untag_ptr(a);
82529         CHECK_ACCESS(a_ptr);
82530         LDKDecodeError a_conv = *(LDKDecodeError*)(a_ptr);
82531         a_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(a));
82532         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
82533         *ret_copy = GraphSyncError_decode_error(a_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_GraphSyncError_1lightning_1error(JNIEnv *env, jclass clz, int64_t a) {
82539         LDKLightningError a_conv;
82540         a_conv.inner = untag_ptr(a);
82541         a_conv.is_owned = ptr_is_owned(a);
82542         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
82543         a_conv = LightningError_clone(&a_conv);
82544         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
82545         *ret_copy = GraphSyncError_lightning_error(a_conv);
82546         int64_t ret_ref = tag_ptr(ret_copy, true);
82547         return ret_ref;
82548 }
82549
82550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
82551         LDKRapidGossipSync this_obj_conv;
82552         this_obj_conv.inner = untag_ptr(this_obj);
82553         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82555         RapidGossipSync_free(this_obj_conv);
82556 }
82557
82558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t logger) {
82559         LDKNetworkGraph network_graph_conv;
82560         network_graph_conv.inner = untag_ptr(network_graph);
82561         network_graph_conv.is_owned = ptr_is_owned(network_graph);
82562         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
82563         network_graph_conv.is_owned = false;
82564         void* logger_ptr = untag_ptr(logger);
82565         CHECK_ACCESS(logger_ptr);
82566         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
82567         if (logger_conv.free == LDKLogger_JCalls_free) {
82568                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82569                 LDKLogger_JCalls_cloned(&logger_conv);
82570         }
82571         LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv, logger_conv);
82572         int64_t ret_ref = 0;
82573         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82574         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82575         return ret_ref;
82576 }
82577
82578 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) {
82579         LDKRapidGossipSync this_arg_conv;
82580         this_arg_conv.inner = untag_ptr(this_arg);
82581         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82583         this_arg_conv.is_owned = false;
82584         LDKStr sync_path_conv = java_to_owned_str(env, sync_path);
82585         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
82586         *ret_conv = RapidGossipSync_sync_network_graph_with_file_path(&this_arg_conv, sync_path_conv);
82587         return tag_ptr(ret_conv, true);
82588 }
82589
82590 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) {
82591         LDKRapidGossipSync this_arg_conv;
82592         this_arg_conv.inner = untag_ptr(this_arg);
82593         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82595         this_arg_conv.is_owned = false;
82596         LDKu8slice update_data_ref;
82597         update_data_ref.datalen = (*env)->GetArrayLength(env, update_data);
82598         update_data_ref.data = (*env)->GetByteArrayElements (env, update_data, NULL);
82599         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
82600         *ret_conv = RapidGossipSync_update_network_graph(&this_arg_conv, update_data_ref);
82601         (*env)->ReleaseByteArrayElements(env, update_data, (int8_t*)update_data_ref.data, 0);
82602         return tag_ptr(ret_conv, true);
82603 }
82604
82605 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) {
82606         LDKRapidGossipSync this_arg_conv;
82607         this_arg_conv.inner = untag_ptr(this_arg);
82608         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82610         this_arg_conv.is_owned = false;
82611         LDKu8slice update_data_ref;
82612         update_data_ref.datalen = (*env)->GetArrayLength(env, update_data);
82613         update_data_ref.data = (*env)->GetByteArrayElements (env, update_data, NULL);
82614         void* current_time_unix_ptr = untag_ptr(current_time_unix);
82615         CHECK_ACCESS(current_time_unix_ptr);
82616         LDKCOption_u64Z current_time_unix_conv = *(LDKCOption_u64Z*)(current_time_unix_ptr);
82617         current_time_unix_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(current_time_unix));
82618         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
82619         *ret_conv = RapidGossipSync_update_network_graph_no_std(&this_arg_conv, update_data_ref, current_time_unix_conv);
82620         (*env)->ReleaseByteArrayElements(env, update_data, (int8_t*)update_data_ref.data, 0);
82621         return tag_ptr(ret_conv, true);
82622 }
82623
82624 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1is_1initial_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_arg) {
82625         LDKRapidGossipSync this_arg_conv;
82626         this_arg_conv.inner = untag_ptr(this_arg);
82627         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82629         this_arg_conv.is_owned = false;
82630         jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
82631         return ret_conv;
82632 }
82633